com.googlecode.wickedcharts.highcharts.options.livedata
Class LiveDataSeries

java.lang.Object
  extended by com.googlecode.wickedcharts.highcharts.options.series.Series<Point>
      extended by com.googlecode.wickedcharts.highcharts.options.series.PointSeries
          extended by com.googlecode.wickedcharts.highcharts.options.livedata.LiveDataSeries
All Implemented Interfaces:
IProcessableOption, Serializable

public abstract class LiveDataSeries
extends PointSeries
implements IProcessableOption

This Series class supports regular updating via AJAX.

Author:
Tom Hombergs (tom.hombergs@gmail.com)
See Also:
Serialized Form

Nested Class Summary
static interface LiveDataSeries.JavaScriptParameters
          Container class for passing javascript parameters to update(JavaScriptParameters).
 
Field Summary
static String PROCESSING_KEY
          The key under which LiveDataSeries are registered in the parent options.
 
Constructor Summary
LiveDataSeries(Options parentOptions, int updateIntervalMs)
          Constructs a new LiveDataSeries.
 
Method Summary
 LiveDataSeries addJavaScriptParameter(String parameterName, String javascriptExpression)
          Adds a javascript parameter that will be passed into the update(JavaScriptParameters) method.
 Map<String,String> getJavaScriptParameters()
           
 Options getParentOptions()
           
 String getProcessingKey()
           
 int getUpdateIntervalMs()
           
 LiveDataSeries setUpdateIntervalMs(int updateIntervalMs)
           
abstract  Point update(LiveDataSeries.JavaScriptParameters parameters)
          This method is called for each update interval.
 
Methods inherited from class com.googlecode.wickedcharts.highcharts.options.series.PointSeries
addNumberPoint, addNumbers, getData, setData, setData, setNumberData, setNumberData
 
Methods inherited from class com.googlecode.wickedcharts.highcharts.options.series.Series
addPoint, getCenter, getColor, getDashStyle, getDataLabels, getEnableMouseTracking, getInnerSize, getLegendIndex, getMarker, getName, getPointInterval, getPointPlacement, getPointStart, getShowInLegend, getSize, getStack, getStates, getTooltip, getType, getWickedChartsId, getxAxis, getyAxis, setCenter, setColor, setColor, setDashStyle, setDataLabels, setEnableMouseTracking, setInnerSize, setLegendIndex, setMarker, setName, setPointInterval, setPointPlacement, setPointStart, setShowInLegend, setSize, setStack, setStates, setTooltip, setType, setWickedChartsId, setxAxis, setyAxis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESSING_KEY

public static final String PROCESSING_KEY
The key under which LiveDataSeries are registered in the parent options. See Options.markForProcessing(IProcessableOption) .

See Also:
Constant Field Values
Constructor Detail

LiveDataSeries

public LiveDataSeries(Options parentOptions,
                      int updateIntervalMs)
Constructs a new LiveDataSeries.

Parameters:
parentOptions - the Options to which this series are added.
updateIntervalMs - the interval in which to update the series in milliseconds.
Method Detail

getParentOptions

public Options getParentOptions()

setUpdateIntervalMs

public LiveDataSeries setUpdateIntervalMs(int updateIntervalMs)

addJavaScriptParameter

public LiveDataSeries addJavaScriptParameter(String parameterName,
                                             String javascriptExpression)
Adds a javascript parameter that will be passed into the update(JavaScriptParameters) method.

Parameters:
parameterName - the name of the parameter
javascriptExpression - a javascript expression. The value this expression evaluates to will be transmitted to the server via AJAX and will be passed into update(JavaScriptParameters). The javascript expression may be a function call or a literal. If it is a literal string, you have to surround the string with quotes.
Returns:
this object for chaining

getJavaScriptParameters

public Map<String,String> getJavaScriptParameters()

getUpdateIntervalMs

public int getUpdateIntervalMs()

getProcessingKey

public String getProcessingKey()
Specified by:
getProcessingKey in interface IProcessableOption

update

public abstract Point update(LiveDataSeries.JavaScriptParameters parameters)
This method is called for each update interval. It must return a point which is then added to the series on the fly.

May return null. In that case, the chart is simply not updated.

Parameters:
parameters - parameters that have been passed from javascript. You can define parameters to be transmitted from client side javascript to the server by calling addJavaScriptParameter(String, String).
Returns:
the new point to add to the series. This point is added by calling Highcharts' addPoint() function. Please note that Highcharts does not evaluate all attributes of this point. Also not that to define the color of the point you have to add a Marker with the fillColor attribute defined!


Copyright © 2013. All Rights Reserved.