org.moxieapps.gwt.highcharts.client
Class StockChart

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by org.moxieapps.gwt.highcharts.client.BaseChart<StockChart>
              extended by org.moxieapps.gwt.highcharts.client.StockChart
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget

public class StockChart
extends BaseChart<StockChart>

The main GWT widget that can be constructed and then configured in order to add a Highstock chart into a GWT layout container. Note that for more basic chart types just make use of the Chart widget instead. Basic usage is as follows:


 StockChart stockChart = new StockChart()
    .setChartTitleText("NYSE")
    .setMarginRight(10);
 Series series = stockChart.createSeries()
   .addPoint(40)
   .addPoint(35)
   .addPoint(60);
 stockChart.addSeries(series);
 RootPanel.get().add(stockChart);
 
For details on available options see the Highcharts reference.

Note that in order for this widget to function you must have included the Highstock javascript library and any of its dependencies in the page that the widget will run inside of. E.g.:


 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 <script type="text/javascript" src="js/highstock.js"></script>
 

 <!-- Optionally, add a highcharts theme file -->
 <script type="text/javascript" src="js/themes/gray.js"></script>
 

 <!-- Optionally, include the highcharts exporting module -->
 <script type="text/javascript" src="js/modules/exporting.js"></script>
 
Note that the "highstock.js" file includes all of the capabilities of the "highcharts.js" file. So if you plan on using both StockChart's and regular Chart's simultaneously, then you only need to include the "highstock.js" file in your page.

Also note that Highcharts supports other JS frameworks besides jQuery for its internal DOM manipulation functionality. So, if jQuery isn't your cup of tea check the installation docs on the Highcharts site for more details.

Since:
1.0.0
Author:
squinn@moxiegroup.com (Shawn Quinn)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.moxieapps.gwt.highcharts.client.BaseChart
BaseChart.PinchType, BaseChart.ZoomType
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class org.moxieapps.gwt.highcharts.client.BaseChart
candlestickPlotOptions, ohlcPlotOptions
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
StockChart()
          Create a new Highstock chart instance as a GWT Widget that can then be added to a GWT layout like any other widget.
 
Method Summary
protected  String getChartTypeName()
          To be overridden in a sub class to return the JS type name of the chart instance that should be created when the chart is rendered.
 Navigator getNavigator()
          Access the StockChart's Navigator, for customization.
 StockChart setCandlestickPlotOptions(CandlestickPlotOptions candlestickPlotOptions)
          Updates the options that all candlestick type series within the chart will use by default.
 StockChart setOHLCPlotOptions(OHLCPlotOptions ohlcPlotOptions)
          Updates the options that all OHLC type series within the chart will use by default.
 StockChart setRangeSelector(RangeSelector rangeSelector)
          Convenience method for setting the 'rangeSelector' chart options.
 StockChart setScrollbar(Scrollbar scrollbar)
          Convenience method for setting the 'scrollbar' chart options.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.BaseChart
