com.extjs.gxt.charts.client.model
Class ChartModel

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.BaseModelData
      extended by com.extjs.gxt.ui.client.data.BaseModel
          extended by com.extjs.gxt.charts.client.model.ChartModel
All Implemented Interfaces:
ChangeEventSource, Model, ModelData, java.io.Serializable

public class ChartModel
extends BaseModel

This is the OFC chart model.

Use this model to configure chart title, axes, legends, labels, and draw-able elements in your chart. You add an chart type to the chart model, for example...

 ChartModel cm = new ChartModel("Sales by Region");
 PieChart pie = new PieChart();
 pie.addValues(10, 30, 40, 20);
 cm.addChartConfig(pie);
 

See Also:
Chart.setChartModel(ChartModel), Serialized Form

Field Summary
 
Fields inherited from class com.extjs.gxt.ui.client.data.BaseModel
changeEventSupport
 
Fields inherited from class com.extjs.gxt.ui.client.data.BaseModelData
allowNestedValues, map
 
Fields inherited from interface com.extjs.gxt.ui.client.data.ChangeEventSource
Add, Remove, Update
 
Constructor Summary
ChartModel()
          Creates a new chart model instance.
ChartModel(java.lang.String titleText)
          Creates a new chart model instance with the given title.
ChartModel(java.lang.String titleText, java.lang.String style)
          Creates a new chart model instance with the given title and style.
 
