|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.moxieapps.gwt.highcharts.client.Configurable<Series> org.moxieapps.gwt.highcharts.client.Series
public class Series
Manages a data series (and its options) that can then be added to a Chart
. As an extension
of Configurable
each series instance can also optionally have configuration options set on it.
In order to create a new series, utilize the BaseChart.createSeries()
method, configure it, add data
to it, and then add it to the chart via the BaseChart.addSeries(org.moxieapps.gwt.highcharts.client.Series)
method. Note that a series
can be modified after the chart has been rendered as well, which allows for support of dynamic charts or series
that change in some way based on user behavior. Simple example of setting up a series on a chart:
Example of updating all of the points in a series at once:
Series series = chart.createSeries()
.setName("Random Stuff")
.addPoint(40)
.addPoint(35)
.addPoint(60);
chart.addSeries(series);
Example of changing the options for one point in the series:
chart.addSeries(chart.createSeries()
.setName("Random Stuff")
.setPoints(new Number[] { 40, 35, 60 })
);
chart.addSeries(chart.createSeries()
.setName("Random Stuff")
.addPoint(40)
.addPoint(new Point(35).setColor("#BF0B23"))
.addPoint(60)
);
Nested Class Summary | |
---|---|
static class |
Series.Type
An enumeration of supported series types, which can be passed to methods such as setType(org.moxieapps.gwt.highcharts.client.Series.Type) or BaseChart.setType(org.moxieapps.gwt.highcharts.client.Series.Type) . |
Constructor Summary | |
---|---|
protected |
Series(BaseChart chart)
Use the BaseChart.createSeries() method to create new series instances. |
Method Summary | |
---|---|
Series |
addPoint(Number y)
Simplest way to add a point using the default options, and setting only the Y value that the point should be rendered at within the series. |
Series |
addPoint(Number y,
boolean redraw,
boolean shift,
Animation animation)
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. |
Series |
addPoint(Number y,
boolean redraw,
boolean shift,
boolean animation)
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. |
Series |
addPoint(Number x,
Number y)
Simple way to add a point using the default options, and setting only the X and Y value that the point should be rendered at within the series. |
Series |
addPoint(Number x,
Number y,
boolean redraw,
boolean shift,
Animation animation)
Add a point to the series with a specific value on the X and Y axis, controlling the options on how the change will be drawn to the series. |
Series |
addPoint(Number x,
Number y,
boolean redraw,
boolean shift,
boolean animation)
Add a point to the series with a specific value on the X and Y axis, controlling the options on how the change will be drawn to the series. |
Series |
addPoint(Number x,
Number low,
Number high)
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). |
Series |
addPoint(Number x,
Number open,
Number high,
Number low,
Number close)
Simple way to add a point using the default options, and setting only the X, Open, High, Low, and Close values that the point should be rendered at within the series (for OHLC charts). |
Series |
addPoint(Number x,
Number open,
Number high,
Number low,
Number close,
boolean redraw,
boolean shift,
Animation animation)
Add a point to the series with a specific value on the X and Y axis (in OHLC format), controlling the options on how the change will be drawn to the series. |
Series |
addPoint(Number x,
String title,
String text)
Add a point to the series that is to be used as a flag. |
Series |
addPoint(Point point)
Add a point to the series accepting the default options on how the point will be drawn. |
Series |
addPoint(Point point,
boolean redraw,
boolean shift,
Animation animation)
Add a point to the series with a specific value on the X and Y axis, controlling the options on how the change will be drawn to the series. |
Series |
addPoint(Point point,
boolean redraw,
boolean shift,
boolean animation)
Add a point to the series with a specific value on the X and Y axis, controlling the options on how the change will be drawn to the series. |
String |
getId()
The internally generated unique id for this series |
String |
getName()
/** Convenience method for getting the 'name' of a particular series. |
com.google.gwt.core.client.JavaScriptObject |
getNativeSeries()
For advanced use-cases only. |
Point[] |
getPoints()
Retrieve the array of points that have been added to this series. |
Series |
hide()
Hides the series if visible. |
boolean |
isVisible()
Retrieve the series' visibility state as set by show() , hide() , or the initial configuration. |
boolean |
remove()
Remove this series from the chart it is a part of. |
Series |
removePoint(Point point)
Remove the point from the series, automatically redrawing the chart using the default animation options. |
Series |
removePoint(Point point,
boolean redraw,
Animation animation)
Remove the point from the series, explicitly controlling whether the chart is redrawn and the details of the animation options. |
Series |
removePoint(Point point,
boolean redraw,
boolean animation)
Remove the point from the series, explicitly controlling whether the chart is redrawn and/or animated or not. |
Series |
select(boolean select)
Select or unselect the series. |
Series |
selectToggle()
Select the series if it is currently unselected, or unselect the series if it is currently selected. |
Series |
setColorByPoint(boolean colorByPoint)
Convenience method for setting the 'colorByPoint' option of the series. |
Series |
setIndex(Number index)
Convenience method for setting the 'index' option of the series. |
Series |
setLegendIndex(Number legendIndex)
Convenience method for setting the 'index' option of the series. |
Series |
setName(String name)
Convenience method for setting the 'name' option of the series. |
Series |
setPlotOptions(PlotOptions plotOptions)
Updates the plot options for this series to reflect the given options. |
Series |
setPoints(com.google.gwt.json.client.JSONArray points,
boolean redraw)
Apply a new set of data to a series with the option to redraw the chart. |
Series |
setPoints(Number[] yValues)
Apply a new set of data (Y values only) to the series and automatically redraw it. |
Series |
setPoints(Number[][] values)
Apply a new set of data to the series and automatically redraw it. |
Series |
setPoints(Number[][] values,
boolean redraw)
Apply a new set of data to the series and optionally redraw it. |
Series |
setPoints(Number[] yValues,
boolean redraw)
Apply a new set of data (Y values only) to the series and optionally redraw it. |
Series |
setPoints(Point[] points)
Apply a new set of data to the series and automatically redraw it. |
Series |
setPoints(Point[] points,
boolean redraw)
Apply a new set of data to the series and optionally redraw it. |
Series |
setStack(Number stack)
Convenience method for setting the 'stack' option of the series to a number. |
Series |
setStack(String stack)
Convenience method for setting the 'stack' option of the series to a string. |
Series |
setToolTip(ToolTip toolTip)
Convenience method for setting the 'tooltip' option of the series. |
Series |
setType(Series.Type type)
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. |
Series |
setVisible(boolean visible)
Either shows or hides the series, and then automatically redraws the chart. |
Series |
setVisible(boolean visible,
boolean redraw)
Either shows or hides the series, and then optionally redraws the chart. |
Series |
setXAxis(Number xAxis)
Convenience method for setting the 'xAxis' property of the series to a number. |
Series |
setYAxis(Number yAxis)
Convenience method for setting the 'yAxis' property of the series to a number. |
Series |
show()
Shows the series if hidden. |
Series |
update(Series seriesOptions)
Update the series with a new set of options, automatically redrawing the chart. |
Series |
update(Series seriesOptions,
boolean redraw)
Update the series with a new set of options. |
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable |
---|
getOptions, setOption |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Series(BaseChart chart)
BaseChart.createSeries()
method to create new series instances.
chart
- The chart instance that this series is being created within.Method Detail |
---|
public Series setColorByPoint(boolean colorByPoint)
series.setOption("colorByPoint", true);
When using automatic point colors pulled from the options.colors collection, this option determines
whether the chart should receive one color per series or one color per point. Defaults to false.
colorByPoint
- Whether the chart should receive one color per series or one color per point.
Series
instance for convenient method chaining.public Series setIndex(Number index)
series.setOption("index", 1);
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.
index
- The series' index in the internal chart.series array.
Series
instance for convenient method chaining.public Series setLegendIndex(Number legendIndex)
series.setOption("index", 1);
The sequential index of the series in the legend.
legendIndex
- A number representing the position of the series in the legend.
Series
instance for convenient method chaining.public Series setName(String name)
series.setOption("name", "My Chart");
The name of the series as shown in the legend, tooltip etc. Defaults to "".
name
- The string to set as the series name.
Series
instance for convenient method chaining.public String getName()
series.getName()
setName(String)
.public Series setStack(String stack)
series.setOption("stack", "Stack 1");
The 'stack' option allows grouping series in a stacked chart. Defaults to null. Note
that you can also set this option to a number instead via the setStack(Number)
method.
stack
- The string to set as the 'stack' option on the series.
Series
instance for convenient method chaining.public Series setStack(Number stack)
series.setOption("stack", 1);
The 'stack' option allows grouping series in a stacked chart. Defaults to null. Note
that you can also set this option to a string instead via the setStack(String)
method.
stack
- The number to set as the 'stack' option on the series.
Series
instance for convenient method chaining.public Series setToolTip(ToolTip toolTip)
series.setOption("/tooltip/borderColor", "#CCCCCC");
series.setOption("/tooltip/shadow", true);
etc..
The tooltip appears when the user hovers over a series or point.
toolTip
- The options to apply to the tooltip of the chart.
BaseChart
instance for convenient method chaining.public Series setType(Series.Type type)
series.setOption("type", "line");
Note that if you don't set this explicitly the default series type is Series.Type.LINE
.
type
- One of the supported series types.
Series
instance for convenient method chaining.public Series setXAxis(Number xAxis)
series.setOption("xAxis", 1);
When using dual or multiple x axes, this number defines which xAxis the particular series is
connected to. It refers to the index of the axis in the xAxis array, with 0 being the first.
Defaults to 0.
xAxis
- The number to set as the 'xAxis' option on the series.
Series
instance for convenient method chaining.public Series setYAxis(Number yAxis)
series.setOption("yAxis", 1);
When using dual or multiple y axes, this number defines which yAxis the particular series is
connected to. It refers to the index of the axis in the yAxis array, with 0 being the first.
Defaults to 0.
yAxis
- The number to set as the 'yAxis' option on the series.
Series
instance for convenient method chaining.public Series setPlotOptions(PlotOptions plotOptions)
Chart
instance,
and therefore you only need to use this method if you want to override the plot options for
this series only.
Note that the general PlotOptions
type only represents the abstract base class of all the
different series types. To call this method you need to instantiate one of the concrete
sub-classes instead (e.g. AreaPlotOptions
,
BarPlotOptions
, etc.).
Also note that changing the plot options for a series after it has been rendered to the screen
does not change the way the live series will appear. If you need to change the plot options
after the series is rendered, you'd instead need to first remove()
the series from
the chart and then re-add it to the chart via the BaseChart.addSeries(org.moxieapps.gwt.highcharts.client.Series)
method.
plotOptions
- The plot options to use for this series (or one of its sub-types)
Series
instance for convenient method chaining.public Series addPoint(Number y)
addPoint()
method for more control over the way the
point is rendered.
y
- The value on the Y axis that the point should be drawn at within the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, String title, String text)
x
- Point where the flag appearstitle
- Title of flag displayed on the charttext
- Text displayed when the flag are highlighted.
Series
instance for convenient method chaining.public Series addPoint(Number y, boolean redraw, boolean shift, boolean animation)
y
- The value on the Y axis that the point should be drawn at within the series.redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- Defaults to true. When true, the graph will be animated with default animation options.
Note, see the addPoint(Number, boolean, boolean, org.moxieapps.gwt.highcharts.client.Animation)
method
for more control over how the animation will run.
Series
instance for convenient method chaining.public Series addPoint(Number y, boolean redraw, boolean shift, Animation animation)
y
- The value on the Y axis that the point should be drawn at within the series.redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- The custom animation to use when adding the point to the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number y)
addPoint()
method for more control over the way the
point is rendered.
x
- The value on the X axis that the point should be drawn at within the series.y
- The value on the Y axis that the point should be drawn at within the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number low, Number high)
addPoint()
method for
more control over the way the point is rendered.
x
- The value on the X axis that the point should be drawn at within the series.low
- The "low" Y value that the point should be rendered at within the series.high
- The "high" Y value that the point should be rendered at within the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number open, Number high, Number low, Number close)
addPoint()
method for
more control over the way the point is rendered.
x
- The value on the X axis that the point should be drawn at within the series.open
- The "open" Y value that the point should be rendered at within the series.high
- The "high" Y value that the point should be rendered at within the series.low
- The "low" Y value that the point should be rendered at within the series.close
- The "close" Y value that the point should be rendered at within the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number y, boolean redraw, boolean shift, boolean animation)
x
- The value on the X axis that the point should be drawn at within the series.y
- The value on the Y axis that the point should be drawn at within the series.redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- Defaults to true. When true, the graph will be animated with default animation options.
Note, see the addPoint(Number, Number, boolean, boolean, org.moxieapps.gwt.highcharts.client.Animation)
method
for more control over how the animation will run.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number y, boolean redraw, boolean shift, Animation animation)
x
- The value on the X axis that the point should be drawn at within the series.y
- The value on the Y axis that the point should be drawn at within the series.redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- The custom animation to use when adding the point to the series.
Series
instance for convenient method chaining.public Series addPoint(Number x, Number open, Number high, Number low, Number close, boolean redraw, boolean shift, Animation animation)
x
- The value on the X axis that the point should be drawn at within the series.open
- The "open" Y value that the point should be rendered at within the series.high
- The "high" Y value that the point should be rendered at within the series.low
- The "low" Y value that the point should be rendered at within the series.close
- The "close" Y value that the point should be rendered at within the series.redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- The custom animation to use when adding the point to the series.
Series
instance for convenient method chaining.public Series addPoint(Point point)
point
- The point to add to the series (which, in turn, can have its own configuration options).
Series
instance for convenient method chaining.public Series addPoint(Point point, boolean redraw, boolean shift, boolean animation)
point
- The point to add to the series (which, in turn, can have its own configuration options).redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- Defaults to true. When true, the graph will be animated with default animation options.
Note, see the addPoint(org.moxieapps.gwt.highcharts.client.Point, boolean, boolean, org.moxieapps.gwt.highcharts.client.Animation)
method
for more control over how the animation will run.
Series
instance for convenient method chaining.public Series addPoint(Point point, boolean redraw, boolean shift, Animation animation)
point
- The point to add to the series (which, in turn, can have its own configuration options).redraw
- Whether to redraw the chart after the point is added. When adding more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called
after the adding of points is finished.shift
- Defaults to false. When shift is true, one point is shifted off the start of the
series as one is appended to the end. Use this option for live charts monitoring
a value over time.animation
- The custom animation to use when adding the point to the series.
Series
instance for convenient method chaining.public Series setPoints(Number[] yValues)
setPoints(org.moxieapps.gwt.highcharts.client.Point[])
method instead.
yValues
- The array of Y values to set on the data series (replacing any data already in place)
Series
instance for convenient method chaining.public Series setPoints(Number[] yValues, boolean redraw)
setPoints(org.moxieapps.gwt.highcharts.client.Point[], boolean)
method instead.
yValues
- The array of Y values to set on the data series (replacing any data already in place)redraw
- Whether to redraw the chart after the series is altered. If doing more operations
on the chart, it is a good idea to set redraw to false and then call
BaseChart.redraw()
after.
Series
instance for convenient method chaining.public Series setPoints(Number[][] values)
If you need more control than just simply setting the x and y values of each data point, then
use the setPoints(org.moxieapps.gwt.highcharts.client.Point[])
method instead.
values
- A two dimensional array of values, where the main array is the list of points and
each inner array contains values matching the series data type, described above.
Series
instance for convenient method chaining.public Series setPoints(Number[][] values, boolean redraw)
If you need more control than just simply setting the x and y values of each data point, then
use the setPoints(org.moxieapps.gwt.highcharts.client.Point[])
method instead.
values
- A two dimensional array of values, where the main array is the list of points and
each inner array contains values matching the series data type, described above.redraw
- Whether to redraw the chart after the series is altered. If doing more operations
on the chart, it is a good idea to set redraw to false and then call
BaseChart.redraw()
after.
Series
instance for convenient method chaining.public Series setPoints(Point[] points)
points
- The array of points to set on the data series (replacing any data already in place)
Series
instance for convenient method chaining.public Series setPoints(Point[] points, boolean redraw)
points
- The array of points to set on the data series (replacing any data already in place)redraw
- Whether to redraw the chart after the series is altered. If doing more operations
on the chart, it is a good idea to set redraw to false and then call
BaseChart.redraw()
after.
Series
instance for convenient method chaining.public Series setPoints(com.google.gwt.json.client.JSONArray points, boolean redraw)
points
- A set of points represented as a JSONArrayredraw
- Whether to redraw the chart after the series is altered. If doing more operations
on the chart, it is a good idea to set redraw to false and then call
BaseChart.redraw()
after.
Series
instance for convenient method chaining.public Point[] getPoints()
public Series removePoint(Point point)
BaseChart.setPersistent(boolean)
method.
If you're using non-persistent charts, you can instead simply use the
Point.remove()
method to achieve the same affect.
point
- The point instance (obtained dynamically from the chart) to remove from the series.
Series
instance for convenient method chaining.public Series removePoint(Point point, boolean redraw, boolean animation)
BaseChart.setPersistent(boolean)
method.
If you're using non-persistent charts, you can instead simply use the
Point.remove(boolean, boolean)
method to achieve the same affect.
point
- The point instance (obtained dynamically from the chart) to remove from the series.redraw
- Whether to redraw the chart after the point is removed. When removing more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called after the removing of points is finished.animation
- Defaults to true. When true, the graph will be animated with default animation options.
Note, see the removePoint(org.moxieapps.gwt.highcharts.client.Point, boolean, org.moxieapps.gwt.highcharts.client.Animation)
method
for more control over how the animation will run.
Series
instance for convenient method chaining.public Series removePoint(Point point, boolean redraw, Animation animation)
BaseChart.setPersistent(boolean)
method.
If you're using non-persistent charts, you can instead simply use the
Point.remove(boolean, org.moxieapps.gwt.highcharts.client.Animation)
method to achieve the same affect.
point
- The point instance (obtained dynamically from the chart) to remove from the series.redraw
- Whether to redraw the chart after the point is removed. When removing more than one
point, it is highly recommended that the redraw option be set to false, and instead
BaseChart.redraw()
is explicitly called after the removing of points is finished.animation
- The custom animation to use when removing the point from the series.
Series
instance for convenient method chaining.public boolean remove()
public Series show()
setVisible(boolean, boolean)
method instead.
Series
instance for convenient method chaining.public Series hide()
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 setVisible(boolean, boolean)
method instead.
Series
instance for convenient method chaining.public Series setVisible(boolean visible)
setVisible(boolean, boolean)
method instead.
visible
- Whether or not to show or hide the series.
Series
instance for convenient method chaining.public Series setVisible(boolean visible, boolean redraw)
BaseChart.redraw()
method to update the
chart once you're ready.
visible
- Whether or not to show or hide the series.redraw
- Whether or not to automatically redraw the chart, or wait until the Chart.redraw() method is called.
Series
instance for convenient method chaining.public Series select(boolean select)
BaseChart.getSelectedSeries()
method.
select
- When true, the series is selected. When false it is unselected. See the selectToggle()
method to instead toggle the selection state.
Series
instance for convenient method chaining.public Series selectToggle()
select(boolean)
method for more explicit control over the selection state of a series.
Series
instance for convenient method chaining.public boolean isVisible()
show()
, hide()
, or the initial configuration.
public com.google.gwt.core.client.JavaScriptObject getNativeSeries()
public String getId()
public Series update(Series seriesOptions)
seriesOptions
- New options that will be merged into the series' existing options.
Series
instance for convenient method chaining.public Series update(Series seriesOptions, boolean redraw)
seriesOptions
- New options that will be merged into the series' existing options.redraw
- Whether to redraw the chart after the series is altered. If doing more operations on the chart,
it is a good idea to set redraw to false and call chart.redraw() after.
Series
instance for convenient method chaining.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |