org.moxieapps.gwt.highcharts.client
Class Chart

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<Chart>
              extended by org.moxieapps.gwt.highcharts.client.Chart
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 Chart
extends BaseChart<Chart>

The main GWT widget that can be constructed and then configured in order to add a Highcharts chart into a GWT layout container. Note that only standard chart types can be created with this widget. See the StockChart for other available chart types. Basic usage is as follows:


 Chart chart = new Chart()
    .setType(Series.Type.SPLINE)
    .setChartTitleText("Nice Chart")
    .setMarginRight(10);
 Series series = chart.createSeries()
   .addPoint(40)
   .addPoint(35)
   .addPoint(60);
 chart.addSeries(series);
 RootPanel.get().add(chart);
 
For details on available options see the Highcharts reference.

Note that in order for this widget to function you must have included the Highcharts 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/highcharts.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 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
static class Chart.PanKey
          An enumeration of the known supported keys which are passed to the setPanKey(PanKey)used as a "panKey" which, when down, switches from zooming to panning.
static class Chart.ZoomType
          An enumeration of supported chart zoom types, which can be passed to the setZoomType(ZoomType) method.
 
Nested classes/interfaces inherited from class org.moxieapps.gwt.highcharts.client.BaseChart
BaseChart.PinchType
 
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
Chart()
          Create a new Highcharts 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.
 Chart setDrilldown(Drilldown drilldown)
          Convenience method for setting the 'drilldown' options for the chart which represents a collection of options that apply to standard charts.
 Chart setNoData(NoData noData)
          Convenience method for setting the 'noData' option of the chart.
 Chart setOptions3D(Options3D options3d)
          Convenience method for setting the 'options3d' options for the chart, which represents a collection of options that apply only to standard charts.
 Chart setPane(Pane pane)
          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.
 Chart setPanKey(Chart.PanKey panKey)
          Convenience method for setting the 'panKey' option of the chart.
 Chart setPanning(Boolean panning)
          Convenience method for setting the 'panning' option of the chart.
 Chart setPolar(boolean polar)
          Convenience method for setting the 'polar' option of the chart.
 Chart setZoomType(Chart.ZoomType zoomType)
          Deprecated. Use BaseChart.setZoomType(BaseChart.ZoomType)
 
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, 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

Chart

public 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 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:

 Chart chart = new Chart()
    .setType(Series.Type.SPLINE)
    .setChartTitleText("Nice Chart")
    .setMarginRight(10);
 RootPanel.get().add(chart);
 

Method Detail

setDrilldown

public Chart setDrilldown(Drilldown drilldown)
Convenience method for setting the 'drilldown' options for the chart which represents a collection of options that apply to standard charts.

Parameters:
drilldown - The drilldown options to apply to the chart.
Returns:
A reference to this Chart instance for convenient method chaining.

setNoData

public Chart setNoData(NoData noData)
Convenience method for setting the 'noData' option of the chart.

Parameters:
noData - The noData options to apply to the chart.
Returns:
A reference to this Chart instance for convenient method chaining.

setOptions3D

public Chart setOptions3D(Options3D options3d)
Convenience method for setting the 'options3d' options for the chart, which represents a collection of options that apply only to standard charts.

Parameters:
options3d - The 3D options to apply to the chart.
Returns:
A reference to this Chart instance for convenient method chaining.

setPane

public Chart setPane(Pane pane)
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.

Note: many of the pane options are only available if the highcharts-more.js script is included in your GWT module. E.g.:

<script type="text/javascript" src="js/highcharts-more.js"></script>

Parameters:
pane - The pane options to apply to the chart.
Returns:
A reference to this Chart instance for convenient method chaining.
Since:
1.5.0

setPanKey

public Chart setPanKey(Chart.PanKey panKey)
Convenience method for setting the 'panKey' option of the chart. Equivalent to:

     chart.setOption("panKey", "shift");
 
Allows setting a key to switch between zooming and panning.

Parameters:
panKey - the key used to switch zooming to panning.
Returns:
A reference to this Chart instance for convenient method chaining.
Since:
1.7.0

setPanning

public Chart setPanning(Boolean panning)
Convenience method for setting the 'panning' option of the chart. Equivalent to:

     chart.setOption("panning", true);
 
Allow panning in a chart. Best used with panKey to combine zooming and panning. Defaults to false.

Parameters:
panning - the value to set as the 'panning' option on the chart.
Returns:
A reference to this Chart instance for convenient method chaining.
Since:
1.7.0

setPolar

public Chart setPolar(boolean polar)
Convenience method for setting the 'polar' option of the chart. Equivalent to:

     chart.setOption("/chart/polar", true);
 
When true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system. Defaults to false.

Note: this option is only available if the highcharts-more.js script is included in your GWT module.

Overrides:
setPolar in class BaseChart<Chart>
Parameters:
polar - The value to set as the 'polar' option on the chart.
Returns:
A reference to this Chart instance for convenient method chaining.
Since:
1.6.0

setZoomType

public Chart setZoomType(Chart.ZoomType zoomType)
Deprecated. Use BaseChart.setZoomType(BaseChart.ZoomType)

Sets which dimensions the user can zoom by dragging the mouse. Can be one of Chart.ZoomType.X, Chart.ZoomType.Y or Chart.ZoomType.X_AND_Y. Defaults to null. This is equivalent to setting the option manually with code like:

     chart.setOption("/chart/zoomType", Chart.ZoomType.X);
 

Parameters:
zoomType - One of the allowed zoom types.
Returns:
A reference to this Chart instance for convenient method chaining.

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<Chart>
Returns:
The name of the JS class type that should be created when this chart is rendered.


Copyright © 2015. All Rights Reserved.