Method Summary
 void addChartConfig(ChartConfig... config)
          Adds a chart config to the list of configs.
 void addChartConfig(java.util.Collection<ChartConfig> collection)
          Adds a collection of chart configs.
 java.lang.String getBackgroundColour()
          Returns the current background colour
 java.util.List<ChartConfig> getChartConfigs()
          Returns the chart configs.
 Legend getLegend()
          Returns the chart legend.
 java.lang.Integer getNumDecimals()
          Returns the number of decimals.
 RadarAxis getRadarAxis()
          Returns the current radar axis.
 ScaleProvider getScaleProvider()
          Returns the scale provider.
 ScaleProvider getScaleProviderRightAxis()
          Returns the scale provider of the right axis.
 Text getTitle()
          Returns the current title.
 ToolTip getTooltipStyle()
          Returns the tooltip style.
 XAxis getXAxis()
          Returns the x-axis.
 Text getXLegend()
          Get the current x-legend Text
 YAxis getYAxis()
          Returns the current y-axis (left side).
 YAxis getYAxisRight()
          Return the current y-axis (right side).
 Text getYLegend()
          Returns the y-legend.
 Text getYRightLegend()
          Returns the right y-legend.
 java.lang.Boolean isDecimalSeparatorComma()
          Returns true if a decimal separator comma is enabled.
 boolean isEnableEvents()
          Returns true if click events are enabled.
 java.lang.Boolean isFixedNumDecimalsForced()
          Returns true if fixed number of decimals is enabled.
 java.lang.Boolean isThousandSeparatorDisabled()
          Returns true if the thousands separator is enabled.
 boolean removeChartConfig(ChartConfig chartConfig)
          Removes a chart config from the list of configs.
 void setBackgroundColour(java.lang.String backgroudColor)
          Sets the chart background colour in HTML hex format (#ffffff).
 void setChartConfigs(java.util.Collection<ChartConfig> collection)
          Clears and then sets the list of chart configs.
 void setDecimalSeparatorComma(boolean useComma)
          True to use a decimal separator comma.
 void setEnableEvents(boolean enableEvents)
          True to globally enable click events (defaults to false).
 void setFixedNumDecimalsForced(boolean fixed)
          True to force fixed number of decimals.
 void setLegend(Legend legend)
          Sets the chart legend
 void setNumDecimals(java.lang.Integer numDecimals)
          Sets the number of decimals.
 void setRadarAxis(RadarAxis radarAxis)
          Sets the radar axis.
 void setScaleProvider(ScaleProvider scaleProvider)
          Optionally, sets the scale provider used to manage the min, max, and interval of the y-axis.
 void setScaleProviderRightAxis(ScaleProvider scaleProviderRightAxis)
          Optionally, sets the scale provider used to manage the min, max, and interval of the right y-axis.
 void setThousandSeparatorDisabled(boolean disabled)
          Sets whether the thousand separator is disabled.
 void setTitle(Text title)
          Sets the title.
 void setTooltipStyle(ToolTip tooltip)
          Sets the tooltip style.
 void setXAxis(XAxis xAxis)
          Sets the x-axis.
 void setXLegend(Text xLegend)
          Sets the x-legend.
 void setYAxis(YAxis yAxis)
          Sets the left y-axis.
 void setYAxisLabelStyle(java.lang.Integer size, java.lang.String colour)
          Sets the y-axis label style.
 void setYAxisRight(YAxis yAxis)
          Sets the right y-axis.
 void setYAxisRightLabelStyle(java.lang.Integer size, java.lang.String colour)
          Sets the right y-axis label style.
 void setYLegend(Text yLegend)
          Sets the y-legend.
 void setYRightLegend(Text yLegend)
          Sets the right y-legend.
 void updateYScale()
           
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseModel
addChangeListener, addChangeListener, fireEvent, fireEvent, isSilent, notify, notifyPropertyChanged, remove, removeChangeListener, removeChangeListeners, set, setSilent
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseModelData
get, get, getProperties, getPropertyNames, isAllowNestedValues, setAllowNestedValues, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.extjs.gxt.ui.client.data.ModelData
get, getProperties, getPropertyNames
 

Constructor Detail

ChartModel

public ChartModel()
Creates a new chart model instance.


ChartModel

public ChartModel(java.lang.String titleText)
Creates a new chart model instance with the given title.

Parameters:
titleText - the chart title

ChartModel

public ChartModel(java.lang.String titleText,
                  java.lang.String style)
Creates a new chart model instance with the given title and style.

Parameters:
titleText - the chart title
style - the chart style (ex. 'font-size: 14px; text-align: center')
Method Detail

addChartConfig

public void addChartConfig(ChartConfig... config)
Adds a chart config to the list of configs.

Parameters:
config - the chart configs

addChartConfig

public void addChartConfig(java.util.Collection<ChartConfig> collection)
Adds a collection of chart configs.

Parameters:
collection - the collection of chart configs

getBackgroundColour

public java.lang.String getBackgroundColour()
Returns the current background colour

Returns:
the background colour

getChartConfigs

public java.util.List<ChartConfig> getChartConfigs()
Returns the chart configs.

Returns:
the chart configs

getLegend

public Legend getLegend()
Returns the chart legend.

Returns:
the legend

getNumDecimals

public java.lang.Integer getNumDecimals()
Returns the number of decimals.

Returns:
the number of decimals

getRadarAxis

public RadarAxis getRadarAxis()
Returns the current radar axis.

Returns:
the radar axis

getScaleProvider

public ScaleProvider getScaleProvider()
Returns the scale provider.

Returns:
the scale provider

getScaleProviderRightAxis

public ScaleProvider getScaleProviderRightAxis()
Returns the scale provider of the right axis.

Returns:
the scale provider

getTitle

public Text getTitle()
Returns the current title.

Returns:
the title

getTooltipStyle

public ToolTip getTooltipStyle()
Returns the tooltip style.

Returns:
the tooltip

getXAxis

public XAxis getXAxis()
Returns the x-axis.

Returns:
the x-axis

getXLegend

public Text getXLegend()
Get the current x-legend Text

Returns:
the x-legend

getYAxis

public YAxis getYAxis()
Returns the current y-axis (left side).

Returns:
the y-axis

getYAxisRight

public YAxis getYAxisRight()
Return the current y-axis (right side).

Returns:
the y-axis

getYLegend

public Text getYLegend()
Returns the y-legend.

Returns:
the y-legend

getYRightLegend

public Text getYRightLegend()
Returns the right y-legend.

Returns:
the right y-legend

isDecimalSeparatorComma

public java.lang.Boolean isDecimalSeparatorComma()
Returns true if a decimal separator comma is enabled.

Returns:
the decimal separator state

isEnableEvents

public boolean isEnableEvents()
Returns true if click events are enabled.

Returns:
true if click events are enabled

isFixedNumDecimalsForced

public java.lang.Boolean isFixedNumDecimalsForced()
Returns true if fixed number of decimals is enabled.

Returns:
true if fixed

isThousandSeparatorDisabled

public java.lang.Boolean isThousandSeparatorDisabled()
Returns true if the thousands separator is enabled.

Returns:
the thousands separator state

removeChartConfig

public boolean removeChartConfig(ChartConfig chartConfig)
Removes a chart config from the list of configs.

Parameters:
chartConfig - the chart config
Returns:
true if an element was removed

setBackgroundColour

public void setBackgroundColour(java.lang.String backgroudColor)
Sets the chart background colour in HTML hex format (#ffffff). Set to "-1" to set transparent.

Parameters:
backgroudColor - the background color

setChartConfigs

public void setChartConfigs(java.util.Collection<ChartConfig> collection)
Clears and then sets the list of chart configs.

Parameters:
collection - the chart configs

setDecimalSeparatorComma

public void setDecimalSeparatorComma(boolean useComma)
True to use a decimal separator comma.

Parameters:
useComma - true to enable the separator comma

setEnableEvents

public void setEnableEvents(boolean enableEvents)
True to globally enable click events (defaults to false). Alternatively, ChartConfig.setEnableEvents(boolean) can be used to enable click events at the individual chart level.

Parameters:
enableEvents - true to enable click event

setFixedNumDecimalsForced

public void setFixedNumDecimalsForced(boolean fixed)
True to force fixed number of decimals.

Parameters:
fixed - true to force fixed number of decimals

setLegend

public void setLegend(Legend legend)
Sets the chart legend

Parameters:
legend - the legend

setNumDecimals

public void setNumDecimals(java.lang.Integer numDecimals)
Sets the number of decimals.

Parameters:
numDecimals - the number of decimals

setRadarAxis

public void setRadarAxis(RadarAxis radarAxis)
Sets the radar axis.

Parameters:
radarAxis - the radar axis

setScaleProvider

public void setScaleProvider(ScaleProvider scaleProvider)
Optionally, sets the scale provider used to manage the min, max, and interval of the y-axis.

Parameters:
scaleProvider - the scale provider

setScaleProviderRightAxis

public void setScaleProviderRightAxis(ScaleProvider scaleProviderRightAxis)
Optionally, sets the scale provider used to manage the min, max, and interval of the right y-axis.

Parameters:
scaleProviderRightAxis - the scale provider

setThousandSeparatorDisabled

public void setThousandSeparatorDisabled(boolean disabled)
Sets whether the thousand separator is disabled.

Parameters:
disabled - true for disabled

setTitle

public void setTitle(Text title)
Sets the title.

Parameters:
title - title

setTooltipStyle

public void setTooltipStyle(ToolTip tooltip)
Sets the tooltip style.

Parameters:
tooltip - the new tooltip

setXAxis

public void setXAxis(XAxis xAxis)
Sets the x-axis.

Parameters:
xAxis - the x-axis

setXLegend

public void setXLegend(Text xLegend)
Sets the x-legend.

Parameters:
xLegend - the x-legend

setYAxis

public void setYAxis(YAxis yAxis)
Sets the left y-axis.

Parameters:
yAxis - the y-axis

setYAxisLabelStyle

public void setYAxisLabelStyle(java.lang.Integer size,
                               java.lang.String colour)
Sets the y-axis label style.

Parameters:
size - the size
colour - the label colour

setYAxisRight

public void setYAxisRight(YAxis yAxis)
Sets the right y-axis.

Parameters:
yAxis - the right y-axis

setYAxisRightLabelStyle

public void setYAxisRightLabelStyle(java.lang.Integer size,
                                    java.lang.String colour)
Sets the right y-axis label style.

Parameters:
size - the size
colour - the label colour

setYLegend

public void setYLegend(Text yLegend)
Sets the y-legend.

Parameters:
yLegend - the y-legend

setYRightLegend

public void setYRightLegend(Text yLegend)
Sets the right y-legend.

Parameters:
yLegend - the right yLegend

updateYScale

public void updateYScale()