addSeries, addSeries, addSeries, convertSeriesToJSON, createSeries, getNativeChart, getOptions, getSelectedPoints, getSelectedSeries, getSeries, getSeries, getSVG, getXAxis, getXAxis, getYAxis, getYAxis, getZAxis, getZAxis, hideLoading, isPersistent, isRendered, onLoad, onUnload, print, redraw, reflow, removeAllSeries, removeAllSeries, removeSeries, removeSeries, setAlignTicks, setAnimation, setAnimation, setAreaPlotOptions, setAreaRangePlotOptions, setAreaSplinePlotOptions, setAreaSplineRangePlotOptions, setBackgroundColor, setBackgroundColor, setBarPlotOptions, setBorderColor, setBorderColor, setBorderRadius, setBorderWidth, setBoxPlotOptions, setBubblePlotOptions, setChartSubtitle, setChartSubtitleText, setChartTitle, setChartTitleText, setClassName, setClickEventHandler, setColorAxis, setColors, setColumnPlotOptions, setColumnRangePlotOptions, setCredits, setErrorBarPlotOptions, setExporting, setFunnelPlotOptions, setGaugePlotOptions, setHeatmapPlotOptions, setHeight, setHeight100, setIgnoreHiddenSeries, setInverted, setLabelItems, setLabelsStyle, setLegend, setLinePlotOptions, setLoadEventHandler, setLoading, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setNavigation, setOption, setPersistent, setPiePlotOptions, setPinchType, setPlotBackgroundColor, setPlotBackgroundColor, setPlotBackgroundImage, setPlotBorderColor, setPlotBorderColor, setPlotBorderWidth, setPlotShadow, setPolar, setPyramidPlotOptions, setRedrawEventHandler, setReflow, setResetZoomButton, setScatterPlotOptions, setSelectionEventHandler, setSelectionMarkerFill, setSelectionMarkerFill, setSeriesPlotOptions, setShadow, setShowAxes, setSize, setSize, setSize, setSizeToMatchContainer, setSolidGaugePlotOptions, setSpacingBottom, setSpacingLeft, setSpacingRight, setSpacingTop, setSplinePlotOptions, setStyle, setSymbols, setTitle, setToolTip, setTreemapPlotOptions, setType, setWaterfallPlotOptions, setWidth, setWidth100, setZoomType, showLoading
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StockChart

public StockChart()
Create a new Highstock 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 setting properties of the chart (e.g. BaseChart.setType(org.moxieapps.gwt.highcharts.client.Series.Type), BaseChart.setBackgroundColor(String), BaseChart.setOption(String, Object), etc.) then support method chaining, allowing for syntax like the following:

 StockChart chart = new StockChart()
    .setChartTitleText("Nice Chart")
    .setMarginRight(10);
 RootPanel.get().add(chart);
 

Method Detail

getChartTypeName

protected String getChartTypeName()
Description copied from class: BaseChart
To be overridden in a sub class to return the JS type name of the chart instance that should be created when the chart is rendered. E.g. "Chart", "StockChart", etc.

Specified by:
getChartTypeName in class BaseChart<StockChart>
Returns:
The name of the JS class type that should be created when this chart is rendered.

getNavigator

public Navigator getNavigator()
Access the StockChart's Navigator, for customization.

Returns:
A reference to the stock chart's Navigator
Since:
1.5.0

setRangeSelector

public StockChart setRangeSelector(RangeSelector rangeSelector)
Convenience method for setting the 'rangeSelector' chart options. Equivalent to:

     stockChart.setOption("/rangeSelector/selected", 1);
     stockChart.setOption("/rangeSelector/inputEnabled", false);
     etc...
 

Parameters:
rangeSelector - Sets the chart range selector options.
Returns:
A reference to this StockChart instance for convenient method chaining.

setScrollbar

public StockChart setScrollbar(Scrollbar scrollbar)
Convenience method for setting the 'scrollbar' chart options. Equivalent to:

     stockChart.setOption("/scrollbar/enabled", false);
     stockChart.setOption("/scrollbar/height", 2);
     etc...
 

Parameters:
scrollbar - Sets the scrollbar options
Returns:
A reference to this StockChart instance for convenient method chaining.
Since:
1.6.0

setOHLCPlotOptions

public StockChart setOHLCPlotOptions(OHLCPlotOptions ohlcPlotOptions)
Updates the options that all OHLC type series within the chart will use by default. The settings can then be overridden for each individual series via the Series.setPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions) method.

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.)

Parameters:
ohlcPlotOptions - The options to set on the chart as the default settings for all OHLC type series that are part of this chart.
Returns:
A reference to this StockChart instance for convenient method chaining.
Since:
1.4.0

setCandlestickPlotOptions

public StockChart setCandlestickPlotOptions(CandlestickPlotOptions candlestickPlotOptions)
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 Series.setPlotOptions(org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions) method.

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.)

Parameters:
candlestickPlotOptions - The options to set on the chart as the default settings for all candlestick type series that are part of this chart.
Returns:
A reference to this StockChart instance for convenient method chaining.
Since:
1.6.0


Copyright © 2015. All Rights Reserved.