mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-06 11:02:25 +00:00
compilable upgrade of Moxie GWT wrapper for Highcharts from 1.5.0 to 1.6.0; geared to work with HIghcharts 3.0.3, but we're trying it with 4.0.1
This commit is contained in:
1 parent
37d9e33183
commit
3d7c827f1a
62 files changed
+5045
-390
No files matched your search
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Moxie Apps GWT Highcharts
|
||||
Bundle-SymbolicName: org.moxieapps.gwt.highcharts
|
||||
Bundle-Version: 1.5.0.qualifier
|
||||
Bundle-Version: 1.6.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Export-Package: org.moxieapps.gwt.highcharts.client.plotOptions;uses:="o
|
||||
rg.moxieapps.gwt.highcharts.client,com.google.gwt.json.client,org.moxie
|
||||
|
||||
@@ -43,6 +43,11 @@ public abstract class Axis<T extends Axis> extends Configurable<T> {
|
||||
*/
|
||||
public enum Type {
|
||||
|
||||
/**
|
||||
* Display the point names as categories for the axis
|
||||
*/
|
||||
CATEGORY("category"),
|
||||
|
||||
/**
|
||||
* Default axis type showing the values in a linear structure.
|
||||
*/
|
||||
|
||||
+2
@@ -81,6 +81,8 @@ public class AxisTitle extends Configurable<AxisTitle> {
|
||||
return this.setOption("align", align != null ? align.toString() : null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'margin' option of the title. Equivalent to:
|
||||
* <pre><code>
|
||||
|
||||
Regular → Executable
+333
-81
@@ -16,66 +16,22 @@
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.events.AxisSetExtremesEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartLoadEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartLoadEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartRedrawEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartRedrawEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointMouseOutEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointMouseOverEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointRemoveEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointSelectEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointUnselectEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointUpdateEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesHideEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesMouseOutEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesMouseOverEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesShowEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.AxisLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.DataLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.LegendLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.StackLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaRangePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaSplinePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaSplineRangePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.BarPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.ColumnPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.ColumnRangePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.LinePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.Marker;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.OHLCPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.PiePlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.ScatterPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.SplinePlotOptions;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONBoolean;
|
||||
import com.google.gwt.json.client.JSONNull;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
import com.google.gwt.json.client.*;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import org.moxieapps.gwt.highcharts.client.events.*;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.AxisLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.DataLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.LegendLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.StackLabelsData;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* The common base class for both {@link Chart} types as well as {@link StockChart} types.
|
||||
@@ -89,6 +45,75 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
*/
|
||||
public abstract class BaseChart<T> extends Widget {
|
||||
|
||||
/**
|
||||
* An enumeration of supported chart zoom types, which can be passed to the
|
||||
* {@link Chart#setZoomType(ZoomType)} method. The zoom type controls in what
|
||||
* dimensions the user can zoom by dragging the mouse
|
||||
*/
|
||||
public enum ZoomType {
|
||||
|
||||
/**
|
||||
* Allow zoom horizontally on the X axis only.
|
||||
*/
|
||||
X("x"),
|
||||
|
||||
/**
|
||||
* Allow zoom vertically on the Y axis only.
|
||||
*/
|
||||
Y("y"),
|
||||
|
||||
/**
|
||||
* Allow zooming both horizontally and vertically (both axes).
|
||||
*/
|
||||
X_AND_Y("xy");
|
||||
|
||||
private ZoomType(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of supported chart pinch types, which can be passed to the
|
||||
* {@link Chart#setPinchType(PinchType)} method. The pinch type controls in what
|
||||
* dimensions the user can zoom by pinching, if pinching is enabled.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public enum PinchType {
|
||||
|
||||
/**
|
||||
* Allow zoom horizontally on the X axis only.
|
||||
*/
|
||||
X("x"),
|
||||
|
||||
/**
|
||||
* Allow zoom vertically on the Y axis only.
|
||||
*/
|
||||
Y("y"),
|
||||
|
||||
/**
|
||||
* Allow zooming both horizontally and vertically (both axes).
|
||||
*/
|
||||
X_AND_Y("xy");
|
||||
|
||||
private PinchType(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This class can not be created directly, but instead create an instance of one of the
|
||||
* sub types such as {@link Chart} or {@link StockChart}.
|
||||
@@ -404,8 +429,9 @@ public abstract class BaseChart<T> extends Widget {
|
||||
* Sets the default colors for the chart's series. When all colors are used, new colors are pulled from the start again.
|
||||
* Note that the colors for each series can be overridden via the {@link org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions#setColor(String)} mechanism.
|
||||
* <p/>
|
||||
* Default colors are: "#4572A7", "#AA4643", "#89A54E", "#80699B", "#3D96AE", "#DB843D", "#92A8CD", "#A47D7C", "#B5CA92"
|
||||
*
|
||||
* Default colors are: "#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"
|
||||
* <p/>
|
||||
* Note: in Highcharts 2.x, default colors were: "#4572A7", "#AA4643", "#89A54E", "#80699B", "#3D96AE", "#DB843D", "#92A8CD", "#A47D7C", "#B5CA92"
|
||||
* @param colors An array of colors to use as the defaults for each series.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
@@ -682,6 +708,25 @@ public abstract class BaseChart<T> extends Widget {
|
||||
return this.setOption("/navigation", navigation != null ? navigation.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which dimensions the user can zoom using multi-touch gestures.
|
||||
* Can be one of {@link BaseChart.PinchType#X}, {@link BaseChart.PinchType#Y} or
|
||||
* {@link BaseChart.PinchType#X_AND_Y}. Defaults to null. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/pinchType", Chart.PinchType.X);
|
||||
* </code></pre>
|
||||
* Equivalent to zoomType, but for multitouch gestures only.
|
||||
* By default, the pinchType is the same as the zoomType setting.
|
||||
* However, pinching can be enabled separately in some cases, for example
|
||||
* in stock charts where a mouse drag pans the chart, while pinching is enabled. Defaults to null.
|
||||
* @param pinchType One of the allowed pinch types
|
||||
* @return A reference to this {@link Chart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setPinchType(BaseChart.PinchType pinchType) {
|
||||
return this.setOption("/chart/pinchType", pinchType != null ? pinchType.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'plotBackgroundColor' option of the chart to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -723,6 +768,21 @@ public abstract class BaseChart<T> extends Widget {
|
||||
return this.setOption("/chart/plotBackgroundColor", plotBackgroundColor != null ? plotBackgroundColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'plotBackgroundImage option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/plotBackgroundImage", null)
|
||||
* </code></pre>
|
||||
* To set an image as the background for the entire chart, set a CSS background image to the container element.
|
||||
* Defaults to null.
|
||||
* @param plotBackgroundImage The URL for an image to use as the plot background.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setPlotBackgroundImage(String plotBackgroundImage) {
|
||||
return this.setOption("/chart/plotBackgroundImage", plotBackgroundImage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'plotBorderColor' option of the chart to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -778,6 +838,21 @@ public abstract class BaseChart<T> extends Widget {
|
||||
return this.setOption("/chart/plotBorderWidth", plotBorderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to set the 'polar' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/polar", true);
|
||||
* </code></pre>
|
||||
* When true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system.
|
||||
* Requires highcharts-more.js. Defaults to false.
|
||||
* @param polar Whether to render the the chart using a polar coordinate system.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setPolar(boolean polar) {
|
||||
return this.setOption("/chart/polar", polar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'plotShadow' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -808,6 +883,53 @@ public abstract class BaseChart<T> extends Widget {
|
||||
return this.setOption("/chart/reflow", reflow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for adding the reset zoom button to the chart. Equivalent to:
|
||||
* <pre><>code>
|
||||
* chart.setOption("/resetZoomButton"
|
||||
* </code></pre>
|
||||
* @param resetZoomButton The button that appears after a selection zoom, allowing the user to reset zoom.
|
||||
* @return A reference to this {@link Chart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setResetZoomButton(ResetZoomButton resetZoomButton) {
|
||||
return this.setOption("/chart/resetZoomButton", resetZoomButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'selectionMarkerFill' option of the chart to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/selectionMarkerFill", "#4572a7");
|
||||
* </code></pre>
|
||||
* The RGB color of the selection marker. Defaults to "#4572a7".
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setSelectionMarkerFill(Color)}
|
||||
* version instead.
|
||||
* @param selectionMarkerFill The background color of the marker square when selecting (zooming in on) an area of the chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setSelectionMarkerFill(String selectionMarkerFill) {
|
||||
return this.setOption("/chart/selectionMarkerFill", selectionMarkerFill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'plotBackgroundColor' option of the chart, allowing for
|
||||
* colors with opacity. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/selectionMarkerFill", rgba(69,114,167,0.25));
|
||||
* </code></pre>
|
||||
* Note that this method is intended for setting the color to one that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setSelectionMarkerFill(String)} version instead.
|
||||
* @param selectionMarkerFill The color with an alpha channel to fil the marker square when selecting (zooming in on) an area of the chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setSelectionMarkerFill(Color selectionMarkerFill) {
|
||||
return this.setOption("/chart/selectionMarkerFill", selectionMarkerFill != null ? selectionMarkerFill.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'shadow' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -1006,7 +1128,7 @@ public abstract class BaseChart<T> extends Widget {
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setType(Series.Type type) {
|
||||
return this.setOption("/chart/type", type.toString());
|
||||
return this.setOption("/chart/type", type != null ? type.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1193,15 +1315,22 @@ public abstract class BaseChart<T> extends Widget {
|
||||
private AreaSplinePlotOptions areaSplinePlotOptions;
|
||||
private AreaSplineRangePlotOptions areaSplineRangePlotOptions;
|
||||
private BarPlotOptions barPlotOptions;
|
||||
private BoxPlotOptions boxPlotOptions;
|
||||
private BubblePlotOptions bubblePlotOptions;
|
||||
private ColumnPlotOptions columnPlotOptions;
|
||||
private ColumnRangePlotOptions columnRangePlotOptions;
|
||||
private ErrorBarPlotOptions errorBarPlotOptions;
|
||||
private FunnelPlotOptions funnelPlotOptions;
|
||||
private GaugePlotOptions gaugePlotOptions;
|
||||
private LinePlotOptions linePlotOptions;
|
||||
private PiePlotOptions piePlotOptions;
|
||||
private SeriesPlotOptions seriesPlotOptions;
|
||||
private ScatterPlotOptions scatterPlotOptions;
|
||||
private SplinePlotOptions splinePlotOptions;
|
||||
private WaterfallPlotOptions waterfallPlotOptions;
|
||||
|
||||
// The OHLC plot options are managed by the StockChart sub class, but the reference is managed here for rendering
|
||||
// The candlestick OHLC and plot options are managed by the StockChart sub class, but the reference is managed here for rendering
|
||||
protected CandlestickPlotOptions candlestickPlotOptions;
|
||||
protected OHLCPlotOptions ohlcPlotOptions;
|
||||
|
||||
/**
|
||||
@@ -1303,6 +1432,43 @@ public abstract class BaseChart<T> extends Widget {
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all box type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param boxPlotOptions The options to set on the chart as the default settings for all box type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setBoxPlotOptions(BoxPlotOptions boxPlotOptions) {
|
||||
this.boxPlotOptions = boxPlotOptions;
|
||||
return boxPlotOptions != null && boxPlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/box", boxPlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all bubble type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
* @param bubblePlotOptions The options set on the chart as the default settings for all bar type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setBubblePlotOptions(BubblePlotOptions bubblePlotOptions) {
|
||||
this.bubblePlotOptions = bubblePlotOptions;
|
||||
return bubblePlotOptions != null && bubblePlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/bubble", bubblePlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all column type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
@@ -1340,7 +1506,64 @@ public abstract class BaseChart<T> extends Widget {
|
||||
this.setOption("/plotOptions/columnrange", columnRangePlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the options that all errorBar type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param errorBarPlotOptions The options to set on the chart as the default settings for all box type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setErrorBarPlotOptions(ErrorBarPlotOptions errorBarPlotOptions) {
|
||||
this.errorBarPlotOptions = errorBarPlotOptions;
|
||||
return errorBarPlotOptions != null && errorBarPlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/errorbar", errorBarPlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all funnel type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param funnelPlotOptions The options to set on the chart as the default settings for all funnel type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setFunnelPlotOptions(FunnelPlotOptions funnelPlotOptions) {
|
||||
this.funnelPlotOptions = funnelPlotOptions;
|
||||
return funnelPlotOptions != null && funnelPlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/funnel", funnelPlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all funnel type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param gaugePlotOptions The options to set on the chart as the default settings for all funnel type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setGaugePlotOptions(GaugePlotOptions gaugePlotOptions) {
|
||||
this.gaugePlotOptions = gaugePlotOptions;
|
||||
return gaugePlotOptions != null && gaugePlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/gauge", gaugePlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all line type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
@@ -1421,6 +1644,25 @@ public abstract class BaseChart<T> extends Widget {
|
||||
returnThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all waterfall type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param waterfallPlotOptions The options to set on the chart as the default settings for all scatter type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWaterfallPlotOptions(WaterfallPlotOptions waterfallPlotOptions) {
|
||||
this.waterfallPlotOptions = waterfallPlotOptions;
|
||||
return waterfallPlotOptions != null && waterfallPlotOptions.getOptions() != null ?
|
||||
this.setOption("/plotOptions/waterfall", waterfallPlotOptions.getOptions()) :
|
||||
returnThis();
|
||||
}
|
||||
|
||||
private ChartClickEventHandler chartClickEventHandler;
|
||||
|
||||
/**
|
||||
@@ -1496,6 +1738,22 @@ public abstract class BaseChart<T> extends Widget {
|
||||
return this.setOption("/plotOptions/spline", splinePlotOptions.getOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which dimensions the user can zoom by dragging the mouse.
|
||||
* Can be one of {@link Chart.ZoomType#X}, {@link Chart.ZoomType#Y} or
|
||||
* {@link Chart.ZoomType#X_AND_Y}. Defaults to null.
|
||||
* This is equivalent to setting the option manually with code like:
|
||||
* <pre><code>
|
||||
* chart.setOption("/chart/zoomType", Chart.ZoomType.X);
|
||||
* </code></pre>
|
||||
*
|
||||
* @param zoomType One of the allowed zoom types.
|
||||
* @return A reference to this {@link Chart} instance for convenient method chaining.
|
||||
*/
|
||||
public T setZoomType(BaseChart.ZoomType zoomType) {
|
||||
return this.setOption("/chart/zoomType", zoomType != null ? zoomType.toString() : null);
|
||||
}
|
||||
|
||||
// Whether or not to retain the data points associated with each series in local GWT arrays (as
|
||||
// well as within the core Highcharts DOM elements)
|
||||
private boolean persistent = false;
|
||||
@@ -1940,7 +2198,6 @@ public abstract class BaseChart<T> extends Widget {
|
||||
public T redraw() {
|
||||
if (isRendered()) {
|
||||
nativeRedraw(chart);
|
||||
nativeAdjustCheckboxPosition(chart);
|
||||
}
|
||||
return returnThis();
|
||||
}
|
||||
@@ -1991,14 +2248,21 @@ public abstract class BaseChart<T> extends Widget {
|
||||
plotOptionsLabelFormatters.put("areaspline", hasDataLabelsFormatter(areaSplinePlotOptions));
|
||||
plotOptionsLabelFormatters.put("areasplinerange", hasDataLabelsFormatter(areaSplineRangePlotOptions));
|
||||
plotOptionsLabelFormatters.put("bar", hasDataLabelsFormatter(barPlotOptions));
|
||||
plotOptionsLabelFormatters.put("box", hasDataLabelsFormatter(boxPlotOptions));
|
||||
plotOptionsLabelFormatters.put("bubble", hasDataLabelsFormatter(bubblePlotOptions));
|
||||
plotOptionsLabelFormatters.put("candlestick", hasDataLabelsFormatter(candlestickPlotOptions));
|
||||
plotOptionsLabelFormatters.put("column", hasDataLabelsFormatter(columnPlotOptions));
|
||||
plotOptionsLabelFormatters.put("columnrange", hasDataLabelsFormatter(columnRangePlotOptions));
|
||||
plotOptionsLabelFormatters.put("errorbar", hasDataLabelsFormatter(errorBarPlotOptions));
|
||||
plotOptionsLabelFormatters.put("funnel", hasDataLabelsFormatter(funnelPlotOptions));
|
||||
plotOptionsLabelFormatters.put("gauge", hasDataLabelsFormatter(gaugePlotOptions));
|
||||
plotOptionsLabelFormatters.put("line", hasDataLabelsFormatter(linePlotOptions));
|
||||
plotOptionsLabelFormatters.put("pie", hasDataLabelsFormatter(piePlotOptions));
|
||||
plotOptionsLabelFormatters.put("ohlc", hasDataLabelsFormatter(ohlcPlotOptions));
|
||||
plotOptionsLabelFormatters.put("series", hasDataLabelsFormatter(seriesPlotOptions));
|
||||
plotOptionsLabelFormatters.put("scatter", hasDataLabelsFormatter(scatterPlotOptions));
|
||||
plotOptionsLabelFormatters.put("spline", hasDataLabelsFormatter(splinePlotOptions));
|
||||
plotOptionsLabelFormatters.put("waterfall", hasDataLabelsFormatter(waterfallPlotOptions));
|
||||
|
||||
// And one more for dealing with any data label formatters that have been applied directly to a series
|
||||
JSONArray seriesLabelFormatters = new JSONArray();
|
||||
@@ -2226,9 +2490,6 @@ public abstract class BaseChart<T> extends Widget {
|
||||
|
||||
// Purposefully package scope so we can get to this method from the Series and Point classes as well
|
||||
JSONValue convertPointToJSON(Point point) {
|
||||
if (point == null) {
|
||||
return JSONNull.getInstance();
|
||||
}
|
||||
JSONObject options = point.getOptions();
|
||||
if (options != null) {
|
||||
addPointScalarValues(point, options);
|
||||
@@ -2246,6 +2507,7 @@ public abstract class BaseChart<T> extends Widget {
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
switch (point.getType()) {
|
||||
case FLAG: return convertNumberToJSONValue(point.getX());
|
||||
case Y: return convertNumberToJSONValue(point.getY());
|
||||
case X_Y :
|
||||
jsonArray.set(0, convertNumberToJSONValue(point.getX()));
|
||||
@@ -2304,6 +2566,7 @@ public abstract class BaseChart<T> extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -2607,14 +2870,21 @@ public abstract class BaseChart<T> extends Widget {
|
||||
if ("areaspline".equals(type)) plotOptions = areaSplinePlotOptions;
|
||||
if ("areasplinerange".equals(type)) plotOptions = areaSplineRangePlotOptions;
|
||||
if ("bar".equals(type)) plotOptions = barPlotOptions;
|
||||
if ("box".equals(type)) plotOptions = boxPlotOptions;
|
||||
if ("bubble".equals(type)) plotOptions = bubblePlotOptions;
|
||||
if ("candlestick".equals(type)) plotOptions = candlestickPlotOptions;
|
||||
if ("column".equals(type)) plotOptions = columnPlotOptions;
|
||||
if ("columnrange".equals(type)) plotOptions = columnRangePlotOptions;
|
||||
if ("errorbar".equals(type)) plotOptions = errorBarPlotOptions;
|
||||
if ("funnel".equals(type)) plotOptions = funnelPlotOptions;
|
||||
if ("gauge".equals(type)) plotOptions = gaugePlotOptions;
|
||||
if ("line".equals(type)) plotOptions = linePlotOptions;
|
||||
if ("ohlc".equals(type)) plotOptions = ohlcPlotOptions;
|
||||
if ("pie".equals(type)) plotOptions = piePlotOptions;
|
||||
if ("scatter".equals(type)) plotOptions = scatterPlotOptions;
|
||||
if ("series".equals(type)) plotOptions = seriesPlotOptions;
|
||||
if ("spline".equals(type)) plotOptions = splinePlotOptions;
|
||||
if ("waterfall".equals(type)) plotOptions = waterfallPlotOptions;
|
||||
|
||||
if (plotOptions == null || plotOptions.getDataLabels() == null || plotOptions.getDataLabels().getFormatter() == null) {
|
||||
return null;
|
||||
@@ -2697,23 +2967,5 @@ public abstract class BaseChart<T> extends Widget {
|
||||
private static native void nativeSetTitle(JavaScriptObject chart, JavaScriptObject title, JavaScriptObject subTitle) /*-{
|
||||
chart.setTitle(title, subTitle);
|
||||
}-*/;
|
||||
|
||||
/**
|
||||
* Fixing a bug currently in the base Highcharts implementation regarding the placement of the checkbox in the legend.
|
||||
* Requires the symbol padding (see {@link Legend#setSymbolPadding(Number)}) to be set to <code>25</code>. Invoked
|
||||
* whenever the chart is rendered.<p>
|
||||
*
|
||||
* The implementation moves the checkbox between the legend symbol and the legend item, using the space made by setting the symbol
|
||||
* padding to 25px.
|
||||
*/
|
||||
private static native JavaScriptObject nativeAdjustCheckboxPosition(JavaScriptObject chart) /*-{
|
||||
var series = chart.series;
|
||||
for(var i= 0; i<series.length; i++) {
|
||||
if(series[i].legendItem && series[i].checkbox) {
|
||||
series[i].checkbox.style.marginLeft = - series[i].legendItemWidth + 40 + "px";
|
||||
series[i].checkbox.style.marginTop = '0px';
|
||||
}
|
||||
}
|
||||
}-*/;
|
||||
|
||||
}
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
/**
|
||||
* Configurable class which allows one to control the various options for export buttons.
|
||||
* <pre><code>
|
||||
* chart.setExporting(
|
||||
* new Exporting()
|
||||
* .setContextButton(
|
||||
* newContextButton(
|
||||
* .setAlign("center")
|
||||
* .setVerticalAlign("middle")
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class Button<T extends Button> extends Configurable<T> {
|
||||
|
||||
/**
|
||||
* An enumeration of supported credits horizontal alignment types, which can be passed to methods
|
||||
* like {@link Credits#setAlign(Credits.Align)} method.
|
||||
*/
|
||||
public enum Align {
|
||||
|
||||
/**
|
||||
* Left align the credits
|
||||
*/
|
||||
LEFT("left"),
|
||||
|
||||
/**
|
||||
* Center the credits
|
||||
*/
|
||||
CENTER("center"),
|
||||
|
||||
/**
|
||||
* Right align the credits
|
||||
*/
|
||||
RIGHT("right");
|
||||
|
||||
private Align(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of supported credits vertical alignment types, which can be passed to methods
|
||||
* like {@link Credits#setVerticalAlign(Credits.VerticalAlign)} method.
|
||||
*/
|
||||
public enum VerticalAlign {
|
||||
|
||||
/**
|
||||
* Show the credits at the top of the chart
|
||||
*/
|
||||
TOP("top"),
|
||||
|
||||
/**
|
||||
* Show the credits in the middle of the chart
|
||||
*/
|
||||
MIDDLE("middle"),
|
||||
|
||||
/**
|
||||
* Show the credits at the bottom of the chart
|
||||
*/
|
||||
BOTTOM("bottom");
|
||||
|
||||
private VerticalAlign(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'align' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("align", right)
|
||||
* </code></pre>
|
||||
* The Horizontal alignment for the buttons. Can be one of "left," "center," or "right." Defaults to right
|
||||
* @param align The horizontal position of the export button
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setAlign(Align align) {
|
||||
return this.setOption("align", align != null ? align.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'enabled' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("enabled", true)
|
||||
* </code></pre>
|
||||
* Whether to enable buttons. Defaults to true.
|
||||
* @param enabled 'true' to enable the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setEnabled(Boolean enabled) {
|
||||
return this.setOption("enabled", enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'height' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("height", 20)
|
||||
* </code></pre>
|
||||
* Pixel height of the buttons. Defaults to 20.
|
||||
* @param height The height in pixels of the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setHeight(Number height) {
|
||||
return this.setOption("height", height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolFill' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolFill", "#E0E0E0")
|
||||
* </code></pre>
|
||||
* Fill color for the symbol within the button. Defaults to #E0E0E0
|
||||
* @param symbolFill The color with which to fill the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolFill(String symbolFill) {
|
||||
return this.setOption("symbolFill", symbolFill);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolSize' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolSize", 14)
|
||||
* </code></pre>
|
||||
* The pixel size of the symbol on the button. Defaults to 14.
|
||||
* @param symbolSize The size in pixels of the export button symbol.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolSize(Number symbolSize) {
|
||||
return this.setOption("symbolSize", symbolSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolStroke' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolStroke", "#666")
|
||||
* </code></pre>
|
||||
* The color of the symbol's stroke or line. Defaults to #666
|
||||
* @param symbolStroke The color of the export button's lines.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolStroke(String symbolStroke) {
|
||||
return this.setOption("symbolStroke", symbolStroke);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolStrokeWidth' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolStrokeWidth", 1)
|
||||
* </code></pre>
|
||||
* The pixel stroke width of the symbol on the button. Defaults to 1.
|
||||
* @param symbolStrokeWidth The width in pixels of the lines on the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolStrokeWidth(Number symbolStrokeWidth) {
|
||||
return this.setOption("symbolStrokeWidth", symbolStrokeWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolX' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolX", 12.5)
|
||||
* </code></pre>
|
||||
* The x position of the center of the symbol inside the button. Defaults to 12.5.
|
||||
* @param symbolX The distance in pixels of the export button from the left edge of the button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolX(Number symbolX) {
|
||||
return this.setOption("symbolX", symbolX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbolY' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("symbolY", 10.5)
|
||||
* </code></pre>
|
||||
* The y position of the center of the symbol inside the button. Defaults to 10.5.
|
||||
* @param symbolY The distance in pixels of the export button symbol from the top edge of the button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setSymbolY(Number symbolY) {
|
||||
return this.setOption("symbolY", symbolY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'text' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("text", null)
|
||||
* </code></pre>
|
||||
* A text string to add to the individual button. Defaults to null
|
||||
* @param text The text to display with the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setText(String text) {
|
||||
return this.setOption("text", text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'verticalAlign' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("verticalAlign", "top")
|
||||
* </code></pre>
|
||||
* The vertical alignment of the buttons. Can be one of "top", "middle" or "bottom". Defaults to top.
|
||||
* @param verticalAlign The vertical position of the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setVerticalAlign(VerticalAlign verticalAlign) {
|
||||
return this.setOption("verticalAlign", verticalAlign != null ? verticalAlign.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'width' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("width", 24)
|
||||
* </code></pre>
|
||||
* The pixel width of the button. Defaults to 24.
|
||||
* @param width The width in pixels of the export button.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setWidth(Number width) {
|
||||
return this.setOption("width", width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'y' option for the Button module. Equivalent to:
|
||||
* <pre><code>
|
||||
* button.setOption("y", 0)
|
||||
* </code></pre>
|
||||
* The vertical offset of the button's position relative to its verticalAlign. . Defaults to 0.
|
||||
* @param y The number of pixels to offset the export button from the bottom of the chart.
|
||||
* @return A reference to this {@link Button} instance for convenient method chaining.
|
||||
*/
|
||||
public Button setY(Number y) {
|
||||
return this.setOption("y", y);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -91,6 +91,7 @@ public class Chart extends BaseChart<Chart> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Highcharts chart instance as a GWT Widget that can then be added to
|
||||
* a GWT layout like any other widget. Note that the various methods that support
|
||||
@@ -113,7 +114,7 @@ public class Chart extends BaseChart<Chart> {
|
||||
* Convenience method for setting the 'pane' options of the chart, which represents
|
||||
* a collection of options that apply only to polar charts and angular gauges.
|
||||
* <p/>
|
||||
* Note: mane of the pane options are only available if the highcharts-more.js script is included in your GWT module. E.g.:
|
||||
* Note: many of the pane options are only available if the highcharts-more.js script is included in your GWT module. E.g.:
|
||||
* </p>
|
||||
* <script type="text/javascript" src="js/highcharts-more.js"></script>
|
||||
*
|
||||
@@ -125,6 +126,8 @@ public class Chart extends BaseChart<Chart> {
|
||||
return this.setOption("/pane", pane != null ? pane.getOptions() : null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'polar' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -138,7 +141,7 @@ public class Chart extends BaseChart<Chart> {
|
||||
*
|
||||
* @param polar The value to set as the 'polar' option on the chart.
|
||||
* @return A reference to this {@link Chart} instance for convenient method chaining.
|
||||
* @since 1.5.0
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Chart setPolar(boolean polar) {
|
||||
return this.setOption("/chart/polar", polar);
|
||||
@@ -155,11 +158,14 @@ public class Chart extends BaseChart<Chart> {
|
||||
*
|
||||
* @param zoomType One of the allowed zoom types.
|
||||
* @return A reference to this {@link Chart} instance for convenient method chaining.
|
||||
* @deprecated Use {@link BaseChart#setZoomType(BaseChart.ZoomType)}
|
||||
*/
|
||||
public Chart setZoomType(Chart.ZoomType zoomType) {
|
||||
return this.setOption("/chart/zoomType", zoomType != null ? zoomType.toString() : null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String getChartTypeName() {
|
||||
return "Chart";
|
||||
|
||||
Executable
+118
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
/**
|
||||
* A configurable class that will allow you to control the export button options of the chart.
|
||||
* This configuration object holds general options for the menu items. An instance of this class can be
|
||||
* constructed and then set on the pane via the {@link Pane#setBackground(PaneBackground...)} method.
|
||||
* <p/>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setExporting(
|
||||
* new Exporting()
|
||||
* .setContextButton(
|
||||
* newContextButton(
|
||||
* .setAlign("center")
|
||||
* .setX(0)
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*
|
||||
*/
|
||||
public class ContextButton extends Button<ContextButton> {
|
||||
|
||||
/**
|
||||
* An enumeration of supported marker symbol types, which can be passed to methods
|
||||
* like {@link ContextButton#setSymbol(ContextButton.Symbol)} method.
|
||||
* <p/>Note that custom marker images are also supported by simply setting the
|
||||
* "symbol" option to a URL reference. E.g.
|
||||
* <pre><code>
|
||||
* marker.setOption("symbol", "url(/serverpath/image.png)");
|
||||
* </code></pre>
|
||||
*/
|
||||
public enum Symbol {
|
||||
|
||||
/**
|
||||
* Represent the marker with a circular shape
|
||||
*/
|
||||
CIRCLE("circle"),
|
||||
|
||||
/**
|
||||
* Represent the marker with a square shape
|
||||
*/
|
||||
SQUARE("square"),
|
||||
|
||||
/**
|
||||
* Represent the marker with a diamond shape
|
||||
*/
|
||||
DIAMOND("diamond"),
|
||||
|
||||
/**
|
||||
* Represent the marker with a triangular shape
|
||||
*/
|
||||
TRIANGLE("triangle"),
|
||||
|
||||
/**
|
||||
* Represent the marker with an upside down triangular shape
|
||||
*/
|
||||
TRIANGLE_DOWN("triangle-down");
|
||||
|
||||
private Symbol(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Implement setMenuItems()
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "symbol" option for the export button. Equivalent to:
|
||||
* <pre><code>
|
||||
* contextButton.setOption("symbol", "menu");
|
||||
* </code></pre>
|
||||
* The symbol for the button. Points to a definition function in the Highcharts.Renderer.symbols collection.
|
||||
* The default exportIcon function is part of the exporting module. Defaults to menu.
|
||||
* @param symbol The shape to be used for the context button.
|
||||
* @return A reference to this {@link ContextButton} instance for convenient method chaining.
|
||||
*/
|
||||
public ContextButton setSymbol(Symbol symbol) {
|
||||
return this.setOption("symbol", symbol != null ? symbol.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "symbolX" option for the export button. Equivalent to:
|
||||
* <pre><code>
|
||||
* contextButton.setOption("symbolX", 12.5)
|
||||
* </code></pre>
|
||||
* The x position of the center of the symbol inside the button. Defaults to 12.5.
|
||||
* @param x The distance n pixels from the left edge of the export button
|
||||
* @return A reference to this {@link ContextButton} instance for convenient method chaining.
|
||||
*/
|
||||
public ContextButton setX(Number x) {
|
||||
return this.setOption("x", x);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,6 +100,7 @@ public class Credits extends Configurable<Credits> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'align' option of the credits. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -178,6 +179,7 @@ public class Credits extends Configurable<Credits> {
|
||||
return this.setOption("text", text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'verticalAlign' option of the credits. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -189,6 +191,7 @@ public class Credits extends Configurable<Credits> {
|
||||
*
|
||||
* @param verticalAlign The vertical alignment of the credits.
|
||||
* @return A reference to this {@link Credits} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Credits setVerticalAlign(VerticalAlign verticalAlign) {
|
||||
return this.setOption("/position/verticalAlign", verticalAlign != null ? verticalAlign.toString() : null);
|
||||
|
||||
+230
-4
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
|
||||
/**
|
||||
* Represents the configuration options available for controlling the way date and time information
|
||||
* will be displayed. For a datetime axis, the scale will automatically adjust to the appropriate unit. This configuration
|
||||
@@ -67,7 +70,7 @@ package org.moxieapps.gwt.highcharts.client;
|
||||
* </pre></code>
|
||||
*
|
||||
* @author squinn@moxiegroup.com (Shawn Quinn)
|
||||
* @since 1.0.0
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
|
||||
@@ -81,9 +84,37 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public DateTimeLabelFormats setMillisecond(String millisecond){
|
||||
return this.setOption("millisecond", millisecond);
|
||||
}
|
||||
public DateTimeLabelFormats setMillisecond(String millisecond) {
|
||||
return this.setOption("millisecond", millisecond);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'millisecond' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setMillisecond(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray millisecondArray = new JSONArray();
|
||||
|
||||
millisecondArray.set(0, new JSONString(singleUnit));
|
||||
millisecondArray.set(1, new JSONString(startDate));
|
||||
millisecondArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("millisecond", millisecondArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'second' format. Equivalent to:
|
||||
@@ -98,6 +129,34 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("second", second);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'second' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setSecond(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray secondArray = new JSONArray();
|
||||
|
||||
secondArray.set(0, new JSONString(singleUnit));
|
||||
secondArray.set(1, new JSONString(startDate));
|
||||
secondArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("second", secondArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'minute' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -111,6 +170,34 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("minute", minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'minute' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setMinute(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray minuteArray = new JSONArray();
|
||||
|
||||
minuteArray.set(0, new JSONString(singleUnit));
|
||||
minuteArray.set(1, new JSONString(startDate));
|
||||
minuteArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("minute", minuteArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'hour' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -124,6 +211,34 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("hour", hour);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'hour' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setHour(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray hourArray = new JSONArray();
|
||||
|
||||
hourArray.set(0, new JSONString(singleUnit));
|
||||
hourArray.set(1, new JSONString(startDate));
|
||||
hourArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("hour", hourArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'day' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -137,6 +252,34 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("day", day);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'day' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setDay(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray dayArray = new JSONArray();
|
||||
|
||||
dayArray.set(0, new JSONString(singleUnit));
|
||||
dayArray.set(1, new JSONString(startDate));
|
||||
dayArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("day", dayArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'week' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -150,6 +293,33 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("week", week);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'week' format. ENote that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setWeek(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray weekArray = new JSONArray();
|
||||
|
||||
weekArray.set(0, new JSONString(singleUnit));
|
||||
weekArray.set(1, new JSONString(startDate));
|
||||
weekArray.set(2, new JSONString(endDate));
|
||||
return this.setOption("week", weekArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'month' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -163,6 +333,34 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("month", month);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'month' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setMonth(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray monthArray = new JSONArray();
|
||||
|
||||
monthArray.set(0, new JSONString(singleUnit));
|
||||
monthArray.set(1, new JSONString(startDate));
|
||||
monthArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("month", monthArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'year' format. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -176,4 +374,32 @@ public class DateTimeLabelFormats extends Configurable<DateTimeLabelFormats> {
|
||||
return this.setOption("year", year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'year' format. Note that this option is intended for
|
||||
* use with stock charts that require custom date formats for each data grouping. See the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setDateTimeLabelFormats(DateTimeLabelFormats)}
|
||||
* method for more detail.<br/>
|
||||
* <br/>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used.
|
||||
* The second and third items are used when the active time span is more than two units. For instance,
|
||||
* if the current data applies to two weeks, the second and third item of the week array are used, and
|
||||
* applied to the start and end date of the time span.
|
||||
*
|
||||
* @param singleUnit The format to use when the active time span is one unit.
|
||||
* @param startDate The format to use for the start date when the active time span is more than one unit.
|
||||
* @param endDate The format to use for the end date when the active time span is more than one unit.
|
||||
* @return A reference to this {@link DateTimeLabelFormats} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public DateTimeLabelFormats setYear(String singleUnit, String startDate, String endDate) {
|
||||
final JSONArray yearArray = new JSONArray();
|
||||
|
||||
yearArray.set(0, new JSONString(singleUnit));
|
||||
yearArray.set(1, new JSONString(startDate));
|
||||
yearArray.set(2, new JSONString(endDate));
|
||||
|
||||
return this.setOption("year", yearArray);
|
||||
}
|
||||
|
||||
}
|
||||
+62
-2
@@ -53,7 +53,18 @@ public class Exporting extends Configurable<Exporting> {
|
||||
|
||||
}
|
||||
|
||||
// TODO: Add buttons configuration methods
|
||||
/**
|
||||
* Convenience method for directly setting the options for the context button. Equivalent to:
|
||||
* <pre><code>
|
||||
* exporting.setOption("/buttons/contextButton/align", "right");
|
||||
* </code></pre>
|
||||
* @param contextButton An instance of the ContextButton class
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Exporting setContextButton(ContextButton contextButton) {
|
||||
return this.setOption("/buttons/contextButton", contextButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'enabled' option for the exporting module. Equivalent to:
|
||||
@@ -74,7 +85,7 @@ public class Exporting extends Configurable<Exporting> {
|
||||
/**
|
||||
* Convenience method for setting the 'filename' option for the exporting module. Equivalent to:
|
||||
* <pre><code>
|
||||
* exporting.setOption("filename", true);
|
||||
* exporting.setOption("filename", "chart");
|
||||
* </code></pre>
|
||||
* The filename, without extension, to use for the exported chart. Defaults to "chart".
|
||||
*
|
||||
@@ -85,6 +96,52 @@ public class Exporting extends Configurable<Exporting> {
|
||||
return this.setOption("fileName", fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'scale' option for exporting module. Equivalent to:
|
||||
* <pre><code>
|
||||
* exporting.setOption("scale", 2)
|
||||
* </pre></code>
|
||||
* Defines the scale or zoom factor for the exported image compared to the on-screen display.
|
||||
* While for instance a 600px wide chart may look good on a website, it will look bad in print.
|
||||
* The default scale of 2 makes this chart export to a 1200px PNG or JPG. Defaults to 2.
|
||||
* @param scale The scale to use for the exported chart.
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Exporting setScale(Number scale) {
|
||||
return this.setOption("scale", scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'sourceHeight' option for the exporting module. Equivalent to:
|
||||
* <pre><code>
|
||||
* exporting.setOption("sourceHeight", 400);
|
||||
* </code></pre>
|
||||
* The height of the original chart when exported, unless an explicit chart.height is set.
|
||||
* The height exported raster image is then multiplied by scale.
|
||||
* @param sourceHeight The height of the original chart to be used for exporting.
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Exporting setSourceHeight(Number sourceHeight) {
|
||||
return this.setOption("height", sourceHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'sourceWidth' option for the exporting module. Equivalent to:
|
||||
* <pre><code>
|
||||
* exporting.setOption("sourceWidth", 600);
|
||||
* </code></pre>
|
||||
* The width of the original chart when exported, unless an explicit chart.width is set.
|
||||
* The width exported raster image is then multiplied by scale.
|
||||
* @param sourceWidth The width of the original chart to be used for exporting.
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Exporting setSourceWidth(Number sourceWidth) {
|
||||
return this.setOption("sourceWidth", sourceWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'type' option for the exporting module. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -96,6 +153,7 @@ public class Exporting extends Configurable<Exporting> {
|
||||
* @param type The default file format that exported charts should be created as.
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
*/
|
||||
|
||||
public Exporting setType(Type type) {
|
||||
return this.setOption("type", type != null ? type.toString() : null);
|
||||
}
|
||||
@@ -121,6 +179,8 @@ public class Exporting extends Configurable<Exporting> {
|
||||
* exporting.setOption("width", 600);
|
||||
* </code></pre>
|
||||
* The pixel width of charts exported to PNG or JPG. Defaults to 800.
|
||||
* As of Highcharts 3.0, the default pixel width is a function of the chart.width or exporting.sourceWidth
|
||||
* and the exporting.scale. Defaults to undefined.
|
||||
*
|
||||
* @param width The pixel width of charts exported to PNG or JPG.
|
||||
* @return A reference to this {@link Exporting} instance for convenient method chaining.
|
||||
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
+230
-11
@@ -130,6 +130,7 @@ public class Legend extends Configurable<Legend> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'align' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -270,21 +271,47 @@ public class Legend extends Configurable<Legend> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'itemStyle' options of the legend. Equivalent to:
|
||||
* Convenience method for setting the 'itemMarginBottom' options of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/itemStyle/fontWeight", "bold");
|
||||
* legend.setOption("/itemStyle/fontFamily", "serif");
|
||||
* etc.
|
||||
* legend.setOption("itemMarginBottom", 0);
|
||||
* </code></pre>
|
||||
* CSS styles for each legend item. Defaults to:
|
||||
* <ul>
|
||||
* <li>cursor: 'pointer'</li>
|
||||
* <li>color: '#3E576F'</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param itemStyle CSS styles for each legend item.
|
||||
* The pixel bottom margin for each legend item. Defaults to 0.
|
||||
* @param itemMarginBottom The distance in pixels from the last legend item to the bottom border of the legend.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setItemMarginBottom(Number itemMarginBottom) {
|
||||
return this.setOption("itemMarginBottom", itemMarginBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'itemMarginTop' options of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("itemMarginTop", 0);
|
||||
* </code></pre>
|
||||
* The pixel top margin for each legend item. Defaults to 0.
|
||||
* @param itemMarginTop The distance in pixels from the top border of the legend to the first legend item.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setItemMarginTop(Number itemMarginTop) {
|
||||
return this.setOption("itemMarginTop", itemMarginTop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'itemStyle' options of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/itemStyle/fontWeight", "bold");
|
||||
* legend.setOption("/itemStyle/fontFamily", "serif");
|
||||
* etc.
|
||||
* </code></pre>
|
||||
* CSS styles for each legend item. Defaults to:
|
||||
* <ul>
|
||||
* <li>cursor: 'pointer'</li>
|
||||
* <li>color: '#3E576F'</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param itemStyle CSS styles for each legend item.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setItemStyle(Style itemStyle) {
|
||||
return this.setOption("itemStyle", itemStyle != null ? itemStyle.getOptions() : null);
|
||||
}
|
||||
@@ -364,6 +391,137 @@ public class Legend extends Configurable<Legend> {
|
||||
return this.setOption("margin", margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'reversed' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("maxHeight", 60);
|
||||
* </code></pre>
|
||||
* Maximum pixel height for the legend. When the maximum height is extended, navigation will show.
|
||||
* @param maxHeight The Maximum height of the Legend
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setMaxHeight(Number maxHeight) {
|
||||
return this.setOption("maxHeight", maxHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "activeColor" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/activeColor", #3E576F);
|
||||
* </code></pre>
|
||||
* The color for the active up or down arrow in the legend page navigation. Defaults to #3E576F
|
||||
* @param activeColor
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationActiveColor(Color activeColor) {
|
||||
return this.setOption("/navigation/activeColor", activeColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "activeColor" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/activeColor", );
|
||||
* </code></pre>
|
||||
* The color for the active up or down arrow in the legend page navigation. Defaults to #3E576F
|
||||
* @param color
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationActiveColor(Number color) {
|
||||
return this.setOption("/navigation/activeColor", color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "animation" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption(("/navigation/animation", true);
|
||||
* </code></pre>
|
||||
* How to animate the pages when navigating up or down. A value of true applies the default navigation given in the chart.
|
||||
* animation option. Additional options can be given as an object containing values for easing and duration. Defaults to true.
|
||||
* @param animation
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationAnimation(boolean animation) {
|
||||
return this.setOption("/navigation/animation", animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "animation" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/animation", );
|
||||
* </code></pre>
|
||||
* How to animate the pages when navigating up or down. A value of true applies the default navigation given in the chart.
|
||||
* animation option. Additional options can be given as an object containing values for easing and duration. Defaults to true.
|
||||
* @param animation
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationAnimation(Animation animation) {
|
||||
return this.setOption("/navigation/animation", animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "arrowSize" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/arrowSize", 12);
|
||||
* </code></pre>
|
||||
* The pixel size of the up and down arrows in the legend paging navigation. . Defaults to 12.
|
||||
* @param arrowSize
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationArrowSize(Number arrowSize) {
|
||||
return this.setOption("/navigation/arrowSize", arrowSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "inactiveColor" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/inactiveColor", #CCC);
|
||||
* </code></pre>
|
||||
* The color of the inactive up or down arrow in the legend page navigation. . Defaults to #CCC.
|
||||
* @param inactiveColor
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationInactiveColor(Color inactiveColor) {
|
||||
return this.setOption("/navigation/inactiveColor", inactiveColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "inactiveColor" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/inactiveColor", );
|
||||
* </code></pre>
|
||||
* The color of the inactive up or down arrow in the legend page navigation. . Defaults to #CCC.
|
||||
* @param inactiveColor
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationInactiveColor(Number inactiveColor) {
|
||||
return this.setOption("/navigation/inactiveColor", inactiveColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "style" option for the legend navigation. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/navigation/style", null);
|
||||
* </code></pre>
|
||||
* Text styles for the legend page navigation.
|
||||
* @param style
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setNavigationStyle(Style style) {
|
||||
return this.setOption("/navigation/style", style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'reversed' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("padding", 8);
|
||||
* </code></pre>
|
||||
* The inner padding of the legend box. Defaults to 8.
|
||||
* @param padding the distance in pixels of legend items to the legend border.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setPadding(Number padding) {
|
||||
return this.setOption("padding", padding);
|
||||
}
|
||||
/**
|
||||
* Convenience method for setting the 'reversed' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -379,6 +537,19 @@ public class Legend extends Configurable<Legend> {
|
||||
return this.setOption("reversed", reversed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'reversed' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("rtl", true);
|
||||
* </code></pre>
|
||||
* Whether to show the symbol on the right side of the text rather than the left side. This is common in Arabic and Hebraic. Defaults to false
|
||||
* @param rtl 'true' to show the symbol to the right of the text of the legend item.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setRtl(boolean rtl) {
|
||||
return this.setOption("rtl", rtl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'shadow' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -442,6 +613,54 @@ public class Legend extends Configurable<Legend> {
|
||||
return this.setOption("symbolWidth", symbolWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "style" option for the legend title. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/title/style", "fontWeight: 'bold'");
|
||||
* </code></pre>
|
||||
* Generic CSS styles for the legend title. Defaults to:
|
||||
* <pre><code>
|
||||
* style: {
|
||||
* fontWeight: 'bold'
|
||||
* }
|
||||
* </code></pre>
|
||||
* @param style
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setTitleStyle(Style style) {
|
||||
return this.setOption("/title/style", style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "text" option for the legend title. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("/title/text", null);
|
||||
* </code></pre>
|
||||
* A text or HTML string for the title. Defaults to null.
|
||||
* @param text
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setTitleText(String text) {
|
||||
return this.setOption("/title/text", text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'useHTML' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
* legend.setOption("useHTML", false);
|
||||
* </code></pre>
|
||||
* Whether to use HTML to render the legend item texts.
|
||||
* Using HTML allows for advanced formatting, images and reliable bi-directional text rendering.
|
||||
* Note that exported images won't respect the HTML, and that HTML won't respect Z-index settings.
|
||||
* When using HTML, legend.navigation is disabled.
|
||||
* @param useHTML 'true' to use HTML to render Legend texts.
|
||||
* @return A reference to this {@link Legend} instance for convenient method chaining.
|
||||
*/
|
||||
public Legend setUseHTML(boolean useHTML) {
|
||||
return this.setOption("useHTML", useHTML);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'verticalAlign' option of the legend. Equivalent to:
|
||||
* <pre><code>
|
||||
|
||||
+19
-2
@@ -81,6 +81,23 @@ public class Navigation extends Configurable<Navigation> {
|
||||
return this.setOption("menuItemHoverStyle", menuItemHoverStyle != null ? menuItemHoverStyle.getOptions() : null);
|
||||
}
|
||||
|
||||
// TODO: Add buttonOptions configuration methods
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonOptions" for the export button. Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setNavigation(
|
||||
* new Navigation()
|
||||
* .setButtonOptions(
|
||||
* new Button()
|
||||
* .setAlign(Button.Align.RIGHT)
|
||||
* .setSymbolFill("#E0E0E0")
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param button The export button with options set using methods in {@link Button}.
|
||||
* @return A reference to this {@link Navigation} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Navigation setButtonOptions(Button button) {
|
||||
return this.setOption("/buttonOptions", button);
|
||||
}
|
||||
}
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+65
-3
@@ -1,5 +1,9 @@
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
|
||||
/**
|
||||
* A configurable class that will allow you to control the pane options of the charts, which
|
||||
* applies only to polar charts and angular gauges. This configuration object holds general
|
||||
@@ -7,7 +11,7 @@ package org.moxieapps.gwt.highcharts.client;
|
||||
* An instance of this class can be constructed and then
|
||||
* set on the chart via the {@link org.moxieapps.gwt.highcharts.client.Chart#setPane(Pane)} method.
|
||||
* <p/>
|
||||
* Note: mane of the pane options are only available if the highcharts-more.js script is included in your GWT module. E.g.:
|
||||
* Note: many of the pane options are only available if the highcharts-more.js script is included in your GWT module. E.g.:
|
||||
* </p>
|
||||
* <script type="text/javascript" src="js/highcharts-more.js"></script>
|
||||
*
|
||||
@@ -15,6 +19,66 @@ package org.moxieapps.gwt.highcharts.client;
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class Pane extends Configurable<Pane> {
|
||||
/**
|
||||
* Convenience method for setting the "background" option of the pane. Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setPane(
|
||||
* newPane()
|
||||
* .setBackground(
|
||||
* new PaneBackground()
|
||||
* .setBackgroundColor(#333)
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param paneBackgrounds An Instance of the PaneBackground class that has been set using its supplied methods.
|
||||
* @return A reference to this {@link Pane} instance for convenient method chaining.
|
||||
*/
|
||||
public Pane setBackground(PaneBackground... paneBackgrounds) {
|
||||
return this.setOption("background", paneBackgrounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "center" option of the pane. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("center", [50, 50]);
|
||||
* </code></pre>
|
||||
* The center of a polar chart or angular gauge, given as an array of [x, y] positions.
|
||||
* Positions is given as integers that transform to pixels. Defaults to ['50%', '50%'].
|
||||
* Note: This method is for denoting the center of the pane as a pair of (x, y) coordinates.
|
||||
* If you instead want to represent the center as a percentage of the plot area size,
|
||||
* use this {@link #setCenter(String, String)}.
|
||||
* @param centerX The x value of the center of the pane in pixels.
|
||||
* @param centerY The y value of the center of the pane in pixels.
|
||||
* @return A reference to this {@link Pane} instance for convenient method chaining.
|
||||
*/
|
||||
public Pane setCenter(Number centerX, Number centerY) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONNumber(centerX.doubleValue()));
|
||||
center.set(1, new JSONNumber(centerY.doubleValue()));
|
||||
return this.setOption("center", center);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "center" option of the pane. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("center", ['50%', '50%']);
|
||||
* </code></pre>
|
||||
* The center of a polar chart or angular gauge, given as an array of [x, y] positions.
|
||||
* Positions are given as percentages of the plot area size. Defaults to ['50%', '50%'].
|
||||
* Note: this method is for denoting the location of the center as a string. If you instead
|
||||
* want to represent the center as a pair of (x, y) coordinates, use this {@link #setCenter(Number, Number)}.
|
||||
* @param centerX The x coordinate of the center of the pane a percentage of the plot size area.
|
||||
* @param centerY The x coordinate of the center of the pane a percentage of the plot size area.
|
||||
* @return A reference to this {@link Pane} instance for convenient method chaining.
|
||||
*/
|
||||
public Pane setCenter(String centerX, String centerY) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONString(centerX));
|
||||
center.set(1, new JSONString(centerY));
|
||||
return this.setOption("center", center);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'startAngle' option of the pane. Equivalent to:
|
||||
@@ -44,6 +108,4 @@ public class Pane extends Configurable<Pane> {
|
||||
return this.setOption("endAngle", endAngle);
|
||||
}
|
||||
|
||||
// TODO: Add 'background' and 'center' configuration methods
|
||||
|
||||
}
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
/**
|
||||
* A configurable class that will allow you to control the pane background options of the charts, which
|
||||
* applies only to polar charts and angular gauges. This configuration object holds general
|
||||
* options for the color, width and border of the pane's background. An instance of this class can be
|
||||
* constructed and then set on the pane via the {@link Pane#setBackground(PaneBackground...)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class PaneBackground extends Configurable<PaneBackground> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'borderColor' option of the pane's border to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("pane/background/borderColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The RGB background color for the border of the pane. Defaults to "#FFFFFF".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setBorderColor(Color)}
|
||||
* version instead
|
||||
* @param borderColor The value to set as the 'borderColor' option on the pane.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setBorderColor(String borderColor) {
|
||||
return this.setOption("borderColor", borderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'borderColor' option of the pane's border, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/pane/borderColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The background color or gradient for the outer chart area. Defaults to "#FFFFFF".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setBorderColor(String)} version instead.
|
||||
* @param borderColor The color gradient or color with an alpha channel to set as the 'backgroundBorderColor' option on the pane
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setBorderColor(Color borderColor) {
|
||||
return this.setOption("borderColor", borderColor != null ? borderColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'borderWidth' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/borderWidth", 10);
|
||||
* </code></pre>
|
||||
*
|
||||
* @param borderWidth Thickness of the background's border in pixels.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining.
|
||||
*/
|
||||
public PaneBackground setBorderWidth(Number borderWidth) {
|
||||
return this.setOption("borderWidth", borderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'borderWidth' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/borderWidth", '10%');
|
||||
* </code></pre>
|
||||
*
|
||||
* @param borderWidth Thickness of the background's border as a percentage of the background.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining.
|
||||
*/
|
||||
public PaneBackground setBorderWidth(String borderWidth) {
|
||||
return this.setOption("borderWidth", borderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'backgroundColor' option of the pane's background to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("pane/background/backgroundColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The RGB background color for the outer chart area. Defaults to "#FFFFFF".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setBackgroundColor(Color)}
|
||||
* version instead
|
||||
* @param backgroundColor The value to set as the 'backgroundColor' option on the pane.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setBackgroundColor(String backgroundColor) {
|
||||
return this.setOption("backgroundColor", backgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'backgroundColor' option of the pane's background, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("/pane//backgroundColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The background color or gradient for the outer chart area. Defaults to "#FFFFFF".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setBackgroundColor(String)} version instead.
|
||||
* @param backgroundColor The color gradient or color with an alpha channel to set as the 'backgroundColor' option on the pane
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setBackgroundColor(Color backgroundColor) {
|
||||
return this.setOption("backgroundColor", backgroundColor != null ? backgroundColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerRadius' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/innerRadius", '100%');
|
||||
* </code></pre>
|
||||
*
|
||||
* Note: The official Highcharts API reference refers to this as "innerRadius," however it is implemented as "innerRadius."
|
||||
* @param innerRadius The distance as a percentage of the size of the chart from its center to the inner edge of the background.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setInnerRadius(String innerRadius) {
|
||||
return this.setOption("innerRadius", innerRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerRadius' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/innerRadius", 100);
|
||||
* </code></pre>
|
||||
*
|
||||
* Note: The official Highcharts API reference refers to this as "innerRadius," however it is implemented as "innerRadius."
|
||||
* @param innerRadius The distance in pixels from the center of the chart to the outer edge of the background.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining
|
||||
*/
|
||||
public PaneBackground setInnerRadius(Number innerRadius) {
|
||||
return this.setOption("backgroundInnerWidth", innerRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'outerRadius' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/outerRadius", '100%');
|
||||
* </code></pre>
|
||||
*
|
||||
* Note: The official Highcharts API reference refers to this as "outerWidth," however it is implemented as "outerRadius."
|
||||
* @param outerRadius The distance as a percentage of the size of the chart from its center to the outer edge of the background.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining.
|
||||
*/
|
||||
public PaneBackground setOuterRadius(String outerRadius) {
|
||||
return this.setOption("outerRadius", outerRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'outerRadius' option of the pane's background. Equivalent to:
|
||||
* <pre><code>
|
||||
* pane.setOption("pane/background/outerRadius", 100);
|
||||
* </code></pre>
|
||||
*
|
||||
* Note: The official Highcharts API reference refers to this as "outerWidth," however it is implemented as "outerRadius."
|
||||
* @param outerRadius The distance in pixels from the center of the chart to the inner edge of the background.
|
||||
* @return A reference to this {@link PaneBackground} instance for convenient method chaining.
|
||||
*/
|
||||
public PaneBackground setOuterRadius(Number outerRadius) {
|
||||
return this.setOption("outerRadius", outerRadius);
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+129
@@ -69,6 +69,12 @@ public class Point extends Configurable<Point> {
|
||||
* Highcharts API, but exposing this enum could be reconsidered if a use case was identified.)
|
||||
*/
|
||||
static enum Type {
|
||||
|
||||
/**
|
||||
* Indicates that the point is a Flag
|
||||
*/
|
||||
FLAG,
|
||||
|
||||
/**
|
||||
* Indicates the point contains only a Y value
|
||||
*/
|
||||
@@ -172,6 +178,32 @@ public class Point extends Configurable<Point> {
|
||||
this.type = Type.Y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new point with only a 'name' field. Only used in waterfall charts when the value is computed by
|
||||
* {@link #setIsIntermediateSum(boolean)} or (@link #setIsSum(boolean)}
|
||||
* @param name The name of the point
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Point(String name) {
|
||||
setName(name);
|
||||
this.type = Type.Y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new point of type "flag" at a given value with a title and text. Intended to be
|
||||
* added to series whose type has been set to {@link Series.Type#FLAGS};
|
||||
*
|
||||
* @param x Point where the flag appears
|
||||
* @param title Title of flag displayed on the chart
|
||||
* @param text Text displayed when the flag are highlighted.
|
||||
*/
|
||||
public Point(Number x, String title, String text) {
|
||||
this.x = x;
|
||||
setTitle(title);
|
||||
setText(text);
|
||||
this.type = Type.FLAG;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
|
||||
private JavaScriptObject nativePoint;
|
||||
|
||||
@@ -295,6 +327,36 @@ public class Point extends Configurable<Point> {
|
||||
return this.setOption("color", color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'isIntermediateSum' option for a point. Equivalent to:
|
||||
* <pre><code>
|
||||
* point.setOption("setIntermediateSum", true)
|
||||
* </code></pre>
|
||||
* Used in Waterfall Charts. When this option is set to true, the point will be assigned a value that is calculated
|
||||
* by summing all points since the last 'intermediate sum' Defaults to false.
|
||||
* @param isIntermediateSum Whether the point is an intermediate sum.
|
||||
* @return A reference to this {@link Point} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Point setIsIntermediateSum(boolean isIntermediateSum) {
|
||||
return this.setOption("isIntermediateSum", isIntermediateSum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience mwthod for setting the 'isSum' option for the point. Equivalent to:
|
||||
* <pre><code>
|
||||
* point.setOption("isSum", true);
|
||||
* </code></pre>
|
||||
* Used in Waterfall charts. When this option is set to true, the point will ba assigned a value that is
|
||||
* calculated by summing all of the points. Defaults to false.
|
||||
* @param isSum Whether the point is the sum of all points
|
||||
* @return A reference to this {@link Point} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Point setIsSum(boolean isSum) {
|
||||
return this.setOption("isSum", isSum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the individual point marker for the point. Defaults to null. E.g.
|
||||
* <pre><code>
|
||||
@@ -640,6 +702,73 @@ public class Point extends Configurable<Point> {
|
||||
return this;
|
||||
}
|
||||
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'text' option of the point. Equivalent to:
|
||||
* <pre><code>
|
||||
* point.setOption("text", "Green Bears");
|
||||
* </code></pre>
|
||||
* The text of the point as shown in the tooltip, defaults to "".
|
||||
*
|
||||
* @param text The value to set as the point's text.
|
||||
* @return A reference to this {@link Point} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Point setText(String text) {
|
||||
this.text = text;
|
||||
return this.setOption("text", text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text property that was set on this point, or null if no text was set.
|
||||
*
|
||||
* @return The 'text' property that was set on this point (likely via {@link #setText(String)},
|
||||
* or null if no text was set.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public String getText() {
|
||||
if (this.nativePoint != null) {
|
||||
return nativeGetString(this.nativePoint, "text");
|
||||
} else {
|
||||
return this.text;
|
||||
}
|
||||
}
|
||||
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'title' option of the point. Equivalent to:
|
||||
* <pre><code>
|
||||
* point.setOption("title", "Green Bears");
|
||||
* </code></pre>
|
||||
* The title of the point as shown in the tooltip. Defaults to "".
|
||||
*
|
||||
* @param title The value to set as the point's title.
|
||||
* @return A reference to this {@link Point} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Point setTitle(String title) {
|
||||
this.title = title;
|
||||
return this.setOption("title", title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title property that was set on this point, or null if no name was set.
|
||||
*
|
||||
* @return The 'name' property that was set on this point (likely via {@link #setTitle(String)},
|
||||
* or null if no title was set.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public String getTitle() {
|
||||
if (this.nativePoint != null) {
|
||||
return nativeGetString(this.nativePoint, "title");
|
||||
} else {
|
||||
return this.title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the point with the new values, automatically redrawing
|
||||
* the chart with the default animation options.
|
||||
|
||||
+170
-1
@@ -45,7 +45,73 @@ package org.moxieapps.gwt.highcharts.client;
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class RangeSelector extends Configurable<RangeSelector> {
|
||||
|
||||
|
||||
/**
|
||||
* An enumeration of supported range selector horizontal alignment types, which can be passed to methods
|
||||
* like {@link RangeSelector#setInputPositionAlign(org.moxieapps.gwt.highcharts.client.RangeSelector.Align)} method.
|
||||
*/
|
||||
public enum Align {
|
||||
|
||||
/**
|
||||
* Left align the range selector input box
|
||||
*/
|
||||
LEFT("left"),
|
||||
|
||||
/**
|
||||
* Center the range selector input box
|
||||
*/
|
||||
CENTER("center"),
|
||||
|
||||
/**
|
||||
* Right align the range selector input box
|
||||
*/
|
||||
RIGHT("right");
|
||||
|
||||
private Align(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of supported range selector vertical alignment types, which can be passed to methods
|
||||
* like {@link Credits#setVerticalAlign(Credits.VerticalAlign)} method.
|
||||
*/
|
||||
public enum VerticalAlign {
|
||||
|
||||
/**
|
||||
* Show the range selector input box at the top of the chart
|
||||
*/
|
||||
TOP("top"),
|
||||
|
||||
/**
|
||||
* Show the range selector input box in the middle of the chart
|
||||
*/
|
||||
MIDDLE("middle"),
|
||||
|
||||
/**
|
||||
* Show the range selector input box at the bottom of the chart
|
||||
*/
|
||||
BOTTOM("bottom");
|
||||
|
||||
private VerticalAlign(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of supported range selector button types, which can be used with the {@link RangeSelector.Button#setType(RangeSelector.ButtonType)} method.
|
||||
*/
|
||||
@@ -170,6 +236,109 @@ public class RangeSelector extends Configurable<RangeSelector> {
|
||||
return this.setOption("inputEnabled", inputEnabled);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:
|
||||
* <pre><code>
|
||||
* stockChart.setOption("/inputPosition/VerticalAlign", center);
|
||||
* </code></pre>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* stockChart.setRangeSelector(
|
||||
* new RangeSelector()
|
||||
* .setInputPositionAlign(Align.LEFT)
|
||||
* );
|
||||
* </code></pre>
|
||||
* Can be one of either 'left, 'center', or right'
|
||||
* @param align The horizontal alignment for the input box.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setInputPositionAlign(Align align) {
|
||||
return this.setOption("/inputPosition/VerticalAlign", align != null ? align.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:
|
||||
* <pre><code>
|
||||
* stockChart.setOption("/inputPosition/verticalAlign", top);
|
||||
* </code></pre>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* stockChart.setRangeSelector(
|
||||
* new RangeSelector()
|
||||
* .setInputPositionAlign(VerticalAlign.TOP)
|
||||
* );
|
||||
* </code></pre>
|
||||
* Can be one of either 'top, 'middle', or 'bottom'
|
||||
* @param verticalAlign The vertical position for the input box.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setInputPositionVerticalAlign(VerticalAlign verticalAlign) {
|
||||
return this.setOption("/inputPosition/verticalAlign", verticalAlign != null ? verticalAlign.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:
|
||||
* <pre><code>
|
||||
* stockChart.setOption("/inputPosition/x", 15);
|
||||
* </code></pre>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* stockChart.setRangeSelector(
|
||||
* new RangeSelector()
|
||||
* .setInputPositionX(15)
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param x the x offset for the input box.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setInputPositionX(Number x) {
|
||||
return this.setOption("/inputPosition/x", x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:
|
||||
* <pre><code>
|
||||
* stockChart.setOption("/inputPosition/y", 10);
|
||||
* </code></pre>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* stockChart.setRangeSelector(
|
||||
* new RangeSelector()
|
||||
* .setInputPositionY(10)
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param y The y offset for the input box.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setInputPositionY(Number y) {
|
||||
return this.setOption("/inputPosition/y", y);
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS for the HTML inputs in the range selector.
|
||||
* @param inputStyle The CSS style object containing the style for the range selector inputs.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setInputStyle(Style inputStyle) {
|
||||
return this.setOption("inputStyle", inputStyle != null ? inputStyle.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS styles for the labels - the Zoom, From and To texts.
|
||||
* @param labelStyle The CSS style object containing the style for the range selector label.
|
||||
* @return A reference to this {@link RangeSelector} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public RangeSelector setLabelStyle(Style labelStyle) {
|
||||
return this.setOption("labelStyle", labelStyle != null ? labelStyle.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the index of the button to appear pre-selected. Defaults to <code>null</code>.
|
||||
* @param selected the index of the button to appear pre-selected.
|
||||
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
/**
|
||||
* A configurable class that will allow you to control the reset zoom button options of the chart.
|
||||
* This configuration object holds general options for the position and theme of the button. An instance of this class can be
|
||||
* constructed and then set on the pane via the {@link Chart#setResetZoomButton(ResetZoomButton)} method.
|
||||
* <p/>
|
||||
* Note: The setTheme method is not yet implemented, however, the options can still be set using {@link Chart#setOption(String, Object)}
|
||||
* Although undocumented in Highcharts API, the reset zoom button also appears to accept options similar to the export button, such as 'align.'
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setResetZoomButton(
|
||||
* new ResetZoomButton()
|
||||
* .setRelativeTo("plot")
|
||||
* .setOption("align", "right")
|
||||
* .setOption("/theme/fill", "white")
|
||||
* .setOption("/theme/states/hover/style/color", "white")
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*
|
||||
*/
|
||||
public class ResetZoomButton extends Configurable<ResetZoomButton> {
|
||||
|
||||
/**
|
||||
* An enumeration of the supported frames that the reset zoom button's position can be relative to.
|
||||
* {@link #setRelativeTo(RelativeTo)}
|
||||
*/
|
||||
public enum RelativeTo {
|
||||
|
||||
/**
|
||||
* Relative to the plot.
|
||||
*/
|
||||
PLOT("plot"),
|
||||
|
||||
/**
|
||||
* Relative to the chart.
|
||||
*/
|
||||
CHART("chart");
|
||||
|
||||
private RelativeTo(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'x' position of the reset zoom button. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("resetZoomButton/position/x", -10);
|
||||
* </code></pre>
|
||||
* @param x the 'x' position of the resetZoomButton relative to {@link #setRelativeTo(RelativeTo)}
|
||||
* @return A reference to this {@link ResetZoomButton} instance for convenient method chaining.
|
||||
*/
|
||||
public ResetZoomButton setPositionX(Number x) {
|
||||
return this.setOption("/position/x", x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'y' position of the reset zoom button. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("resetZoomButton/position/y", 10);
|
||||
* </code></pre>
|
||||
* @param y the 'y' position of the resetZoomButton relative to {@link #setRelativeTo(RelativeTo)}
|
||||
* @return A reference to this {@link ResetZoomButton} instance for convenient method chaining.
|
||||
*/
|
||||
public ResetZoomButton setPositionY(Number y) {
|
||||
return this.setOption("/position/y", y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the frame that the reset zoom button's position is relative to. Equivalent to:
|
||||
* <pre><code>
|
||||
* resetZoomButton.setOption("relativeTo", "chart");
|
||||
* </code></pre>
|
||||
* What frame the button should be placed related to. Can be either "plot" or "chart". Defaults to "plot".
|
||||
* @param relativeTo The frame that the button's position is relative to.
|
||||
* @return A reference to this {@link ResetZoomButton} instance for convenient method chaining.
|
||||
*/
|
||||
public ResetZoomButton setRelativeTo(RelativeTo relativeTo) {
|
||||
return this.setOption("relativeTo", relativeTo != null ? relativeTo.toString() : null);
|
||||
}
|
||||
|
||||
//TODO Implement setTheme
|
||||
}
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
/**
|
||||
* A configurable class that can be used to represent custom scrollbar options within a {@link StockChart},
|
||||
* which can then be set on the chart (via the {@link StockChart#setScrollbar(Scrollbar)} method.)
|
||||
* The scrollbar is a means of panning over the X axis of a chart.
|
||||
* Example usage:
|
||||
* <code><pre>
|
||||
* stockChart.setScrollbar(
|
||||
* new Scrollbar()
|
||||
* .setBarBorderColor("#CC0000")
|
||||
* .setMinWidth(5)
|
||||
* );
|
||||
* </pre></code>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class Scrollbar extends Configurable<Scrollbar>{
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "barBackgroundColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("barBackgroundColor", "#666" );
|
||||
* </code></pre>
|
||||
* The background color of the scrollbar itself. Defaults to a gray gradient.
|
||||
* @param barBackgroundColor The background color, as a string, of the scrollbar.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setBarBackgroundColor(String barBackgroundColor) {
|
||||
return this.setOption("barBackgroundColor", barBackgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("borderColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the bar's border. Defaults to #666.
|
||||
* @param borderColor The color, as a string, of the bar's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setBorderColor(String borderColor) {
|
||||
return this.setOption("borderColor", borderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderRadius" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("borderRadius", 3);
|
||||
* </code></pre>
|
||||
* The border rounding radius of the bar. Defaults to 2.
|
||||
* @param borderRadius The length, in pixels, of the border's radius.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setBarBorderRadius(Number borderRadius) {
|
||||
return this.setOption("barBorderRadius", borderRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "barBorderWidth" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("barBorderWidth", 2);
|
||||
* </code></pre>
|
||||
* The width of the bar's border. Defaults to 1.
|
||||
* @param barBorderWidth The width, in pixels, of the bar's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setBarBorderWidth(Number barBorderWidth) {
|
||||
return this.setOption("barBorderWidth", barBorderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonArrowColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("buttonArrowColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the small arrow inside the scrollbar buttons. Defaults to #666.
|
||||
* @param buttonArrowColor The color, as a string, of the arrows in the scrollbar button.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setButtonArrowColor(String buttonArrowColor) {
|
||||
return this.setOption("buttonArrowColor", buttonArrowColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonBackgroundColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("buttonBackgroundColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of scrollbar buttons. Defaults to a gray gradient.
|
||||
* @param buttonBackgroundColor The color, as a string, of the scrollbar's button.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setButtonBackgroundColor(String buttonBackgroundColor) {
|
||||
return this.setOption("buttonBackgroundColor", buttonBackgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonBorderColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("buttonBorderColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the border of the scrollbar buttons. Defaults to #666.
|
||||
* @param buttonBorderColor The color, as a string, of the border of the scrollbar buttons.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setButtonBorderColor(String buttonBorderColor) {
|
||||
return this.setOption("buttonBorderColor", buttonBorderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonBorderRadius" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("buttonBorderRadius", 3);
|
||||
* </code></pre>
|
||||
* The corner radius of the scrollbar buttons. Defaults to 2.
|
||||
* @param buttonBorderRadius The radius, in pixels, of the scrollbar buttons.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setButtonBorderRadius(Number buttonBorderRadius) {
|
||||
return this.setOption("buttonBorderRadius", buttonBorderRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "buttonBorderWidth" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("buttonBorderWidth", 2);
|
||||
* </code></pre>
|
||||
* The border width of the scrollbar buttons. Defaults to 1.
|
||||
* @param buttonBorderWidth The width, in pixels, of the scrollbar button's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setButtonBorderWidth(Number buttonBorderWidth) {
|
||||
return this.setOption("buttonBorderWidth", buttonBorderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "enabled" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("enabled", false);
|
||||
* </code></pre>
|
||||
* Enable or disable the scrollbar. Defaults to true.
|
||||
* @param enabled False to disable the scrollbar.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setEnabled(boolean enabled) {
|
||||
return this.setOption("enabled", enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "height" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("height", 10);
|
||||
* </code></pre>
|
||||
* The height of the scrollbar. The height also applies to the width of the scroll arrows so that
|
||||
* they are always squares. Defaults to 20 for touch devices and 14 for mouse devices.
|
||||
* @param height The height, in pixels, of the scrollbar.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setHeight(Number height) {
|
||||
return this.setOption("height", height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "liveRedraw" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("liveRedraw", false);
|
||||
* </code></pre>
|
||||
* Whether to redraw the main chart as the scrollbar or the navigator zoomed window is moved.
|
||||
* Defaults to true for modern browsers and false for legacy IE browsers.
|
||||
* @param liveRedraw True to redraw the chart as the navigator is moved.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setLiveRedraw(boolean liveRedraw) {
|
||||
return this.setOption("liveRedraw", liveRedraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "minWidth" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("minWidth", 4);
|
||||
* </code></pre>
|
||||
* The minimum width of the scrollbar. Defaults to 6.
|
||||
* @param minWidth The minimum width, in pixels, of the scrollbar.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setMinWidth(Number minWidth) {
|
||||
return this.setOption("minWidth", minWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "rifleColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("rifleColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the small rifles in the middle of the scrollbar. Defaults to #666.
|
||||
* @param rifleColor The color, as a atring, of the rifles inside the scrollbar.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setRifleColor(String rifleColor) {
|
||||
return this.setOption("rifleColor", rifleColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "trackBackgroundColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("trackBackgroundColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the track background. The default is a gray gradient.
|
||||
* @param trackBackgroundColor The color, as a string, of the track's background.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setTrackBackgroundColor(String trackBackgroundColor) {
|
||||
return this.setOption("trackBackgroundColor", trackBackgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "trackBorderColor" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("trackBorderColor", "#666");
|
||||
* </code></pre>
|
||||
* The color of the border of the scrollbar track.
|
||||
* @param trackBorderColor The color, as a string, of the track's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setTrackBorderColor(String trackBorderColor){
|
||||
return this.setOption("trackBorderColor", trackBorderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "trackBorderRadius" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("trackBorderRadius", 1);
|
||||
* </code></pre>
|
||||
* The corner radius of the border of the scrollbar track. Defaults to 0.
|
||||
* @param trackBorderRadius The radius, in pixels, of the track's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setTrackBorderRadius(Number trackBorderRadius) {
|
||||
return this.setOption("trackBorderRadius", trackBorderRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "trackBorderWidth" option for the scrollbar. Equivalent to:
|
||||
* <pre><code>
|
||||
* scrollbar.setOption("trackBorderWidth", 2);
|
||||
* </code></pre>
|
||||
* The width of the border of the scrollbar track. Defaults to 1.
|
||||
* @param trackBorderWidth The width, in pixels, of the track's border.
|
||||
* @return A reference to this {@link Scrollbar} instance for convenient method chaining.
|
||||
*/
|
||||
public Scrollbar setTrackBorderWidth(Number trackBorderWidth) {
|
||||
return this.setOption("trackBorderWidth", trackBorderWidth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Regular → Executable
+199
-34
@@ -73,11 +73,11 @@ public class Series extends Configurable<Series> {
|
||||
* Show the series as an area filled in beneath a non-curved line
|
||||
*/
|
||||
AREA("area"),
|
||||
|
||||
|
||||
/**
|
||||
* Show the series as an area filled between two non-curved lines.<p>
|
||||
* Only available if the highcharts-more.js script is included in your GWT module.
|
||||
*
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
AREA_RANGE("arearange"),
|
||||
@@ -86,11 +86,11 @@ public class Series extends Configurable<Series> {
|
||||
* Show the series as an area filled in beneath a curved line
|
||||
*/
|
||||
AREA_SPLINE("areaspline"),
|
||||
|
||||
|
||||
/**
|
||||
* Show the series as an area filled between two curved lines.<p>
|
||||
* Only available if the highcharts-more.js script is included in your GWT module.
|
||||
*
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
AREA_SPLINE_RANGE("areasplinerange"),
|
||||
@@ -100,6 +100,18 @@ public class Series extends Configurable<Series> {
|
||||
*/
|
||||
BAR("bar"),
|
||||
|
||||
/**
|
||||
* Show the series as a box plot
|
||||
* @since 1.6.0
|
||||
*/
|
||||
BOXPLOT("boxplot"),
|
||||
|
||||
/**
|
||||
* Show the series as bubbles
|
||||
* @since 1.6.0
|
||||
*/
|
||||
BUBBLE("bubble"),
|
||||
|
||||
/**
|
||||
* Show the series as vertical bars
|
||||
*/
|
||||
@@ -110,7 +122,32 @@ public class Series extends Configurable<Series> {
|
||||
* Only available if the highcharts-more.js script is included in your GWT module.
|
||||
*/
|
||||
COLUMN_RANGE("columnrange"),
|
||||
|
||||
|
||||
/**
|
||||
* Shows the Series as an Error bar
|
||||
* @since 1.6.0
|
||||
*/
|
||||
ERRORBAR("errorbar"),
|
||||
|
||||
/**
|
||||
* Show the series as flags
|
||||
* @since 1.6.0
|
||||
*/
|
||||
FLAGS("flags"),
|
||||
|
||||
/**
|
||||
* Show the series as a funnel</p>
|
||||
* Only available if the highcharts-more.js script is included in your GWT module.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
FUNNEL("funnel"),
|
||||
|
||||
/**
|
||||
* @since 1.6.0
|
||||
* Show the series as a gauge
|
||||
*/
|
||||
GAUGE("gauge"),
|
||||
|
||||
/**
|
||||
* Show the series as a sequence of connected straight lines
|
||||
*/
|
||||
@@ -131,6 +168,12 @@ public class Series extends Configurable<Series> {
|
||||
*/
|
||||
SPLINE("spline"),
|
||||
|
||||
/**
|
||||
* Show the series as a waterfall
|
||||
* @since 1.6.0
|
||||
*/
|
||||
WATERFALL("waterfall"),
|
||||
|
||||
/**
|
||||
* Show the series as a sequence of bars that show the open, high, low, and close values.
|
||||
* Only available when you're using the {@link org.moxieapps.gwt.highcharts.client.StockChart} widget type.
|
||||
@@ -177,6 +220,33 @@ public class Series extends Configurable<Series> {
|
||||
setOption("id", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'index' option of the series. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("index", 1);
|
||||
* </code></pre>
|
||||
* The index of the series in the chart, affecting the internal index in the chart.series array,
|
||||
* the visible Z index as well as the order in the legend.
|
||||
* @param index The series' index in the internal chart.series array.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
*/
|
||||
public Series setIndex(Number index) {
|
||||
return this.setOption("index", index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'index' option of the series. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("index", 1);
|
||||
* </code></pre>
|
||||
* The sequential index of the series in the legend.
|
||||
* @param legendIndex A number representing the position of the series in the legend.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
*/
|
||||
public Series setLegendIndex(Number legendIndex) {
|
||||
return this.setOption("legendIndex", legendIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'name' option of the series. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -188,9 +258,23 @@ public class Series extends Configurable<Series> {
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
*/
|
||||
public Series setName(String name) {
|
||||
// ((JSONString)this.getOptions().get("name")).stringValue(); //check for null
|
||||
return this.setOption("name", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* /**
|
||||
* Convenience method for getting the 'name' of a particular series. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.getName()
|
||||
* </code></pre>
|
||||
* @return The name of a Series as a String, or null if no name is set by {@link #setName(String)}.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public String getName() {
|
||||
return ((JSONString)this.getOptions().get("name")).stringValue() != null ? ((JSONString)this.getOptions().get("name")).stringValue() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'stack' option of the series to a string. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -221,6 +305,26 @@ public class Series extends Configurable<Series> {
|
||||
return this.setOption("stack", stack);
|
||||
}
|
||||
|
||||
// We need to maintain a local reference to tooltip to deal with the formatter function
|
||||
private ToolTip toolTip;
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'tooltip' option of the series. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("/tooltip/borderColor", "#CCCCCC");
|
||||
* series.setOption("/tooltip/shadow", true);
|
||||
* etc..
|
||||
* </code></pre>
|
||||
* The tooltip appears when the user hovers over a series or point.
|
||||
*
|
||||
* @param toolTip The options to apply to the tooltip of the chart.
|
||||
* @return A reference to this {@link BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public Series setToolTip(ToolTip toolTip) {
|
||||
this.toolTip = toolTip;
|
||||
return this.setOption("/tooltip", toolTip != null ? toolTip.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this series (which controls the way the series will be rendered), using
|
||||
* an enumeration type in order to ensure a correct value is passed. This is equivalent to
|
||||
@@ -234,7 +338,7 @@ public class Series extends Configurable<Series> {
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
*/
|
||||
public Series setType(Type type) {
|
||||
return this.setOption("type", type.toString());
|
||||
return this.setOption("type", type != null ? type.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,6 +436,17 @@ public class Series extends Configurable<Series> {
|
||||
return this.addPoint(new Point(y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a point to the series that is to be used as a flag.
|
||||
* @param x Point where the flag appears
|
||||
* @param title Title of flag displayed on the chart
|
||||
* @param text Text displayed when the flag are highlighted.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
*/
|
||||
public Series addPoint(Number x, String title, String text) {
|
||||
return this.addPoint(new Point(x, title, text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a point to the series with a specific value on the Y axis, controlling the
|
||||
* options on how the change will be drawn to the series.
|
||||
@@ -385,16 +500,16 @@ public class Series extends Configurable<Series> {
|
||||
public Series addPoint(Number x, Number y) {
|
||||
return this.addPoint(new Point(x, y));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple way to add a point using the default options, and setting only the X, Low, and High
|
||||
* values that the point should be rendered at within the series (for Area Range
|
||||
* charts). See the various overloaded versions of the <code>addPoint()</code> method for
|
||||
* more control over the way the point is rendered.
|
||||
*
|
||||
* @param x The value on the X axis that the point should be drawn at within the series.
|
||||
* @param low The "low" Y value that the point should be rendered at within the series.
|
||||
* @param high The "high" Y value that the point should be rendered at within the series.
|
||||
* @param x The value on the X axis that the point should be drawn at within the series.
|
||||
* @param low The "low" Y value that the point should be rendered at within the series.
|
||||
* @param high The "high" Y value that the point should be rendered at within the series.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@@ -538,8 +653,16 @@ public class Series extends Configurable<Series> {
|
||||
// if persistence is enabled than we need to store the point locally as well (so we have it if
|
||||
// the chart is dynamically moved to another panel).
|
||||
if (!isRendered() || chart.isPersistent()) {
|
||||
|
||||
// Need to manually shift the item off the list if we haven't been rendered yet (after
|
||||
// we're rendered Highcharts handles the shift on its own)
|
||||
if (shift && points.size() > 0) {
|
||||
points.remove(0);
|
||||
}
|
||||
|
||||
// If we haven't been rendered, then just store the point in ourselves for now.
|
||||
points.add(point);
|
||||
|
||||
}
|
||||
|
||||
if (isRendered()) {
|
||||
@@ -548,7 +671,7 @@ public class Series extends Configurable<Series> {
|
||||
if (nativeSeries != null) {
|
||||
if (animation == null || animation.getOptions() == null) {
|
||||
final boolean animationFlag = animation != null;
|
||||
if(point == null || (point.isSingleValue() && point.getY() == null)) {
|
||||
if (point == null || (point.isSingleValue() && point.getY() == null)) {
|
||||
nativeAddPoint(nativeSeries, null, redraw, shift, animationFlag);
|
||||
} else if (point.isSingleValue() && !chart.isPersistent() && !point.hasNativeProperties()) {
|
||||
nativeAddPoint(nativeSeries, point.getY().doubleValue(), redraw, shift, animationFlag);
|
||||
@@ -557,7 +680,7 @@ public class Series extends Configurable<Series> {
|
||||
}
|
||||
} else {
|
||||
final JavaScriptObject animationOptions = animation.getOptions().getJavaScriptObject();
|
||||
if(point == null || (point.isSingleValue() && point.getY() == null)) {
|
||||
if (point == null || (point.isSingleValue() && point.getY() == null)) {
|
||||
nativeAddPoint(nativeSeries, null, redraw, shift, animationOptions);
|
||||
} else if (point.isSingleValue() && !chart.isPersistent() && !point.hasNativeProperties()) {
|
||||
nativeAddPoint(nativeSeries, point.getY().doubleValue(), redraw, shift, animationOptions);
|
||||
@@ -573,10 +696,10 @@ public class Series extends Configurable<Series> {
|
||||
private JavaScriptObject convertPointToJavaScriptObject(Point point) {
|
||||
final JSONObject options = point.getOptions() != null ? point.getOptions() : new JSONObject();
|
||||
Chart.addPointScalarValues(point, options);
|
||||
if(point.hasNativeProperties()) {
|
||||
if (point.hasNativeProperties()) {
|
||||
Point.addPointNativeProperties(point, options);
|
||||
}
|
||||
if(chart != null) {
|
||||
if (chart != null) {
|
||||
chart.addPointId(point, options);
|
||||
}
|
||||
return options.getJavaScriptObject();
|
||||
@@ -621,7 +744,7 @@ public class Series extends Configurable<Series> {
|
||||
if (nativeSeries != null) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (int i = 0, pointsLength = yValues.length; i < pointsLength; i++) {
|
||||
if((yValues[i] != null)) {
|
||||
if ((yValues[i] != null)) {
|
||||
jsonArray.set(i, new JSONNumber(yValues[i].doubleValue()));
|
||||
} else {
|
||||
jsonArray.set(i, JSONNull.getInstance());
|
||||
@@ -635,15 +758,15 @@ public class Series extends Configurable<Series> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a new set of data to the series and automatically redraw it. The format of the data values
|
||||
* Apply a new set of data to the series and automatically redraw it. The format of the data values
|
||||
* should match the chart type of the Series:
|
||||
* <ul>
|
||||
* <li>[x, y] - for standard line or area charts</li>
|
||||
* <li>[x, low, high] - for area range charts</li>
|
||||
* <li>[x, open, high, low, close] - for OHLC charts</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>If you need more control than just simply setting the x and y values of each data point, then
|
||||
* </ul>
|
||||
* <p/>
|
||||
* <p>If you need more control than just simply setting the x and y values of each data point, then
|
||||
* use the {@link #setPoints(org.moxieapps.gwt.highcharts.client.Point[])} method instead.
|
||||
*
|
||||
* @param values A two dimensional array of values, where the main array is the list of points and
|
||||
@@ -655,15 +778,15 @@ public class Series extends Configurable<Series> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a new set of data to the series and optionally redraw it. The format of the data values
|
||||
* Apply a new set of data to the series and optionally redraw it. The format of the data values
|
||||
* should match the chart type of the Series:
|
||||
* <ul>
|
||||
* <li>[x, y] - for standard line or area charts</li>
|
||||
* <li>[x, low, high] - for area range charts</li>
|
||||
* <li>[x, open, high, low, close] - for OHLC charts</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>If you need more control than just simply setting the x and y values of each data point, then
|
||||
* </ul>
|
||||
* <p/>
|
||||
* <p>If you need more control than just simply setting the x and y values of each data point, then
|
||||
* use the {@link #setPoints(org.moxieapps.gwt.highcharts.client.Point[])} method instead.
|
||||
*
|
||||
* @param values A two dimensional array of values, where the main array is the list of points and
|
||||
@@ -699,7 +822,7 @@ public class Series extends Configurable<Series> {
|
||||
for (int i = 0, pointsLength = values.length; i < pointsLength; i++) {
|
||||
Number[] point = values[i];
|
||||
JSONValue jsonValue;
|
||||
if(point == null) {
|
||||
if (point == null) {
|
||||
jsonValue = JSONNull.getInstance();
|
||||
} else if (point.length == 5) {
|
||||
// For OHLC charts
|
||||
@@ -786,7 +909,7 @@ public class Series extends Configurable<Series> {
|
||||
*/
|
||||
public Point[] getPoints() {
|
||||
ArrayList<Point> convertedPoints = points;
|
||||
if (isRendered()) {
|
||||
if (isRendered() && !chart.isPersistent()) {
|
||||
convertedPoints = new ArrayList<Point>();
|
||||
// After the series has been rendered, convert the live JS data series back into GWT objects
|
||||
final JavaScriptObject nativeSeries = chart.get(this.id);
|
||||
@@ -812,8 +935,7 @@ public class Series extends Configurable<Series> {
|
||||
* If you're using non-persistent charts, you can instead simply use the
|
||||
* {@link org.moxieapps.gwt.highcharts.client.Point#remove()} method to achieve the same affect.
|
||||
*
|
||||
* @param point The point instance (obtained dynamically from the chart) to remove from the series.
|
||||
*
|
||||
* @param point The point instance (obtained dynamically from the chart) to remove from the series.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@@ -875,10 +997,10 @@ public class Series extends Configurable<Series> {
|
||||
// Note that this logic is purposefully only functional for chart's that are using the "setPersistent()"
|
||||
// option. Removing a point from a non-persistent chart can be achieved by simply using
|
||||
// the "Point.remove()" methods.
|
||||
if(id != null && points != null) {
|
||||
if (id != null && points != null) {
|
||||
for (Iterator<Point> iterator = points.iterator(); iterator.hasNext(); ) {
|
||||
Point existingPoint = iterator.next();
|
||||
if(id.equals(existingPoint.getId())) {
|
||||
if (id.equals(existingPoint.getId())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@@ -898,6 +1020,7 @@ public class Series extends Configurable<Series> {
|
||||
|
||||
/**
|
||||
* Shows the series if hidden. Only applies after the chart has been rendered.
|
||||
* Note that if you need show many series at once consider using the {@link #setVisible(boolean, boolean)} method instead.
|
||||
*
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.1.0
|
||||
@@ -915,6 +1038,7 @@ public class Series extends Configurable<Series> {
|
||||
/**
|
||||
* Hides the series if visible. If the {@link org.moxieapps.gwt.highcharts.client.BaseChart#setIgnoreHiddenSeries(boolean)} option is true,
|
||||
* the chart is automatically redrawn without this series. Only applies after the chart has been rendered.
|
||||
* Note that if you need hide many series at once consider using the {@link #setVisible(boolean, boolean)} method instead.
|
||||
*
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.1.0
|
||||
@@ -929,6 +1053,41 @@ public class Series extends Configurable<Series> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Either shows or hides the series, and then automatically redraws the chart.
|
||||
* Only applies after the chart has been rendered. Note that if you need to show/hide many series
|
||||
* at once consider using the {@link #setVisible(boolean, boolean)} method instead.
|
||||
*
|
||||
* @param visible Whether or not to show or hide the series.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Series setVisible(boolean visible) {
|
||||
return this.setVisible(visible, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Either shows or hides the series, and then optionally redraws the chart.
|
||||
* Only applies after the chart has been rendered. Note that if you need
|
||||
* to show/hide many series at once use this method passing "false" for the 'redraw' parameter, and
|
||||
* then use the {@link org.moxieapps.gwt.highcharts.client.BaseChart#redraw()} method to update the
|
||||
* chart once you're ready.
|
||||
*
|
||||
* @param visible Whether or not to show or hide the series.
|
||||
* @param redraw Whether or not to automatically redraw the chart, or wait until the Chart.redraw() method is called.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.Series} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Series setVisible(boolean visible, boolean redraw) {
|
||||
if (isRendered()) {
|
||||
final JavaScriptObject nativeSeries = chart.get(this.id);
|
||||
if (nativeSeries != null) {
|
||||
nativeSetVisible(nativeSeries, visible, redraw);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select or unselect the series. This means it's selected property is set, the checkbox in the legend is
|
||||
* toggled and when selected, the series is returned in the {@link org.moxieapps.gwt.highcharts.client.BaseChart#getSelectedSeries()} method.
|
||||
@@ -964,9 +1123,10 @@ public class Series extends Configurable<Series> {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the series' visibility state as set by {@link #show()}, {@link #hide()}, or the initial configuration.
|
||||
* Retrieve the series' visibility state as set by {@link #show()}, {@link #hide()}, or the initial configuration.
|
||||
*
|
||||
* @return true if the series is visible, false if hidden or the chart has not yet been rendered.
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
@@ -991,11 +1151,12 @@ public class Series extends Configurable<Series> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method used to retrieve the unique id generated for this series.
|
||||
* The internally generated unique id for this series
|
||||
*
|
||||
* @return The unique id of this series
|
||||
* @since 1.6.0
|
||||
*/
|
||||
String getId() {
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -1048,6 +1209,10 @@ public class Series extends Configurable<Series> {
|
||||
series.hide();
|
||||
}-*/;
|
||||
|
||||
private static native void nativeSetVisible(JavaScriptObject series, boolean visible, boolean redraw) /*-{
|
||||
series.setVisible(visible, redraw);
|
||||
}-*/;
|
||||
|
||||
private static native void nativeSelect(JavaScriptObject series, boolean select) /*-{
|
||||
series.select(select);
|
||||
}-*/;
|
||||
@@ -1059,7 +1224,7 @@ public class Series extends Configurable<Series> {
|
||||
private static native JsArray<JavaScriptObject> nativeGetData(JavaScriptObject series) /*-{
|
||||
return series.data;
|
||||
}-*/;
|
||||
|
||||
|
||||
private static native boolean nativeIsVisible(JavaScriptObject series) /*-{
|
||||
return series.visible;
|
||||
}-*/;
|
||||
|
||||
+35
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.CandlestickPlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.OHLCPlotOptions;
|
||||
|
||||
/**
|
||||
@@ -113,6 +114,20 @@ public class StockChart extends BaseChart<StockChart> {
|
||||
return this.setOption("/rangeSelector", rangeSelector != null ? rangeSelector.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'scrollbar' chart options. Equivalent to:
|
||||
* <pre><code>
|
||||
* stockChart.setOption("/scrollbar/enabled", false);
|
||||
* stockChart.setOption("/scrollbar/height", 2);
|
||||
* etc...
|
||||
* </code></pre>
|
||||
* @param scrollbar Sets the scrollbar options
|
||||
* @return A reference to this {@link StockChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public StockChart setScrollbar(Scrollbar scrollbar) {
|
||||
return this.setOption("/scrollbar", scrollbar != null ? scrollbar.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the options that all OHLC type series within the chart will use by default. The settings can then
|
||||
@@ -135,5 +150,24 @@ public class StockChart extends BaseChart<StockChart> {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the options that all candlestick type series within the chart will use by default. The settings can then
|
||||
* be overridden for each individual series via the {@link Series#setPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that changing the plot options on a chart that has already been rendered will only affect
|
||||
* series that are subsequently added to the chart (and will not impact any of the series that are already
|
||||
* rendered in the chart.)
|
||||
*
|
||||
* @param candlestickPlotOptions The options to set on the chart as the default settings for all candlestick type series
|
||||
* that are part of this chart.
|
||||
* @return A reference to this {@link StockChart} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public StockChart setCandlestickPlotOptions(CandlestickPlotOptions candlestickPlotOptions) {
|
||||
this.candlestickPlotOptions = candlestickPlotOptions;
|
||||
if (candlestickPlotOptions != null) {
|
||||
this.setOption("/plotOptions/candlestick", candlestickPlotOptions.getOptions());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+92
-1
@@ -37,6 +37,20 @@ import com.google.gwt.json.client.JSONBoolean;
|
||||
*/
|
||||
public class ToolTip extends Configurable<ToolTip> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'animation' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("animation", "true");
|
||||
* </code></pre>
|
||||
* Enable or disable animation of the tooltip. In slow legacy IE browsers the animation is disabled by default.
|
||||
* Defaults to true.
|
||||
* @param animation Whether to enable or disable animation of the tooltip.
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setAnimation(boolean animation) {
|
||||
return this.setOption("animation", animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'backgroundColor' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -150,6 +164,20 @@ public class ToolTip extends Configurable<ToolTip> {
|
||||
return this.setOption("borderWidth", borderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* convenience method for setting the 'changeDecimal' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("changeDecimal", 5);
|
||||
* </code></pre>
|
||||
* How many decimals to show for the point.change value when the series.compare option is set.
|
||||
* This is overridable in each series' tooltip options object. The default is to preserve all decimals.
|
||||
* @param changeDecimal The number of decimals to show.
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setChangeDecimal(Number changeDecimal) {
|
||||
return this.setOption("changeDecimal", changeDecimal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'crosshairs' option for the tool tips for both axis. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -184,10 +212,11 @@ public class ToolTip extends Configurable<ToolTip> {
|
||||
public ToolTip setCrosshairs(boolean xCrosshairs, boolean yCrosshairs) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.set(0, JSONBoolean.getInstance(xCrosshairs));
|
||||
jsonArray.set(0, JSONBoolean.getInstance(yCrosshairs));
|
||||
jsonArray.set(1, JSONBoolean.getInstance(yCrosshairs));
|
||||
return this.setOption("crosshairs", jsonArray);
|
||||
}
|
||||
|
||||
|
||||
// TODO: Add crosshairs options for taking an array of objects
|
||||
|
||||
/**
|
||||
@@ -204,6 +233,38 @@ public class ToolTip extends Configurable<ToolTip> {
|
||||
return this.setOption("enabled", enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'followPointer' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("followPointer", true);
|
||||
* </code></pre>
|
||||
* Whether the tooltip should follow the mouse as it moves across columns, pie slices and other
|
||||
* point types with an extent. By default it behaves this way for scatter, bubble and pie series
|
||||
* by override in the plotOptions for those series types.
|
||||
* For touch moves to behave the same way, {@link #setFollowTouchMove(boolean)} must be true also.
|
||||
* @param followPointer 'true' to make the tooltip follow the mouse pointer.
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setFollowPointer(boolean followPointer) {
|
||||
return this.setOption("followPointer", followPointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'enabled' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("followTouchMove", true);
|
||||
* </code></pre>
|
||||
* Whether the tooltip should follow the finger as it moves on a touch device.
|
||||
* The default value of false causes a touch move to scroll the web page, as is default behaviour
|
||||
* on touch devices. Setting it to true may cause the user to be trapped inside the chart and
|
||||
* unable to scroll away, so it should be used with care. Defaults to false.
|
||||
* @param followTouchMove 'true' to make the tooltip follow a finger on a touch device.
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setFollowTouchMove(boolean followTouchMove) {
|
||||
return this.setOption("followTouchMove", followTouchMove);
|
||||
}
|
||||
|
||||
private ToolTipFormatter toolTipFormatter;
|
||||
|
||||
/**
|
||||
@@ -225,6 +286,36 @@ public class ToolTip extends Configurable<ToolTip> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'headerFormat' option for the tool tips. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("headerFormat", "<span style=\"font-size: 10px\">{point.key}</span><br/>")
|
||||
* </code></pre>
|
||||
* The HTML of the tooltip header line. Variables are enclosed by curly brackets.
|
||||
* Available variables are point.key, series.name, series.color and other members from the point and series objects.
|
||||
* The point.key variable contains the category name, x value or datetime string depending on the type of axis.
|
||||
* For datetime axes, the point.key date format can be set using {@link #setXDateFormat(String)}.
|
||||
* Defaults to <span style="font-size: 10px">{point.key}</span><br/>
|
||||
* @param headerFormat The HTML of the tool tip header
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setHeaderFormat(String headerFormat) {
|
||||
return this.setOption("headerFormat", headerFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'hideDelay' option of the tool tip. Equivalent to:
|
||||
* <pre><code>
|
||||
* toolTip.setOption("hideDelay", 500)
|
||||
* </code></pre>
|
||||
* The number of milliseconds to wait until the tooltip is hidden when mouse out from a point or chart. Defaults to 500.
|
||||
* @param hideDelay the number of miliseconds to wait before hiding the tooltip.
|
||||
* @return A reference to this {@link ToolTip} instance for convenient method chaining.
|
||||
*/
|
||||
public ToolTip setHideDelay(Number hideDelay) {
|
||||
return this.setOption("hideDelay", hideDelay);
|
||||
}
|
||||
|
||||
// Purposefully restricted to package scope
|
||||
ToolTipFormatter getToolTipFormatter() {
|
||||
return this.toolTipFormatter;
|
||||
|
||||
@@ -45,6 +45,36 @@ public class YAxis extends Axis<YAxis> {
|
||||
super(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'top' option of the axis. Equivalent to:
|
||||
* <pre><code>
|
||||
* axis.setOption("top", 300);
|
||||
* </code></pre>
|
||||
* The maximum value of the axis
|
||||
* @param height The height of the axis.
|
||||
* @return A reference to this {@link YAxis} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public YAxis setHeight(Number height) {
|
||||
return this.setOption("height", height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'top' option of the axis. Equivalent to:
|
||||
* <pre><code>
|
||||
* axis.setOption("top", 300);
|
||||
* </code></pre>
|
||||
* The top pixel position of the Y axis relative to the chart. Defaults to null.
|
||||
* Note that this option is a fixed value and does not support setting the top of the
|
||||
* axis as a percentage of the pane.
|
||||
* @param top The top value of the axis.
|
||||
* @return A reference to this {@link YAxis} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public YAxis setTop(Number top) {
|
||||
return this.setOption("top", top);
|
||||
}
|
||||
|
||||
private YAxisLabels yAxisLabels;
|
||||
|
||||
/**
|
||||
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
+15
-1
@@ -17,7 +17,7 @@
|
||||
package org.moxieapps.gwt.highcharts.client.labels;
|
||||
|
||||
/**
|
||||
* A common base class for both {@link DataLabels} and {@link PieDataLabels} to prevent code duplication
|
||||
* A common base class for both {@link DataLabels} and {@link ProportionalDataLabels} to prevent code duplication
|
||||
* while still maintaining a cleaner way for the user to utilize the method chaining with the generics
|
||||
* in place. You should not use this class directly, but instead use one of the base classes.
|
||||
*
|
||||
@@ -116,6 +116,20 @@ public abstract class BaseDataLabels<T extends BaseDataLabels> extends Labels<T>
|
||||
return this.setOption("shadow", shadow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'format' option for a dataLabel. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataLabel.setOption("format", "{y} mm");
|
||||
* </code></pre>
|
||||
* A format string for the data label. Available variables are the same as for formatter. Defaults to {y}.
|
||||
* @param format A format string used to set the format for s series on a chart.
|
||||
* @return A reference to this {@link BaseDataLabels} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setFormat(String format) {
|
||||
return this.setOption("format", format);
|
||||
}
|
||||
|
||||
private DataLabelsFormatter dataLabelsFormatter;
|
||||
|
||||
/**
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2011 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.labels;
|
||||
|
||||
/**
|
||||
* A configurable class that can be used to represent custom data label display options for funnel charts, which
|
||||
* can then be set as the default data label display approach and applied to the FunnelPlotOptions
|
||||
* (via the {@link org.moxieapps.gwt.highcharts.client.plotOptions.FunnelPlotOptions#setFunnelDataLabels(FunnelDataLabels)} method).
|
||||
* <p/>
|
||||
* Example usage:
|
||||
* <code><pre>
|
||||
* chart.setPiePlotOptions(
|
||||
* new PiePlotOptions()
|
||||
* .setPieDataLabels(
|
||||
* new PieDataLabels()
|
||||
* .setEnabled(true)
|
||||
* .setConnectorColor("#FF0000)
|
||||
* .setConnectorWidth(4.0)
|
||||
* )
|
||||
* );
|
||||
* </pre></code>
|
||||
*
|
||||
* @author squinn@moxiegroup.com (Shawn Quinn)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class FunnelDataLabels extends ProportionalDataLabels<FunnelDataLabels> {
|
||||
|
||||
// All needed methods are inherited from {@link ProportionalDataLabels}
|
||||
|
||||
}
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
+26
-82
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright 2011 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2011 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.labels;
|
||||
|
||||
@@ -23,78 +23,22 @@ package org.moxieapps.gwt.highcharts.client.labels;
|
||||
* <p/>
|
||||
* Example usage:
|
||||
* <code><pre>
|
||||
* chart.setPiePlotOptions(
|
||||
* new PiePlotOptions()
|
||||
* .setPieDataLabels(
|
||||
* new PieDataLabels()
|
||||
* .setEnabled(true)
|
||||
* .setConnectorColor("#FF0000)
|
||||
* .setConnectorWidth(4.0)
|
||||
* )
|
||||
* );
|
||||
* chart.setPiePlotOptions(
|
||||
* new PiePlotOptions()
|
||||
* .setPieDataLabels(
|
||||
* new PieDataLabels()
|
||||
* .setEnabled(true)
|
||||
* .setConnectorColor("#FF0000)
|
||||
* .setConnectorWidth(4.0)
|
||||
* )
|
||||
* );
|
||||
* </pre></code>
|
||||
*
|
||||
* @author squinn@moxiegroup.com (Shawn Quinn)
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class PieDataLabels extends BaseDataLabels<PieDataLabels> {
|
||||
public class PieDataLabels extends ProportionalDataLabels<PieDataLabels> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorColor' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorColor", "#CC0000");
|
||||
* </code></pre>
|
||||
* The color of the line connecting the data label to the pie slice. Defaults to #606060.
|
||||
*
|
||||
* @param connectorColor The color of the line connecting the data label to the pie slice.
|
||||
* @return A reference to this {@link PieDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public PieDataLabels setConnectorColor(String connectorColor) {
|
||||
return this.setOption("connectorColor", connectorColor);
|
||||
}
|
||||
// All needed methods are inherited from {@link ProportionalDataLabels}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorPadding' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorPadding", 2.0);
|
||||
* </code></pre>
|
||||
* The distance from the data label to the connector. Defaults to 5.
|
||||
*
|
||||
* @param connectorPadding The The distance from the data label to the connector.
|
||||
* @return A reference to this {@link PieDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public PieDataLabels setConnectorPadding(Number connectorPadding) {
|
||||
return this.setOption("connectorPadding", connectorPadding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorWidth' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorWidth", 2.0);
|
||||
* </code></pre>
|
||||
* The width of the line connecting the data label to the pie slice. Defaults to 1.
|
||||
*
|
||||
* @param connectorWidth The width of the line connecting the data label to the pie slice.
|
||||
* @return A reference to this {@link PieDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public PieDataLabels setConnectorWidth(Number connectorWidth) {
|
||||
return this.setOption("connectorWidth", connectorWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'distance' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("distance", 24);
|
||||
* </code></pre>
|
||||
* The distance of the data label from the pie's edge. Negative numbers put the data label
|
||||
* on top of the pie slices. Connectors are only shown for data labels outside the pie.
|
||||
* Defaults to 30.
|
||||
*
|
||||
* @param distance The distance of the data label from the pie's edge.
|
||||
* @return A reference to this {@link PieDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public PieDataLabels setDistance(Number distance) {
|
||||
return this.setOption("distance", distance);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright 2011 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.labels;
|
||||
|
||||
/**
|
||||
* A configurable class that can be used to represent custom data label display options for pie charts and funnel charts, which
|
||||
* can then be set as the default data label display approach and applied to the ProportionalPlotOptions
|
||||
* (via the {@link org.moxieapps.gwt.highcharts.client.plotOptions.FunnelPlotOptions#setFunnelDataLabels(FunnelDataLabels)}
|
||||
* or {@link org.moxieapps.gwt.highcharts.client.plotOptions.PiePlotOptions#setPieDataLabels(PieDataLabels)} methods).
|
||||
* <p/>
|
||||
* Example usage:
|
||||
* <code><pre>
|
||||
* chart.setPiePlotOptions(
|
||||
* new PiePlotOptions()
|
||||
* .setPieDataLabels(
|
||||
* new ProportionalDataLabels()
|
||||
* .setEnabled(true)
|
||||
* .setConnectorColor("#FF0000)
|
||||
* .setConnectorWidth(4.0)
|
||||
* )
|
||||
* );
|
||||
* </pre></code>
|
||||
*
|
||||
* @author squinn@moxiegroup.com (Shawn Quinn)
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public abstract class ProportionalDataLabels<T extends ProportionalDataLabels> extends BaseDataLabels<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorColor' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorColor", "#CC0000");
|
||||
* </code></pre>
|
||||
* The color of the line connecting the data label to the pie slice. Defaults to #606060.
|
||||
*
|
||||
* @param connectorColor The color of the line connecting the data label to the pie slice.
|
||||
* @return A reference to this {@link ProportionalDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public T setConnectorColor(String connectorColor) {
|
||||
return this.setOption("connectorColor", connectorColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorPadding' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorPadding", 2.0);
|
||||
* </code></pre>
|
||||
* The distance from the data label to the connector. Defaults to 5.
|
||||
*
|
||||
* @param connectorPadding The The distance from the data label to the connector.
|
||||
* @return A reference to this {@link ProportionalDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public T setConnectorPadding(Number connectorPadding) {
|
||||
return this.setOption("connectorPadding", connectorPadding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectorWidth' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("connectorWidth", 2.0);
|
||||
* </code></pre>
|
||||
* The width of the line connecting the data label to the pie slice. Defaults to 1.
|
||||
*
|
||||
* @param connectorWidth The width of the line connecting the data label to the pie slice.
|
||||
* @return A reference to this {@link ProportionalDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public T setConnectorWidth(Number connectorWidth) {
|
||||
return this.setOption("connectorWidth", connectorWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'distance' option for the data labels. Equivalent to:
|
||||
* <pre><code>
|
||||
* labels.setOption("distance", 24);
|
||||
* </code></pre>
|
||||
* The distance of the data label from the pie's edge. Negative numbers put the data label
|
||||
* on top of the pie slices. Connectors are only shown for data labels outside the pie.
|
||||
* Defaults to 30.
|
||||
*
|
||||
* @param distance The distance of the data label from the pie's edge.
|
||||
* @return A reference to this {@link ProportionalDataLabels} instance for convenient method chaining.
|
||||
*/
|
||||
public T setDistance(Number distance) {
|
||||
return this.setOption("distance", distance);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-15
@@ -35,20 +35,6 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
*/
|
||||
public class AreaPlotOptions extends BaseAreaPlotOptions<AreaPlotOptions> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'threshold' option of the area plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("threshold", 0.5);
|
||||
* </code></pre>
|
||||
* The Y axis value to serve as the base for the area, for distinguishing between values above and
|
||||
* below a threshold. Defaults to 0.
|
||||
*
|
||||
* @param threshold The Y axis value to serve as the base for the area, for distinguishing between
|
||||
* values above and below a threshold.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public AreaPlotOptions setThreshold(String threshold) {
|
||||
return this.setOption("threshold", threshold);
|
||||
}
|
||||
// All needed methods are inherited from {@link BaseAreaPlotOptions}
|
||||
|
||||
}
|
||||
Regular → Executable
File mode changed.
+1
-15
@@ -36,20 +36,6 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
*/
|
||||
public class AreaSplinePlotOptions extends BaseAreaSplinePlotOptions<AreaSplinePlotOptions> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'threshold' option of the area plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaSplinePlotOptions.setOption("threshold", 0.5);
|
||||
* </code></pre>
|
||||
* The Y axis value to serve as the base for the area, for distinguishing between values above and
|
||||
* below a threshold. Defaults to 0.
|
||||
*
|
||||
* @param threshold The Y axis value to serve as the base for the area, for distinguishing between
|
||||
* values above and below a threshold.
|
||||
* @return A reference to this {@link AreaSplinePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public AreaSplinePlotOptions setThreshold(String threshold) {
|
||||
return this.setOption("threshold", threshold);
|
||||
}
|
||||
// All needed methods are inherited from {@link BaseAreaPlotOptions}
|
||||
|
||||
}
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+84
@@ -16,6 +16,20 @@ import org.moxieapps.gwt.highcharts.client.Color;
|
||||
*/
|
||||
public abstract class BaseAreaPlotOptions<T extends BaseAreaPlotOptions> extends PlotOptions<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectNulls' option of the area plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("connectNulls", true);
|
||||
* </code></pre>
|
||||
* Whether to connect a graph line across null points. Defaults to false.
|
||||
* @param connectNulls 'true' to connect the graph across null points.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setConnectNulls(boolean connectNulls) {
|
||||
return this.setOption("connectNulls", connectNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the area plot options
|
||||
* to a RGB hex value. Equivalent to:
|
||||
@@ -72,6 +86,23 @@ public abstract class BaseAreaPlotOptions<T extends BaseAreaPlotOptions> extends
|
||||
return this.setOption("fillOpacity", fillOpacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience Method for setting the "gapSize" option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("gapSize", 5);
|
||||
* </code></pre>
|
||||
* Defines when to display a gap in the graph. A gap size of 5 means that if the distance between two points is
|
||||
* greater than five times that of the two closest points, the graph will be broken.In practice, this option is
|
||||
* most often used to visualize gaps in time series. In a stock chart, intraday data is available for daytime hours,
|
||||
* while gaps will appear in nights and weekends.. Defaults to 0.
|
||||
* @param gapSize The distance between points needed to display a gap in the series.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setGapSize(Number gapSize) {
|
||||
return this.setOption("gapSize", gapSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'lineColor' option of the area plot options to a RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -115,4 +146,57 @@ public abstract class BaseAreaPlotOptions<T extends BaseAreaPlotOptions> extends
|
||||
return this.setOption("lineColor", lineColor != null ? lineColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "negativeFillColor" option for area charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("negativeFillColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* A separate color for the negative part of the area.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setNegativeFillColor(Color)}
|
||||
* version instead.
|
||||
* @param negativeFillColor The value to set as the 'negativeFillColor' option of the area plots.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setNegativeFillColor(String negativeFillColor) {
|
||||
return this.setOption("negativeFillColor", negativeFillColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("negativeFillColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* A separate color for the negative part of the area.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setNegativeFillColor(String)} version instead.
|
||||
* @param negativeFillColor The color gradient or color with an alpha channel to set as the 'negativeFillColor' option of the area plot.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setNegativeFillColor(Color negativeFillColor) {
|
||||
return this.setOption("negativeFillColor", negativeFillColor != null ? negativeFillColor.getOptionValue() : negativeFillColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'trackByArea' option for area charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("trackByArea", true);
|
||||
* </code></pre>
|
||||
* If true, the whole area will respond to mouseover events. If false, just the line will respond.
|
||||
* Defaults to false.
|
||||
* @param trackByArea Whether the whole area or just the line should respond to mouseover tooltips and other mouse or touch events.
|
||||
* @return A reference to this {@link AreaPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setTrackByArea (boolean trackByArea) {
|
||||
return this.setOption("trackByArea", trackByArea);
|
||||
}
|
||||
}
|
||||
Regular → Executable
+59
-1
@@ -16,6 +16,34 @@ import org.moxieapps.gwt.highcharts.client.Color;
|
||||
*/
|
||||
public abstract class BaseAreaSplinePlotOptions<T extends BaseAreaSplinePlotOptions> extends PlotOptions<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectEnds' option of the area plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaSplinePlotOptions.setOption("connectEnds", false);
|
||||
* </code></pre>
|
||||
* Polar charts only. Whether to connect the ends of a line series plot across the extremes. Defaults to true.
|
||||
* @param connectEnds 'true' to connect ends of a line on a polar chart.
|
||||
* @return A reference to this {@link AreaSplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setConnectEnds(boolean connectEnds) {
|
||||
return this.setOption("connectEnds", connectEnds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectNulls' option for the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* splinePlotOptions.setOption("connectNulls", true);
|
||||
* </code></pre>
|
||||
* Whether to draw a line between points on either side of a null point, or render a gap between them.
|
||||
* @param connectNulls 'true' to connect points on either side of a null point
|
||||
* @return A reference to this {@link AreaSplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setConnectNulls(boolean connectNulls) {
|
||||
return this.setOption("connectNulls", connectNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the area plot options
|
||||
* to a RGB hex value. Equivalent to:
|
||||
@@ -72,6 +100,23 @@ public abstract class BaseAreaSplinePlotOptions<T extends BaseAreaSplinePlotOpti
|
||||
return this.setOption("fillOpacity", fillOpacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience Method for setting the "gapSize" option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaSplinePlotOptions.setOption("gapSize", 5);
|
||||
* </code></pre>
|
||||
* Defines when to display a gap in the graph. A gap size of 5 means that if the distance between two points is
|
||||
* greater than five times that of the two closest points, the graph will be broken.In practice, this option is
|
||||
* most often used to visualize gaps in time series. In a stock chart, intraday data is available for daytime hours,
|
||||
* while gaps will appear in nights and weekends.. Defaults to 0.
|
||||
* @param gapSize The distance between points needed to display a gap in the series.
|
||||
* @return A reference to this {@link AreaSplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setGapSize(Number gapSize) {
|
||||
return this.setOption("gapSize", gapSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'lineColor' option of the area plot options to a RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -115,5 +160,18 @@ public abstract class BaseAreaSplinePlotOptions<T extends BaseAreaSplinePlotOpti
|
||||
return this.setOption("lineColor", lineColor != null ? lineColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'trackByArea' option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaSplinePlotOptions.setOption("trackByArea", true);
|
||||
* </code></pre>
|
||||
* If true, the whole area will respond to mouseover events. If false, just the line will respond.
|
||||
* Defaults to false.
|
||||
* @param trackByArea Whether the whole area or just the line should respond to mouseover tooltips and other mouse or touch events.
|
||||
* @return A reference to this {@link AreaSplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setTrackByArea(boolean trackByArea) {
|
||||
return this.setOption("trackByArea", trackByArea);
|
||||
}
|
||||
}
|
||||
Regular → Executable
+1
-1
@@ -7,7 +7,7 @@ package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
|
||||
/**
|
||||
* A common base class for both {@link ColumnPlotOptions} and {@link ColumnRangePlotOptions} to prevent code duplication
|
||||
* A common base class for {@link BoxPlotOptions}, {@link ColumnPlotOptions} and {@link ColumnRangePlotOptions} to prevent code duplication
|
||||
* while still maintaining a cleaner way for the user to utilize the method chaining with the generics
|
||||
* in place. You should not use this class directly, but instead use one of the base classes.
|
||||
*
|
||||
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.Configurable;
|
||||
|
||||
/**
|
||||
* A common base class for both {@link Dial} and {@link Pivot} to prevent code duplication
|
||||
* while still maintaining a cleaner way for the user to utilize the method chaining with the generics
|
||||
* in place. You should not use this class directly, but instead use one of the base classes.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public abstract class BaseGaugePart<T extends BaseGaugePart> extends Configurable<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "backgroundColor" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("backgroundColor", #CCCCCC)
|
||||
* </code></pre>
|
||||
* The background or fill color of the gauge's pivot. Defaults to black.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setBackgroundColor(org.moxieapps.gwt.highcharts.client.Color)}
|
||||
* version instead.
|
||||
* @param backgroundColor The value to set as the 'backgroundColor' option of the box plots.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining.
|
||||
*/
|
||||
public T setBackgroundColor(String backgroundColor) {
|
||||
return this.setOption("backgroundColor", backgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "backgroundColor" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("fillColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The background or fill color of the gauge's pivot. Defaults to black.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setBackgroundColor(String)} version instead.
|
||||
* @param backgroundColor The color gradient or color with an alpha channel to set as the 'backgroundColor' option of the box plot.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining
|
||||
*/
|
||||
public T setBackgroundColor(Color backgroundColor) {
|
||||
return this.setOption("backgroundColor", backgroundColor != null ? backgroundColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderColor" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("borderColor", #CCCCCC);
|
||||
* </code></pre>
|
||||
* The border color or stroke of the gauge's pivot. By default, the borderWidth is 0, so this must be set in addition to a custom border color. Defaults to silver.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setBorderColor(Color)}
|
||||
* version instead.
|
||||
* @param borderColor The value to set as the 'borderColor' option of the box plots.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining
|
||||
*/
|
||||
public T setBorderColor(String borderColor) {
|
||||
return this.setOption("borderColor", borderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderColor" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("fillColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The border color or stroke of the gauge's pivot. By default, the borderWidth is 0,
|
||||
* so this must be set in addition to a custom border color. Defaults to silver.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setBorderColor(String)} version instead.
|
||||
* @param borderColor The color gradient or color with an alpha channel to set as the 'borderColor' option of the box plot.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining
|
||||
*/
|
||||
public T setBorderColor(Color borderColor) {
|
||||
return this.setOption("borderColor", borderColor != null ? borderColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderWidth" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("borderWidth", 5);
|
||||
* </code></pre>
|
||||
* The width of the gauge pivot border in pixels. Defaults to 0.
|
||||
* @param borderWidth The width of the gauge pivot border in pixels.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining
|
||||
*/
|
||||
public T setBorderWidth(Number borderWidth) {
|
||||
return this.setOption("borderWidth", borderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "radius" option for a gauge's pivot. Equivalent to:
|
||||
* <pre><code>
|
||||
* pivotOptions.setOption("radius", "50%");
|
||||
* </code></pre>
|
||||
* The radius or length of the pivot, in percentages relative to the radius of the gauge itself. Defaults to 80%.
|
||||
* @param radius The radius of the pivot as a percentage of the radius of the gauge itself.
|
||||
* @return A reference to this {@link BaseGaugePart} for convenient method chaining
|
||||
*/
|
||||
public T setRadius(String radius) {
|
||||
return this.setOption("radius", radius);
|
||||
}
|
||||
}
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEventHandler;
|
||||
|
||||
/**
|
||||
* A common base class for both {@link FunnelPlotOptions} and {@link PiePlotOptions} to prevent code duplication
|
||||
* while still maintaining a cleaner way for the user to utilize the method chaining with the generics
|
||||
* in place. You should not use this class directly, but instead use one of the base classes.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public abstract class BaseProportionalPlotOptions<T extends BaseProportionalPlotOptions> extends PlotOptions<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderColor" option for the pie plot options to a RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("borderColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The color of the border surrounding each slice. Defaults to #FFFFFF.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setBorderColor(Color)}
|
||||
* version instead.
|
||||
* @param borderColor The value to set as the 'borderColor' option of the box plots.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @see #setBorderColor(Color)
|
||||
*/
|
||||
public T setBorderColor(String borderColor) {
|
||||
return this.setOption("borderColor", borderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'borderColor' option of the pie plot options, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("borderColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the border surrounding each slice. Defaults to #FFFFFF.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setBorderColor(String)} version instead.
|
||||
* @param borderColor The color gradient or color with an alpha channel to set as the 'borderColor' option of the box plot.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @see #setBorderColor(String)
|
||||
*/
|
||||
public T setBorderColor(Color borderColor) {
|
||||
return this.setOption("borderCcolor", borderColor != null ? borderColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "borderWidth" option for the pie plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOptions("borderWidth", 2);
|
||||
* </code></pre>
|
||||
* The width of the border surrounding each slice. Defaults to 1.
|
||||
* @param borderWidth The width of the border
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setBorderWidth(Number borderWidth) {
|
||||
return this.setOption("borderWidth", borderWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'center' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("center", new Number[] { 100, 120 });
|
||||
* </code></pre>
|
||||
* The center of the pie chart relative to the plot area (in pixels). See the
|
||||
* {@link #setCenter(double, double)} method to set the center using percentages instead.
|
||||
* Defaults to 50%, 50%.
|
||||
*
|
||||
* @param x The horizontal center of the pie chart relative to the plot area (in pixels)
|
||||
* @param y The vertical center of the pie chart relative to the plot area (in pixels)
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setCenter(int x, int y) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONNumber(x));
|
||||
center.set(1, new JSONNumber(y));
|
||||
return this.setOption("center", center);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'center' option of the pie plot options
|
||||
* to percentage values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("center", new String[] { "50%", "40%" });
|
||||
* </code></pre>
|
||||
* The center of the pie chart relative to the plot area (as a percentage). See the
|
||||
* {@link #setCenter(int, int)} method to set the center using pixels instead.
|
||||
* Defaults to 50%, 50%.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param xPercent The horizontal percent center of the pie chart relative to the plot area (0.0 to 1.0)
|
||||
* @param yPercent The vertical percent center of the pie chart relative to the plot area (0.0 to 1.0)
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setCenter(double xPercent, double yPercent) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONString(((Double) (xPercent * 100)).intValue() + "%"));
|
||||
center.set(1, new JSONString(((Double) (yPercent * 100)).intValue() + "%"));
|
||||
return this.setOption("center", center);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "ignoreHiddenPoint" option for the pie plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOptions("ignoreHiddenPoint", false);
|
||||
* </code></pre>
|
||||
* Equivalent to {@link org.moxieapps.gwt.highcharts.client.BaseChart#setIgnoreHiddenSeries(boolean)}, this option tells whether the series shall be redrawn as if the hidden point were null.
|
||||
* <p/>
|
||||
* The default value changed from false to true with Highcharts 3.0.
|
||||
* <p/>
|
||||
* Defaults to true.
|
||||
* @param ignoreHiddenPoint Whether to redraw the chart if a hidden point is null.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setIgnoreHiddenPoint(boolean ignoreHiddenPoint) {
|
||||
return this.setOption("ignoreHiddenPoint", ignoreHiddenPoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerSize' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("innerSize", 100);
|
||||
* </code></pre>
|
||||
* The size of the inner diameter for the pie. A size greater than 0 renders a donut chart.
|
||||
* {@link #setInnerSize(double)} method to set the innerSize using percentages instead.
|
||||
* Defaults to 0.
|
||||
*
|
||||
* @param innerSize The size of the inner diameter for the pie.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setInnerSize(int innerSize) {
|
||||
return this.setOption("innerSize", innerSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerSize' option of the pie plot options
|
||||
* to a percentage value. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("innerSize", "50%");
|
||||
* </code></pre>
|
||||
* The size of the inner diameter for the pie. A size greater than 0 renders a donut chart.
|
||||
* See the {@link #setInnerSize(int)} method to set the innerSize using pixels instead.
|
||||
* Defaults to 0.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param innerSize The percentage size of the inner diameter for the pie. (0.0 to 1.0)
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setInnerSize(double innerSize) {
|
||||
return this.setOption("innerSize", new JSONString(((Double) (innerSize * 100)).intValue() + "%"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "minSize" option for the pie plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOptions("minSize", true);
|
||||
* </code></pre>
|
||||
* The minimum size for a pie in response to auto margins. The pie will try to shrink to make room
|
||||
* for data labels in side the plot area, but only to this size. Defaults to 80.
|
||||
* @param minSize The minimum size for a pie in response to auto margins
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setMinSize(Number minSize) {
|
||||
return this.setOption("minSize", minSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'size' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("size", 100);
|
||||
* </code></pre>
|
||||
* The diameter of the pie relative to the plot area (in pixels). See the
|
||||
* {@link #setSize(double)} method to set the size using percentages instead.
|
||||
* Defaults to 75%.
|
||||
*
|
||||
* @param size The diameter of the pie relative to the plot area.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setSize(int size) {
|
||||
return this.setOption("size", size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'size' option of the pie plot options
|
||||
* to a percentage value. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("size", "50%");
|
||||
* </code></pre>
|
||||
* The diameter of the pie relative to the plot area (as a percentage). See the
|
||||
* {@link #setSize(int)} method to set the size using pixels instead.
|
||||
* Defaults to 75%.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param size The percent diameter of the pie relative to the plot area. (0.0 to 1.0)
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setSize(double size) {
|
||||
return this.setOption("size", new JSONString(((Double) (size * 100)).intValue() + "%"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "slicedOffset" option for the pie plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOptions("slicedOffset", 25);
|
||||
* </code></pre>
|
||||
* If a point is sliced, moved out from the center, how many pixels should it be moved?. Defaults to 10.
|
||||
* @param slicedOffset The number of pixels the point should be moved if it is sliced.
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setSlicedOffset(Number slicedOffset) {
|
||||
return this.setOption("slicedOffset", slicedOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "startAngle" option for the pie plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOptions("startAngle", 45);
|
||||
* </code></pre>
|
||||
* The start angle of the pie slices in degrees where 0 is top and 90 right. Defaults to 0.
|
||||
* @param startAngle The start angle of the pie slices in degrees where 0 is top and 90 right
|
||||
* @return A reference to this {@link BaseProportionalPlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setStartAngle(Number startAngle) {
|
||||
return this.setOption("startAngle", startAngle);
|
||||
}
|
||||
|
||||
private PointLegendItemClickEventHandler pointLegendItemClickEventHandler;
|
||||
|
||||
/**
|
||||
* Set a callback handler that will be invoked whenever the user clicks on the legend item points
|
||||
* in a pie or funnel series. Additional information about the click (such as the values of the point clicked) can be
|
||||
* found via the {@link org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEventHandler} instance
|
||||
* that is passed to the handler's {@link PointLegendItemClickEventHandler#onClick(org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEvent)} method.
|
||||
*
|
||||
* @param pointLegendItemClickEventHandler The handler that should be invoked whenever a legend item click event occurs.
|
||||
* @return A reference to this {@link org.moxieapps.gwt.highcharts.client.BaseChart} instance for convenient method chaining.
|
||||
*/
|
||||
public BaseProportionalPlotOptions setPointLegendItemClickEventHandler(PointLegendItemClickEventHandler pointLegendItemClickEventHandler) {
|
||||
this.pointLegendItemClickEventHandler = pointLegendItemClickEventHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the custom event handler that has been set on the plot options, or null if no event
|
||||
* handler has been set.
|
||||
*
|
||||
* @return The custom event handler that has been applied, or null if it has not been set.
|
||||
*/
|
||||
public PointLegendItemClickEventHandler getPointLegendItemClickEventHandler() {
|
||||
return this.pointLegendItemClickEventHandler;
|
||||
}
|
||||
}
|
||||
+255
@@ -0,0 +1,255 @@
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.PlotLine;
|
||||
|
||||
/**
|
||||
* A common base class for both {@link BoxPlotOptions} and {@link ErrorBarPlotOptions} to prevent code duplication
|
||||
* while still maintaining a cleaner way for the user to utilize the method chaining with the generics
|
||||
* in place. You should not use this class directly, but instead use one of the base classes.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public abstract class BaseStatisticalPlotOptions <T extends BaseStatisticalPlotOptions> extends BaseColumnPlotOptions<T> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the box plot options
|
||||
* to a RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("fillColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* Fill color or gradient for the area. When null, the series' color is used with the series' fillOpacity. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setFillColor(org.moxieapps.gwt.highcharts.client.Color)}
|
||||
* version instead.
|
||||
*
|
||||
* @param fillColor The value to set as the 'fillColor' option of the box plots.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setFillColor(String fillColor) {
|
||||
return this.setOption("fillColor", fillColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the box plot options, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("fillColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* Fill color or gradient for the area. When null, the series' color is used with the series' fillOpacity. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setFillColor(String)} version instead.
|
||||
*
|
||||
* @param fillColor The color gradient or color with an alpha channel to set as the 'fillColor' option of the box plot.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setFillColor(Color fillColor) {
|
||||
return this.setOption("fillColor", fillColor != null ? fillColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'medianColor' option of the box plot options
|
||||
* to a RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("medianColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The color of the median line. If null, the general series color applies. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setMedianColor(Color)}
|
||||
* version instead.
|
||||
* @param medianColor The value to set as the 'medianColor' option of the box plots.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setMedianColor(String medianColor) {
|
||||
return this.setOption("medianColor", medianColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'medianColor' option of the box plot options, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("medianColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the median line. If null, the general series color applies. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setMedianColor(String)} version instead.
|
||||
* @param medianColor The color gradient or color with an alpha channel to set as the 'medianColor' option of the box plot.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setMedianColor(Color medianColor) {
|
||||
return this.setOption("medianColor", medianColor != null ? medianColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'medianWidth' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("medianWidth", 4);
|
||||
* </code></pre>
|
||||
* The pixel width of the median line. If null, the lineWidth is used. Defaults to 2.
|
||||
* @param medianWidth The width in pixels of the median line.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setMedianWidth(Number medianWidth) {
|
||||
return this.setOption("medianWidth", medianWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'stemColor' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("stemColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The color of the stem, the vertical line extending from the box to the whiskers. If null, the series color is used. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setWhiskerColor(Color)}
|
||||
* version instead.
|
||||
* @param stemColor The value to set as the 'stemColor' option of the box plots.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setStemColor(String stemColor) {
|
||||
return this.setOption("setmColor", stemColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'stemColor' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("stemColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the stem, the vertical line extending from the box to the whiskers. If null, the series color is used. Defaults to null.
|
||||
* @param stemColor The color gradient or color with an alpha channel to set as the 'stemColor' option of the box plot.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setStemColor(Color stemColor) {
|
||||
return this.setOption("stemColor", stemColor != null ? stemColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'dashStyle' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("stemDashStyle", PlotOptions.DashStyle.DOT);
|
||||
* </code></pre>
|
||||
* The dash style of the stem, the vertical line extending from the box to the whiskers. Defaults to Solid.
|
||||
* @param stemDashStyle The dash style to use for this series, or null to use the default.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setStemDashStyle(PlotLine.DashStyle stemDashStyle) {
|
||||
return this.setOption("stemDashStyle", stemDashStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'dashStyle' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("stemDashWidth", 5);
|
||||
* </code></pre>
|
||||
* The width of the stem, the vertical line extending from the box to the whiskers. If null, the width is inherited from the lineWidth option. Defaults to null.
|
||||
* @param stemWidth The width in pixels to use for the stem width
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setStemWidth(Number stemWidth) {
|
||||
return this.setOption("stemWidth", stemWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'whiskerColor' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("whiskerColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The color of the whiskers, the horizontal lines marking low and high values. When null, the general series color is used. Defaults to null.
|
||||
* @param whiskerColor The value to set as the 'whiskerColor' option of the box plots.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWhiskerColor(String whiskerColor) {
|
||||
return this.setOption("whiskerColor", whiskerColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'whiskerColor' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("whiskerColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the whiskers, the horizontal lines marking low and high values. When null, the general series color is used. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setWhiskerColor(String)} version instead.
|
||||
* @param whiskerColor The color gradient or color with an alpha channel to set as the 'whiskerColor' option of the box plot.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWhiskerColor(Color whiskerColor) {
|
||||
return this.setOption("whiskerColor", whiskerColor != null ? whiskerColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'whiskerLength' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("whiskerLength", "25");
|
||||
* </code></pre>
|
||||
* The length of the whiskers, the horizontal lines marking low and high values.
|
||||
* It can be a numerical pixel value, or a percentage value of the box width.
|
||||
* Set 0 to disable whiskers. Defaults to 50%.
|
||||
* <p/>
|
||||
* Note: This method is for denoting the whisker length as a number of pixels. If you wish to set its length as a
|
||||
* percentage of the box width, use this {@link #setWhiskerLength(String)}.
|
||||
* @param whiskerLength The length, in pixels, of the whisker.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWhiskerLength(Number whiskerLength) {
|
||||
return this.setOption("whiskerLength", whiskerLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'whiskerColor' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("whiskerLength", "25%);
|
||||
* </code></pre>
|
||||
* The length of the whiskers, the horizontal lines marking low and high values.
|
||||
* It can be a numerical pixel value, or a percentage value of the box width.
|
||||
* Set 0 to disable whiskers. Defaults to 50%.
|
||||
* <p/>
|
||||
* Note: This method is for denoting the whisker length as a percentage of box width. If you wish to set its length as a
|
||||
* number of pixels, use this {@link #setWhiskerLength(Number)}.
|
||||
* @param whiskerLength The length, as a percentage, of the whisker.
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWhiskerLength(String whiskerLength) {
|
||||
return this.setOption("whiskerLength", whiskerLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'whiskerWidth' option of the box plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* boxPlotOptions.setOption("whiskerWidth", 25);
|
||||
* </code></pre>
|
||||
* The line width of the whiskers, the horizontal lines marking low and high values. When null, the general lineWidth applies. Defaults to null.
|
||||
* @param whiskerWidth
|
||||
* @return A reference to this {@link BoxPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public T setWhiskerWidth(Number whiskerWidth) {
|
||||
return this.setOption("whiskerWidth", whiskerWidth);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.PlotLine;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all box type series, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.Chart#setBoxPlotOptions(BoxPlotOptions)} )} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all box type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of a box type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all box type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class BoxPlotOptions extends BaseStatisticalPlotOptions<BoxPlotOptions> {
|
||||
|
||||
// Everything we need is inherited from our base class, so this class is really only needed to
|
||||
// handle setting the correct generic type (so the user doesn't need to deal with the type manually)
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.Series;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all bubble type series, which can be set either generically
|
||||
* on the chart via the {@link Chart#setBubblePlotOptions(BubblePlotOptions)} )} method or directly on a
|
||||
* series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all bar type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of a bar type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all bar type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class BubblePlotOptions extends PlotOptions<BubblePlotOptions>{
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "displayNegative" option for the bubble plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* bubblePlotOptions.setOptions("displayNegative", true);
|
||||
* </code></pre>
|
||||
* Whether to display negative sized bubbles. The threshold is given by the zThreshold option,
|
||||
* and negative bubbles can be visualized by setting negativeColor. Defaults to true.
|
||||
* @param displayNegative 'true' to display negative-sized bubbles
|
||||
* @return A reference to this {@link BubblePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public BubblePlotOptions setDisplayNegative(boolean displayNegative) {
|
||||
return this.setOption("displayNegative", displayNegative);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "zThreshold" option for the bubble plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* bubblePlotOptions.setOptions("zThreshold", 0);
|
||||
* </code></pre>
|
||||
* When displayNegative is false, bubbles with lower Z values are skipped.
|
||||
* When displayNegative is true and a negativeColor is given, points with lower Z is colored. Defaults to 0.
|
||||
* @param zThreshold The minimum z-value for a point to be shown in a bubble plot
|
||||
* @return A reference to this {@link BubblePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public BubblePlotOptions setZThreshold(Number zThreshold) {
|
||||
return this.setOption("zThreshold", zThreshold);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all Candlestick type series, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.StockChart#setCandlestickPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.CandlestickPlotOptions)} )} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that Candlestick series types are only available when using the {@link org.moxieapps.gwt.highcharts.client.StockChart} widget.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all Candlestick type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of an Candlestick type), then you can use the {@link org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all Candlestick type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions)} method.
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class CandlestickPlotOptions extends PlotOptions<CandlestickPlotOptions>{
|
||||
/**
|
||||
* Convenience method for setting the 'grouping' option for the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* candlestickPlotOptions.setOption("grouping", false);
|
||||
* </code></pre>
|
||||
* Whether to group non-stacked columns or to let them render independent of each other.
|
||||
* Non-grouped columns will be laid out individually and overlap each other. Defaults to true.
|
||||
* @param grouping False to disable grouping of columns
|
||||
* @return A reference to this {@link CandlestickPlotOptions} for convenient method chaining.
|
||||
*/
|
||||
public CandlestickPlotOptions setGrouping(boolean grouping) {
|
||||
return this.setOption("grouping", grouping);
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
File mode changed.
+280
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
import org.moxieapps.gwt.highcharts.client.Configurable;
|
||||
import org.moxieapps.gwt.highcharts.client.DateTimeLabelFormats;
|
||||
|
||||
|
||||
/**
|
||||
* A configurable class to set the options for the data grouping of the plot. Sample usage:
|
||||
* chart.setPlotOptions(
|
||||
* new plotOptions()
|
||||
* .setDataGrouping(
|
||||
* .newDataGrouping()
|
||||
* .setEnabled(true)
|
||||
* .setGroupPixelWidth(10)
|
||||
* )
|
||||
* );
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class DataGrouping extends Configurable<DataGrouping> {
|
||||
|
||||
public enum Approximation {
|
||||
AVERAGE("average"),
|
||||
|
||||
OPEN("open"),
|
||||
|
||||
HIGH("high"),
|
||||
|
||||
LOW("low"),
|
||||
|
||||
CLOSE("close");
|
||||
|
||||
private Approximation(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic class to support DataGrouping. This class should not be instantiated on its own, but as a parameter
|
||||
* of {@link DataGrouping#setUnits(DataGrouping.Unit...)}
|
||||
* </p>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setPlotoptions(
|
||||
* new PlotOptions()
|
||||
* .setDataGrouping(
|
||||
* new DataGrouping()
|
||||
* .setUnits(
|
||||
* new Unit("week", 1),
|
||||
* new Unit("month", 1, 2, 3, 4, 6)
|
||||
* )
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public static class Unit extends JSONArray {
|
||||
|
||||
/**
|
||||
* Constructor for the Unit class. One should use only this constructor and not the default Unit().
|
||||
* </p>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* new Unit("millisecond", 1, 2, 5, 10, 20, 25, 50, 100, 200, 500)
|
||||
* </code></pre>
|
||||
* </p>
|
||||
* This will produce the following:
|
||||
* <pre><code>
|
||||
* [['millisecond', // unit name
|
||||
* [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]] // allowed multiples
|
||||
* </code></pre>
|
||||
* @param unitName The Name of the unit for which you wish to set intervals.
|
||||
* @param intervals The intervals that the data is allowed to be grouped in
|
||||
* @see org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping#setUnits(org.moxieapps.gwt.highcharts.client.plotOptions.DataGrouping.Unit...)
|
||||
*/
|
||||
public Unit(String unitName, Number... intervals) {
|
||||
|
||||
final JSONArray intervalArray = new JSONArray();
|
||||
for (int i = 0; i < intervals.length; i++) {
|
||||
intervalArray.set(i, new JSONNumber(intervals[i].doubleValue()));
|
||||
}
|
||||
|
||||
this.set(0, new JSONString(unitName));
|
||||
this.set(1, intervalArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "approximation" option for the data grouping of the plot. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("approximation", "high");
|
||||
* </code></pre>
|
||||
* The method of approximation inside a group. When for example 30 days are grouped into one month, this determines
|
||||
* what value should represent the group. Possible values are "average", "open", "high", "low", "close" and "sum".
|
||||
* For OHLC and candlestick series the approximation is "ohlc" by default, which finds the open, high, low and close
|
||||
* values within all the grouped data. For ranges, the approximation is "range", which finds the low and high values.
|
||||
* <p/>
|
||||
* Defaults to average for line-type series, sum for columns, range for range series and ohlc for OHLC and candlestick.
|
||||
* @param approximation The approximation type to use for the grouping.
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setApproximation(Approximation approximation) {
|
||||
return approximation != null ? this.setOption("approximation", approximation.toString()) : null;
|
||||
}
|
||||
|
||||
// TODO: Add support for an approximation call back function to be provided
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'dateTimeLabelFormats' options of the dataGrouping. Equivalent to code like:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("/dateTimeLabelFormats/second", "%H:%M:%S");
|
||||
* dataGrouping.setOption("/dateTimeLabelFormats/minute", "%H:%M");
|
||||
* </code></pre>
|
||||
* For each of these array definitions, the first item is the format used when the active time span is one unit.
|
||||
* For instance, if the current data applies to one week, the first item of the week array is used. The second
|
||||
* and third items are used when the active time span is more than two units. For instance, if the current data
|
||||
* applies to two weeks, the second and third item of the week array are used, and applied to the start and end
|
||||
* date of the time span. Defaults to:
|
||||
* <ul>
|
||||
* <li>millisecond: ['%A, %b %e, %H:%M:%S.%L', '%A, %b %e, %H:%M:%S.%L', '-%H:%M:%S.%L']</li>
|
||||
* <li>second: ['%A, %b %e, %H:%M:%S', '%A, %b %e, %H:%M:%S', '-%H:%M:%S']</li>
|
||||
* <li>minute: ['%A, %b %e, %H:%M', '%A, %b %e, %H:%M', '-%H:%M']</li>
|
||||
* <li>hour: ['%A, %b %e, %H:%M', '%A, %b %e, %H:%M', '-%H:%M']</li>
|
||||
* <li>day: ['%A, %b %e, %Y', '%A, %b %e', '-%A, %b %e, %Y']</li>
|
||||
* <li>week: ['Week from %A, %b %e, %Y', '%A, %b %e', '-%A, %b %e, %Y']</li>
|
||||
* <li>month: ['%B %Y', '%B', '-%B %Y']</li>
|
||||
* <li>year: ['%Y', '%Y', '-%Y']</li>
|
||||
* </ul>
|
||||
* Example usage:
|
||||
* <code><pre>
|
||||
* axis.setDateTimeLabelFormats(
|
||||
* new DateTimeLabelFormats()
|
||||
* .setHour("%A, %b %e, %H:%M", "%A, %b %e, %H:%M", "-%H:%M")
|
||||
* .setMinute("%A, %b %e, %H:%M", "%A, %b %e, %H:%M", "-%H:%M")
|
||||
* );
|
||||
* </pre></code>
|
||||
* Note that for the DataGrouping instance of DateTimeLabelFormats, one should use the setter methods which
|
||||
* take multiple strings as a parameter, and not the ones with a single string parameter.
|
||||
* @see DateTimeLabelFormats
|
||||
* @param dateTimeLabelFormats The formats to use for time series information on this axis.
|
||||
* @return A reference to this {@link DataGrouping} instance for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats) {
|
||||
return this.setOption("dateTimeLabelFormats", dateTimeLabelFormats != null ? dateTimeLabelFormats.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "enabled" option for the data grouping of the plot. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("enabled", false);
|
||||
* </code></pre>
|
||||
* Enable or disable data grouping. Defaults to true. Defaults to true.
|
||||
* @param enabled Whether to enable data grouping.
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setEnabled(boolean enabled) {
|
||||
return this.setOption("enabled", enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "forced" option for the data grouping of the plot. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("forced", true);
|
||||
* </code></pre>
|
||||
* When data grouping is forced, it runs no matter how small the intervals are. This can be handy for example,
|
||||
* when the sum should be calculated for values appearing at random times within each hour. Defaults to false.
|
||||
* @param forced Whether to force data grouping.
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setForced(boolean forced) {
|
||||
return this.setOption("forced", forced);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "groupPixelWidth" option for the data grouping of the plot. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("groupPixelWidth", 10);
|
||||
* </code></pre>
|
||||
* The approximate pixel width of each group. If for example a series with 30 points is displayed over a 600 pixel
|
||||
* wide plot area, no grouping is performed. If however the series contains so many points that the spacing is less
|
||||
* than the groupPixelWidth, Highcharts will try to group it into appropriate groups so that each is more or less
|
||||
* two pixels wide. If multiple series with different group pixel widths are drawn on the same x axis, all series
|
||||
* will take the greatest width. For example, line series have 2px default group width, while column series have 10px.
|
||||
* If combined, both the line and the column will have 10px by default. Defaults to 2.
|
||||
* @param groupPixelWidth The width of area in which to group points.
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setGroupPixelWidth(Number groupPixelWidth) {
|
||||
return this.setOption("groupPixelWidth", groupPixelWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "smoothed" option for the data grouping of the plot. Equivalent to:
|
||||
* <pre><code>
|
||||
* dataGrouping.setOption("smoothed", true);
|
||||
* </code></pre>
|
||||
* Normally, a group is indexed by the start of that group, so for example when 30 daily values are grouped into
|
||||
* one month, that month's x value will be the 1st of the month. This apparently shifts the data to the left.
|
||||
* When the smoothed option is true, this is compensated for. The data is shifted to the middle of the group,
|
||||
* and min and max values are preserved. Internally, this is used in the Navigator series. Defaults to false.
|
||||
* Defaults to false.
|
||||
* @param smoothed Whether to smooth the data when it is shifted due to grouping.
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setSmoothed(boolean smoothed) {
|
||||
return this.setOption("smoothed", smoothed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "units" option for the data grouping of the plot. Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setDataGrouping(
|
||||
* new DataGrouping()
|
||||
* .setUnits(
|
||||
* new Unit("minute", {1, 2, 5, 10, 15, 30}),
|
||||
* new Unit("hour", {1, 2, 3, 4, 6, 8})
|
||||
* )
|
||||
* );
|
||||
*
|
||||
* </code></pre>
|
||||
* An array determining what time intervals the data is allowed to be grouped to.
|
||||
* Each array item is an array where the first value is the time unit and the second value another array of allowed multiples.
|
||||
* <p/>
|
||||
* Defaults to:
|
||||
* <pre>
|
||||
* units: [
|
||||
* ['millisecond', // unit name
|
||||
* [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples
|
||||
* ], ['second',
|
||||
* [1, 2, 5, 10, 15, 30]
|
||||
* ], ['minute',
|
||||
* [1, 2, 5, 10, 15, 30]
|
||||
* ], ['hour',
|
||||
* [1, 2, 3, 4, 6, 8, 12]
|
||||
* ], ['day',
|
||||
* [1]
|
||||
* ], ['week',
|
||||
* [1]
|
||||
* ], ['month',
|
||||
* [1, 3, 6]
|
||||
* ], ['year',
|
||||
* null
|
||||
* ]]
|
||||
* </pre>
|
||||
* * @param units
|
||||
* @return A reference to this {@link DataGrouping} for convenient method chaining.
|
||||
*/
|
||||
public DataGrouping setUnits(Unit... units) {
|
||||
return this.setOption("units", units);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
/**
|
||||
* Represents the general dial options available for for the gauge's dial, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.Chart#setGaugePlotOptions(GaugePlotOptions)} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* Chart.setGaugePlotOptions(
|
||||
* new GaugePlotOptions()
|
||||
* .setDialOptions(
|
||||
* new Dial()
|
||||
* .setBaseLength("75%")
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskoworn@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class Dial extends BaseGaugePart<Dial> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "baseLength" option for a gauge's dial. Equivalent to:
|
||||
* <pre><code>
|
||||
* dial.setOption("baseLength", "75%");
|
||||
* </code></pre>
|
||||
* The length of the dial's base part, relative to the total radius or length of the dial. Defaults to 70%.
|
||||
* @param baseLength The length of the base of the dial as a percentage of its radius.
|
||||
* @return A reference to this {@link Dial} for convenient method chaining.
|
||||
*/
|
||||
public Dial setBaseLength(String baseLength) {
|
||||
return this.setOption("baseLength", baseLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "baseWidth" option for a gauge's dial. Equivalent to:
|
||||
* <pre><code>
|
||||
* dial.setOption("baseWidth", 5)
|
||||
* </code></pre>
|
||||
* The pixel width of the base of the gauge dial. The base is the part closest to the pivot, defined by baseLength. Defaults to 3.
|
||||
* @param baseWidth The width, in pixels, of the dial.
|
||||
* @return A reference to this {@link Dial} for convenient method chaining.
|
||||
*/
|
||||
public Dial setBaseWidth(Number baseWidth) {
|
||||
return this.setOption("baseWidth", baseWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "rearLength" option for a gauge's dial. Equivalent to:
|
||||
* <pre><code>
|
||||
* dial.setOption("rearLength", "15%");
|
||||
* </code></pre>
|
||||
* The length of the dial's rear end, the part that extends out on the other side of the pivot. Relative to the dial's length. Defaults to 10%.
|
||||
* @param rearLength The length of the rear end of the dial as a percentage of the radius.
|
||||
* @return A reference to this {@link Dial} for convenient method chaining.
|
||||
*/
|
||||
public Dial setRearLength(String rearLength) {
|
||||
return this.setOption("rearLength", rearLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "topLength" option for a gauge's dial. Equivalent to:
|
||||
* <pre><code>
|
||||
* dial.setOption("topLength", 2);
|
||||
* </code></pre>
|
||||
* The width of the top of the dial, closest to the perimeter. The pivot narrows in from the base to the top. Defaults to 1.
|
||||
* @param topWidth The width, in pixels, of the tip of the dial.
|
||||
* @return A reference to this {@link Dial} for convenient method chaining.
|
||||
*/
|
||||
public Dial setTopWidth(Number topWidth) {
|
||||
return this.setOption("topWidth", topWidth);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Series;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all error bar type series, which can be set either generically
|
||||
* on the chart via the {@link Chart#setErrorBarPlotOptions(ErrorBarPlotOptions)} )} method or directly on a
|
||||
* series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all error bar type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of an error bar type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all error bar type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
|
||||
public class ErrorBarPlotOptions extends BaseStatisticalPlotOptions<ErrorBarPlotOptions> {
|
||||
|
||||
// Everything we need is inherited from our base class, so this class is really only needed to
|
||||
// handle setting the correct generic type (so the user doesn't need to deal with the type manually)
|
||||
|
||||
}
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
import org.moxieapps.gwt.highcharts.client.Style;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the options for the Flags present on the chart. The plot options for this class are to be instantiated
|
||||
* into a {@link org.moxieapps.gwt.highcharts.client.Series}. Example usage:
|
||||
* <pre><code>
|
||||
* chart.addSeries(
|
||||
* chart.createSeries()
|
||||
* .setType(Series.FLAGS)
|
||||
* .addPoint(t(2011), 5, 10)
|
||||
* .setPlotOptions(
|
||||
* new FlagPlotOptions()
|
||||
* .setOnSeries("data")
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class FlagPlotOptions extends PlotOptions<FlagPlotOptions> {
|
||||
|
||||
/**
|
||||
* An enumeration representing the shape of the flag. Possible options are FLAG, CIRCLE_PIN, or SQUARE_PIN.
|
||||
*/
|
||||
public enum Shape {
|
||||
/**
|
||||
* represent the flag as a flag
|
||||
*/
|
||||
FLAG("flag"),
|
||||
|
||||
/**
|
||||
* Represent the flag as a circle pin.
|
||||
*/
|
||||
CIRCLE_PIN("circlepin"),
|
||||
|
||||
/**
|
||||
* Represent the flag as a square pin.
|
||||
*/
|
||||
SQUARE_PIN("squarepin");
|
||||
|
||||
private Shape(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the flag to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("lineColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The RGB color of the flag. Defaults to "#4572A7".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setFillColor(Color)}
|
||||
* version instead.
|
||||
*
|
||||
* @param fillColor The value to set as the 'lineColor' option on the chart.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
* @see FlagPlotOptions#setFillColor(Color)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public FlagPlotOptions setFillColor(String fillColor) {
|
||||
return this.setOption("fillColor", fillColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'fillColor' option of the flag, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("lineColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the flag. Defaults to "#4572A7".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setFillColor(String)} version instead.
|
||||
*
|
||||
* @param fillColor The color gradient or color with an alpha channel to set as the 'borderColor' option on the chart.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setFillColor(Color fillColor) {
|
||||
return this.setOption("fillColor", fillColor != null ? fillColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'lineColor' option of the flag to an RGB hex value. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("lineColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* The RGB color of the outer chart border. The border is painted using vector graphic techniques to allow
|
||||
* rounded corners. Defaults to "#4572A7".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setLineColor(Color)}
|
||||
* version instead.
|
||||
*
|
||||
* @param lineColor The value to set as the 'lineColor' option on the chart.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
* @see FlagPlotOptions#setLineColor(Color)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public FlagPlotOptions setLineColor(String lineColor) {
|
||||
return this.setOption("lineColor", lineColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'lineColor' option of the flag, allowing for
|
||||
* colors with opacity or gradients. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("lineColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The color of the flag's line. Defaults to "#4572A7".
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setLineColor(String)} version instead.
|
||||
*
|
||||
* @param lineColor The color gradient or color with an alpha channel to set as the 'borderColor' option on the chart.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setLineColor(Color lineColor) {
|
||||
return this.setOption("lineColor", lineColor != null ? lineColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'onSeries' option of the flag. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("onSeries", "seriesName")
|
||||
* </code></pre>
|
||||
* Attaches flags to the given series. If no id is given, the flags are drawn on the x axis. Defaults to undefined. Defaults to undefined.
|
||||
* @param onSeries The id of the series that the flags should be drawn on
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setOnSeries(String onSeries) {
|
||||
return this.setOption("onSeries", onSeries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'shape' option of the flag. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("shape", "flag");
|
||||
* </code></pre>
|
||||
* Sets the shape of the flag. Can be one of "circlepin", "squarepin", or "flag". Defaults to "flag".
|
||||
* @param shape The shape of the marker.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setShape(Shape shape) {
|
||||
return this.setOption("shape", shape != null ? shape : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'style' options of the flag. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("/style/fontWeight", "bold");
|
||||
* series.setOption("/style/fontFamily", "serif");
|
||||
* etc.
|
||||
* </code></pre>
|
||||
* CSS styles for the flag. When titles are rotated they are rendered using vector graphic techniques
|
||||
* and not all styles are applicable. Most noteworthy, a bug in IE8 renders all rotated strings bold
|
||||
* and italic. Defaults to:
|
||||
* <ul>
|
||||
* <li>color: '#6D869F'</li>
|
||||
* <li>fontWeight: 'bold'</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param style CSS styles for the axis title.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setStyle(Style style) {
|
||||
return this.setOption("style", style != null ? style.getOptions() : null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'width' option of the flag. Equivalent to:
|
||||
* <pre><code>
|
||||
* series.setOption("width", 10);
|
||||
* </code></pre>
|
||||
* Manually sets the width of the flag.
|
||||
* @param width The width of the flag.
|
||||
* @return A reference to this {@link FlagPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FlagPlotOptions setWidth(Number width) {
|
||||
return this.setOption("width", width);
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Series;
|
||||
import org.moxieapps.gwt.highcharts.client.labels.FunnelDataLabels;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all funnel type series, which can be set either generically
|
||||
* on the chart via the {@link Chart#setFunnelPlotOptions(FunnelPlotOptions)} )} method or directly on a
|
||||
* series via the {@link Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all funnel type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of a funnel type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all column type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class FunnelPlotOptions extends BaseProportionalPlotOptions<FunnelPlotOptions>{
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'dataLabels' plot option to a configuration object
|
||||
* that is more specific to funnel charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOption("/dataLabels/connectorWidth", 2.0);
|
||||
* funnelPlotOptions.setOption("/dataLabels/connectorPadding", 5.0);
|
||||
* etc...
|
||||
* </code></pre>
|
||||
* Defines the appearance of the data labels of the pie, which are the static labels for each point.
|
||||
* @param funnelDataLabels The configuration of how the pie's data labels should appear.
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setFunnelDataLabels(FunnelDataLabels funnelDataLabels) {
|
||||
return super.setBaseDataLabels(funnelDataLabels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "height" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("height", 4.0);
|
||||
* </code></pre>
|
||||
* The height of the neck, the lower part of a funnel. If it is a number it defines the pixel height,
|
||||
* if it is a percentage string it is the percentage of the plot area height.
|
||||
* @param height The height, in pixels, of the neck.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setNeckHeight(Number height) {
|
||||
return this.setOption("neckHeight", height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "height" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("height", "5%");
|
||||
* </code></pre>
|
||||
* The height of the neck, the lower part of a funnel. If it is a number it defines the pixel height,
|
||||
* if it is a percentage string it is the percentage of the plot area height.
|
||||
* @param neckHeight The height of the neck, as a percentage of the plot area height.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setNeckHeight(String neckHeight) {
|
||||
return this.setOption("neckHeight", neckHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "neckWidth" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("neckWidth", 3.0);
|
||||
* </code></pre>
|
||||
* The width of the neck, the lower part of the funnel. A number defines pixel width, a percentage string defines a percentage of the plot area width.
|
||||
* @param neckWidth The width, in pixels, of the neck.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setNeckWidth(Number neckWidth) {
|
||||
return this.setOption("neckWidth", neckWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "neckWidth" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("neckWidth", "10%");
|
||||
* </code></pre>
|
||||
* The width of the neck, the lower part of the funnel. A number defines pixel width, a percentage string defines a percentage of the plot area width.
|
||||
* @param neckWidth The width of the neck as a percentage of the plot width.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setNeckWidth(String neckWidth) {
|
||||
return this.setOption("neckWidth", neckWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "width" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("width", 50);
|
||||
* </code></pre>
|
||||
* The width of the funnel compared to the width of the plot area, or the pixel width if it is a number. Defaults to 90%.
|
||||
* @param width The width, in pixels, of the funnel.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setWidth(Number width) {
|
||||
return this.setOption("width", width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "width" option for the funnel plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* funnelPlotOptions.setOptions("width", "50%");
|
||||
* </code></pre>
|
||||
* The width of the funnel compared to the width of the plot area, or the pixel width if it is a number. Defaults to 90%.
|
||||
* @param width The width of the funnel as a percentage of the plot width.
|
||||
* @return A reference to this {@link FunnelPlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public FunnelPlotOptions setWidth(String width) {
|
||||
return this.setOption("width", width);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all gauge type series, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.Chart#setGaugePlotOptions(GaugePlotOptions)} )} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all gauge type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of a gauge type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all gauge type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class GaugePlotOptions extends PlotOptions<GaugePlotOptions> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "dial" option for gauge charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* gaugePlotOptions.setOption("wrap", false)
|
||||
* </code></pre>
|
||||
* <pre><code>
|
||||
* chart.setGaugePlotOptions(new GaugePlotOptions()
|
||||
* .setPivotOptions(new Dial()
|
||||
* .setRadius(10)
|
||||
* .setBorderWidth(1)
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param dial An instance of the Dial class which can be used to set the various dial options for the gauge.
|
||||
* @return A reference to this {@link GaugePlotOptions} for convenient method chaining.
|
||||
*/
|
||||
public GaugePlotOptions setDialOptions(Dial dial) {
|
||||
return this.setOption("dial", dial);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "pivot" option for gauge charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* gaugePlotOptions.setOption("/pivot/radius", "50%");
|
||||
* </code></pre>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* chart.setGaugePlotOptions(new GaugePlotOptions()
|
||||
* .setDialOptions(new Dial()
|
||||
* .setRadius("50%")
|
||||
* .setBaseWidth(10)
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param pivot An instance of the Pivot class which can be used to set various options pivot options for the gauge.
|
||||
* @return A reference to this {@link GaugePlotOptions} for convenient method chaining.
|
||||
*/
|
||||
public GaugePlotOptions setPivotOptions(Pivot pivot) {
|
||||
return this.setOption("pivot", pivot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "wrap" option for gauge charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* gaugePlotOptions.setOption("wrap", false)
|
||||
* </code></pre>
|
||||
* When this option is true, the dial will wrap around the axes.
|
||||
* For instance, in a full-range gauge going from 0 to 360, a value of 400 will point to 40.
|
||||
* When wrap is false, the dial stops at 360. Defaults to true
|
||||
* @param wrap Whether the dial will wrap around its maximum value.
|
||||
* @return A reference to this {@link GaugePlotOptions} for convenient method chaining.
|
||||
*/
|
||||
public GaugePlotOptions setWrap(boolean wrap) {
|
||||
return this.setOption("wrap", wrap);
|
||||
}
|
||||
}
|
||||
+57
-1
@@ -35,6 +35,62 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
*/
|
||||
public class LinePlotOptions extends PlotOptions<LinePlotOptions> {
|
||||
|
||||
// TODO:
|
||||
public enum Compare {
|
||||
|
||||
/**
|
||||
* Compare the lines based on the percentage difference in the two series
|
||||
*/
|
||||
PERCENT("percent"),
|
||||
|
||||
/**
|
||||
* Compare the lines based on the absolute difference in the two series
|
||||
*/
|
||||
VALUE("value");
|
||||
|
||||
private Compare(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'compare' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* linePlotOptions.setOption("compare", "percent");
|
||||
* </code></pre>
|
||||
* Compare the values of the series against the first value in the visible range.
|
||||
* The y axis will show percentage or absolute change depending on whether compare is set to
|
||||
* "percent" or "value". When this is applied to multiple series, it allows comparing the development
|
||||
* of the series against each other. Defaults to undefined.
|
||||
*
|
||||
* @param compare The type of comparison between data sets. Can be Compare.PERCENT, or Compare.Value
|
||||
* @return A reference to {@link LinePlotOptions} for convenient method chaining.
|
||||
*/
|
||||
public LinePlotOptions setCompare(Compare compare) {
|
||||
return this.setOption("compare", compare != null ? compare.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience Method for setting the "gapSize" option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* linePlotOptions.setOption("gapSize", 5);
|
||||
* </code></pre>
|
||||
* Defines when to display a gap in the graph. A gap size of 5 means that if the distance between two points is
|
||||
* greater than five times that of the two closest points, the graph will be broken.In practice, this option is
|
||||
* most often used to visualize gaps in time series. In a stock chart, intraday data is available for daytime hours,
|
||||
* while gaps will appear in nights and weekends.. Defaults to 0.
|
||||
*
|
||||
* @param gapSize The distance between points needed to display a gap in the series.
|
||||
* @return A reference to this {@link LinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public LinePlotOptions setGapSize(Number gapSize) {
|
||||
return this.setOption("gapSize", gapSize);
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -264,4 +264,29 @@ public class Marker extends Configurable<Marker> {
|
||||
return this.setOption("symbol", symbol != null ? symbol.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'symbol' option for markers to a URL. Equivalent to:
|
||||
* <pre><code>
|
||||
* marker.setOption("symbol", "url('http://highcharts.com/demo/gfx/sun.png')");
|
||||
* </code></pre>
|
||||
* Sets the marker to use a custom symbol from a url. Note that only the url itself
|
||||
* is needed to be passed as a parameter. Sample usage:
|
||||
* <pre><code>
|
||||
* chart.addSeries(
|
||||
* chart.createSeries()
|
||||
* .addPoint(
|
||||
* new Point(216.4)
|
||||
* .setMarker(
|
||||
* new Marker()
|
||||
* .setSymbol("http://highcharts.com/demo/gfx/sun.png")
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param symbolURL the url of the symbol to use for the marker.
|
||||
* @return A reference to this {@link Marker} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public Marker setSymbol(String symbolURL) {
|
||||
return this.setOption("symbol", "url(" + symbolURL + ")");
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+14
-1
@@ -34,7 +34,20 @@ package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
*/
|
||||
public class OHLCPlotOptions extends PlotOptions<OHLCPlotOptions> {
|
||||
|
||||
// TODO:
|
||||
/**
|
||||
* Convenience method for setting the 'grouping' option for the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* OHLCPlotOptions.setOption("grouping", false);
|
||||
* </code></pre>
|
||||
* Whether to group non-stacked columns or to let them render independent of each other.
|
||||
* Non-grouped columns will be laid out individually and overlap each other. Defaults to true.
|
||||
* @param grouping False to disable grouping of columns
|
||||
* @return A reference to this {@link OHLCPlotOptions} for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public OHLCPlotOptions setGrouping(boolean grouping) {
|
||||
return this.setOption("grouping", grouping);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-128
@@ -16,9 +16,7 @@
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Series;
|
||||
import org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEventHandler;
|
||||
@@ -38,18 +36,18 @@ import org.moxieapps.gwt.highcharts.client.labels.PieDataLabels;
|
||||
* @author squinn@moxiegroup.com (Shawn Quinn)
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class PiePlotOptions extends PlotOptions<PiePlotOptions> {
|
||||
public class PiePlotOptions extends BaseProportionalPlotOptions<PiePlotOptions> {
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'dataLabels' plot option to a configuration object
|
||||
* that is more specific to pie charts. Equivalent to:
|
||||
* that is more specific to pie charts. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("/dataLabels/connectorWidth", 2.0);
|
||||
* piePlotOptions.setOption("/dataLabels/connectorPadding", 5.0);
|
||||
* etc...
|
||||
* </code></pre>
|
||||
* Defines the appearance of the data labels of the pie, which are the static labels for each point.
|
||||
*
|
||||
* @param pieDataLabels The configuration of how the pie's data labels should appear.
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
@@ -57,88 +55,6 @@ public class PiePlotOptions extends PlotOptions<PiePlotOptions> {
|
||||
return super.setBaseDataLabels(pieDataLabels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'center' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("center", new Number[] { 100, 120 });
|
||||
* </code></pre>
|
||||
* The center of the pie chart relative to the plot area (in pixels). See the
|
||||
* {@link #setCenter(double, double)} method to set the center using percentages instead.
|
||||
* Defaults to 50%, 50%.
|
||||
*
|
||||
* @param x The horizontal center of the pie chart relative to the plot area (in pixels)
|
||||
* @param y The vertical center of the pie chart relative to the plot area (in pixels)
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setCenter(int x, int y) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONNumber(x));
|
||||
center.set(1, new JSONNumber(y));
|
||||
return this.setOption("center", center);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'center' option of the pie plot options
|
||||
* to percentage values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("center", new String[] { "50%", "40%" });
|
||||
* </code></pre>
|
||||
* The center of the pie chart relative to the plot area (as a percentage). See the
|
||||
* {@link #setCenter(int, int)} method to set the center using pixels instead.
|
||||
* Defaults to 50%, 50%.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param xPercent The horizontal percent center of the pie chart relative to the plot area (0.0 to 1.0)
|
||||
* @param yPercent The vertical percent center of the pie chart relative to the plot area (0.0 to 1.0)
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setCenter(double xPercent, double yPercent) {
|
||||
JSONArray center = new JSONArray();
|
||||
center.set(0, new JSONString(((Double) (xPercent * 100)).intValue() + "%"));
|
||||
center.set(1, new JSONString(((Double) (yPercent * 100)).intValue() + "%"));
|
||||
return this.setOption("center", center);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerSize' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("innerSize", 100);
|
||||
* </code></pre>
|
||||
* The size of the inner diameter for the pie. A size greater than 0 renders a donut chart.
|
||||
* {@link #setInnerSize(double)} method to set the innerSize using percentages instead.
|
||||
* Defaults to 0.
|
||||
*
|
||||
* @param innerSize The size of the inner diameter for the pie.
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setInnerSize(int innerSize) {
|
||||
return this.setOption("innerSize", innerSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'innerSize' option of the pie plot options
|
||||
* to a percentage value. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("innerSize", "50%");
|
||||
* </code></pre>
|
||||
* The size of the inner diameter for the pie. A size greater than 0 renders a donut chart.
|
||||
* See the {@link #setInnerSize(int)} method to set the innerSize using pixels instead.
|
||||
* Defaults to 0.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param innerSize The percentage size of the inner diameter for the pie. (0.0 to 1.0)
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setInnerSize(double innerSize) {
|
||||
return this.setOption("innerSize", new JSONString(((Double) (innerSize * 100)).intValue() + "%"));
|
||||
}
|
||||
|
||||
private PointLegendItemClickEventHandler pointLegendItemClickEventHandler;
|
||||
|
||||
/**
|
||||
@@ -168,45 +84,5 @@ public class PiePlotOptions extends PlotOptions<PiePlotOptions> {
|
||||
public PointLegendItemClickEventHandler getPointLegendItemClickEventHandler() {
|
||||
return this.pointLegendItemClickEventHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'size' option of the pie plot options
|
||||
* to pixel values. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("size", 100);
|
||||
* </code></pre>
|
||||
* The diameter of the pie relative to the plot area (in pixels). See the
|
||||
* {@link #setSize(double)} method to set the size using percentages instead.
|
||||
* Defaults to 75%.
|
||||
*
|
||||
* @param size The diameter of the pie relative to the plot area.
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setSize(int size) {
|
||||
return this.setOption("size", size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'size' option of the pie plot options
|
||||
* to a percentage value. Equivalent to:
|
||||
* <pre><code>
|
||||
* piePlotOptions.setOption("size", "50%");
|
||||
* </code></pre>
|
||||
* The diameter of the pie relative to the plot area (as a percentage). See the
|
||||
* {@link #setSize(int)} method to set the size using pixels instead.
|
||||
* Defaults to 75%.
|
||||
* <p/>
|
||||
* Note that the percentage is specified by providing a floating point number in the
|
||||
* range of 0.0 to 1.0, where 0.0 is equivalent to "0%" and 1.0 is equivalent to "100%".
|
||||
*
|
||||
* @param size The percent diameter of the pie relative to the plot area. (0.0 to 1.0)
|
||||
* @return A reference to this {@link PiePlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public PiePlotOptions setSize(double size) {
|
||||
return this.setOption("size", new JSONString(((Double) (size * 100)).intValue() + "%"));
|
||||
}
|
||||
|
||||
// TODO: Add remaining pie chart plot options
|
||||
|
||||
}
|
||||
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the general dial options available for for the gauge's dial, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.Chart#setGaugePlotOptions(GaugePlotOptions)} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Sample usage:
|
||||
* <pre><code>
|
||||
* Chart.setGaugePlotOptions(
|
||||
* new GaugePlotOptions()
|
||||
* .setPivotOptions(
|
||||
* new Pivot()
|
||||
* .setRadius("75%")
|
||||
* )
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
|
||||
public class Pivot extends BaseGaugePart<Pivot> {
|
||||
|
||||
// Everything we need is inherited from our base class, so this class is really only needed to
|
||||
// handle setting the correct generic type (so the user doesn't need to deal with the type manually)
|
||||
|
||||
}
|
||||
+193
-1
@@ -88,6 +88,37 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of the supported placement types, which can be passed to the
|
||||
* {@link #setPointPlacement} method. Possible options are: "on" and "between"
|
||||
* @since 1.6.0
|
||||
*
|
||||
*/
|
||||
public enum PointPlacement {
|
||||
|
||||
/**
|
||||
* In a column chart, when pointPlacement is "on", the point will not create any padding of the X axis.
|
||||
* In a polar column chart this means that the first column points directly north
|
||||
*/
|
||||
ON("on"),
|
||||
|
||||
/**
|
||||
* In a column chart, the columns will be laid out between ticks.
|
||||
*/
|
||||
BETWEEN("between");
|
||||
|
||||
private PointPlacement(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
private final String optionValue;
|
||||
|
||||
public String toString() {
|
||||
return optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'allowPointSelect' plot option. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -254,11 +285,27 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("dataLabels", dataLabels != null ? dataLabels.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "dataGrouping" options for a stock chart. Sample usage:
|
||||
* <pre><code>
|
||||
* plotOptions.setDataGrouping(
|
||||
* new DataGrouping()
|
||||
* .setEnabled(true);
|
||||
* );
|
||||
* </code></pre>
|
||||
* @param dataGrouping The dataGrouping options set using {@link DataGrouping}
|
||||
* @return A reference to this {@link PlotOptions} for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setDataGrouping(DataGrouping dataGrouping) {
|
||||
return this.setOption("dataGrouping", dataGrouping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the data labels configuration that was set on this plot options, or null if
|
||||
* none were set. Note that this method returns an {@link org.moxieapps.gwt.highcharts.client.labels.BaseDataLabels} and not simply
|
||||
* a {@link DataLabels} in order to handle alternative labels types such as
|
||||
* {@link org.moxieapps.gwt.highcharts.client.labels.PieDataLabels}.
|
||||
* {@link org.moxieapps.gwt.highcharts.client.labels.ProportionalDataLabels}.
|
||||
*
|
||||
* @return A reference to the data labels configuration that was set on this plot options, or null if
|
||||
* none was set.
|
||||
@@ -282,6 +329,20 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("enableMouseTracking", enableMouseTracking);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'id' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("id", "chart");
|
||||
* </code></pre>
|
||||
* This can be used after render time to get a pointer to the series object through chart.get().
|
||||
* @param id An id for the series.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setId(String id) {
|
||||
return this.setOption("id", id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'legendIndex' option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -312,6 +373,44 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("lineWidth", lineWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* convenience method for setting the "linkedTo" option. Equivalent to:
|
||||
* <pre><code>
|
||||
* plotOptions.setOption("linkedTo", "seriesId");
|
||||
* </code></pre>
|
||||
* The id of another series to link to. Additionally, the value can be ":previous" to link to the previous series.
|
||||
* When two series are linked, only the first one appears in the legend.
|
||||
* Toggling the visibility of this also toggles the linked series.
|
||||
* <p>
|
||||
* Note: this method will set a link to another series based on its id. To link to the series itself instead of its
|
||||
* id, use {@link #setLinkedTo(Series)}
|
||||
* </p>
|
||||
* @param linkedTo The name of the series to be linked to.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @see #setLinkedTo(Series)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setLinkedTo(String linkedTo) {
|
||||
return this.setOption("linkedTo", linkedTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* convenience method for setting the "linkedTo" option. Equivalent to:
|
||||
* <pre><code>
|
||||
* plotOptions.setOption("linkedTo", "seriesId");
|
||||
* </code></pre>
|
||||
* The id of another series to link to. Additionally, the value can be ":previous" to link to the previous series.
|
||||
* When two series are linked, only the first one appears in the legend.
|
||||
* Toggling the visibility of this also toggles the linked series.
|
||||
* @param series The name of the series to be linked to.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @see #setLinkedTo(String)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setLinkedTo(Series series) {
|
||||
return this.setOption("linkedTo", series.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'marker' plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -329,6 +428,48 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("marker", marker != null ? marker.getOptions() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "negativeColor" option for the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* areaPlotOptions.setOption("negativeColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* When a point's Z value is below the zThreshold setting, this color is used. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setNegativeColor(String)} version instead.
|
||||
*
|
||||
* @param negativeColor The color for the parts of the graph or points that are below the threshold.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public PlotOptions setNegativeColor(Color negativeColor) {
|
||||
return this.setOption("negativeColor", negativeColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "negativeColor" option for the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* PlotOptions.setOptions("negativeColor", "#CCCCCC");
|
||||
* </code></pre>
|
||||
* When a point's Z value is below the zThreshold setting, this color is used. Defaults to null.
|
||||
* <p/>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setNegativeColor(Color)}
|
||||
* version instead.
|
||||
*
|
||||
* @param negativeColor The color for the parts of the graph or points that are below the threshold.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public PlotOptions setNegativeColor(String negativeColor) {
|
||||
return this.setOption("negativeColor", negativeColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'pointStart' plot option. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -361,6 +502,27 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("pointInterval", pointInterval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'pointPointPlacement' plot option. Equivalent to:
|
||||
* <pre><code>
|
||||
* plotOptions.setOption("pointPointPlacement", Stacking.NULL);
|
||||
* </code></pre>
|
||||
* Possible values: null, "on", "between".
|
||||
* <p/>
|
||||
* In a column chart, when pointPointPlacement is "on", the point will not create any padding of the X axis.
|
||||
* In a polar column chart this means that the first column points directly north.
|
||||
* If the pointPointPlacement is "between", the columns will be laid out between ticks.
|
||||
* This is useful for example for visualising an amount between two points in time or in a certain sector of a polar chart.
|
||||
* <p/>
|
||||
* Defaults to null in cartesian charts, "between" in polar charts.
|
||||
* @param pointPointPlacement Where to place points in relation to ticks on the axis.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setPointPlacement(PointPlacement pointPointPlacement) {
|
||||
return this.setOption("pointPointPlacement", pointPointPlacement != null ? pointPointPlacement.toString() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'selected' plot option. Equivalent to:
|
||||
* <pre><code>
|
||||
@@ -502,6 +664,36 @@ public abstract class PlotOptions<T extends PlotOptions> extends Configurable<T>
|
||||
return this.setOption("stickyTracking", stickyTracking);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "threshold" option for the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* plotOptions.setOptions("threshold", 0);
|
||||
* </code></pre>
|
||||
* The threshold, also called zero level or base level. For line type series this is only used in conjunction with negativeColor. Defaults to 0
|
||||
* @param threshold A minimum z-value determine whether bubbles will be displayed if 'displayNegative' is false.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setThreshold(Number threshold) {
|
||||
return this.setOption("threshold", threshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the "turboThreshold" optioin for the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* plotOptions.setOptions("turboThreshold", 1000);
|
||||
* </code></pre>
|
||||
* When a series contains a data array that is longer than this, only one dimensional arrays of numbers,
|
||||
* or two dimensional arrays with x and y values are allowed. Also, only the first point is tested, and
|
||||
* the rest are assumed to be the same format. This saves expensive data checking and indexing in long series. Defaults to 1000
|
||||
* @param turboThreshold The maximum size of an array to be greater than two-dimensional and check the format of each entry.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public T setTurboThreshold(Number turboThreshold) {
|
||||
return this.setOption("turboThreshold", turboThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'visible' plot option. Equivalent to:
|
||||
* <pre><code>
|
||||
|
||||
+30
-1
@@ -35,7 +35,36 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
*/
|
||||
public class SplinePlotOptions extends PlotOptions<SplinePlotOptions> {
|
||||
|
||||
// TODO:
|
||||
/**
|
||||
* Convenience Method for setting the "gapSize" option of the plot options. Equivalent to:
|
||||
* <pre><code>
|
||||
* splinePlotOptions.setOption("gapSize", 5);
|
||||
* </code></pre>
|
||||
* Defines when to display a gap in the graph. A gap size of 5 means that if the distance between two points is
|
||||
* greater than five times that of the two closest points, the graph will be broken.In practice, this option is
|
||||
* most often used to visualize gaps in time series. In a stock chart, intraday data is available for daytime hours,
|
||||
* while gaps will appear in nights and weekends.. Defaults to 0.
|
||||
* @param gapSize The distance between points needed to display a gap in the series.
|
||||
* @return A reference to this {@link SplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public SplinePlotOptions setGapSize(Number gapSize) {
|
||||
return this.setOption("gapSize", gapSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'connectNulls' option for the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* splinePlotOptions.setOption("connectNulls", true);
|
||||
* </code></pre>
|
||||
* Whether to draw a line between points on either side of a null point, or render a gap between them.
|
||||
* @param connectNulls 'true' to connect points on either side of a null point
|
||||
* @return A reference to this {@link SplinePlotOptions} instance for convenient method chaining.
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public SplinePlotOptions setConnectNulls(boolean connectNulls) {
|
||||
return this.setOption("connectNulls", connectNulls);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2013 Moxie Group
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.moxieapps.gwt.highcharts.client.plotOptions;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Color;
|
||||
|
||||
/**
|
||||
* Represents the general plot options available for all waterfall type series, which can be set either generically
|
||||
* on the chart via the {@link org.moxieapps.gwt.highcharts.client.plotOptions.WaterfallPlotOptions} method or directly on a
|
||||
* series via the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
* <p/>
|
||||
* Note that these options are only needed if you want to specifically control the general options
|
||||
* for all waterfall type series in the entire chart. If you instead want to control the options for all
|
||||
* series in the chart (not just those of a waterfall type), then you can use the {@link SeriesPlotOptions}
|
||||
* class instead. Or, if you want to control the plot options for just one series (and not all waterfall type
|
||||
* series in the chart), use the {@link org.moxieapps.gwt.highcharts.client.Series#setPlotOptions(PlotOptions)} method.
|
||||
*
|
||||
* @author cskowron@moxiegroup.com (Cory Skowronek)
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class WaterfallPlotOptions extends PlotOptions<WaterfallPlotOptions> {
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'upColor' option of the chart. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("upColor", "#8BBC21");
|
||||
* </code></pre>
|
||||
* The chart's upColor is the the color which represents any area on the chart which has a positive value.
|
||||
* </p>
|
||||
* Note that this method is intended for setting the color to a simple RBG hex value. If you instead
|
||||
* want to set a color to include an alpha channel or a gradient, use the {@link #setUpColor(Color)}
|
||||
* version instead.
|
||||
* @param upColor The color to use for this series.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining.
|
||||
*/
|
||||
public WaterfallPlotOptions setUpColor(String upColor) {
|
||||
return this.setOption("upColor", upColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for setting the 'upColor' plot option to a gradient or color with an alpha
|
||||
* value. Equivalent to:
|
||||
* <pre><code>
|
||||
* chart.setOption("upColor", new Color()
|
||||
* .setLinearGradient(0.0, 0.0, 1.0, 1.0)
|
||||
* .addStop(new Color(255, 255, 255))
|
||||
* .addStop(new Color(200, 200, 255))
|
||||
* );
|
||||
* </code></pre>
|
||||
* The chart's upColor is the the color which represents any area on the chart which has a positive value.
|
||||
* </p>
|
||||
* Note that this method is intended for setting the color to a gradient or color that includes
|
||||
* an alpha channel. If you instead just want to set the color to a normal RGB hex value
|
||||
* you can use the {@link #setUpColor(String)} version instead.
|
||||
* @param upColor The color to use for the series.
|
||||
* @return A reference to this {@link PlotOptions} instance for convenient method chaining
|
||||
*/
|
||||
public WaterfallPlotOptions setUpColor(Color upColor) {
|
||||
return this.setOption("upColor", upColor != null ? upColor.getOptionValue() : null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user