com.rednels.ofcgwt.client.model
Class ChartData

java.lang.Object
  extended by com.rednels.ofcgwt.client.model.ChartData
All Implemented Interfaces:
JSONizable

public class ChartData
extends java.lang.Object
implements JSONizable

This is the most important class in the ofcgwt library. Start here, configuring the title, axes, legends, labels, and draw-able elements in your chart. You add an element to the chart data, for example...

 ChartData cd = new ChartData("Sales by Region");
 PieChart pie = new PieChart();
 pie.addValues(10, 30, 40, 20);
 cd.addElements(pie);
 
When finished, call toString() and the GWT JSON objects will convert the chart data into a formatted OFC2 JSON data string.


Constructor Summary
ChartData()
          Creates a new chart data instance.
ChartData(java.lang.String titleText)
          Creates a new chart data instance with the given title.
ChartData(java.lang.String titleText, java.lang.String style)
          Creates a new chart data instance with the given title and style.
 
Method Summary
 void addElements(java.util.Collection<Element> collection)
          Adds a collection of chart elements to the list of elements
 void addElements(Element... e)
          Adds an element to the list of elements
 com.google.gwt.json.client.JSONValue buildJSON()
          Build (and return) a JSONObject that contains all the items of this object.
 java.lang.String getBackgroundColour()
          Get the current background colour
 java.util.Collection<Element> getElements()
          Get the current elements collection
 Legend getLegend()
          Get the current chart legend
 java.lang.Integer getNumDecimals()
           
 RadarAxis getRadarAxis()
          Get the current RadarAxis object
 Text getTitle()
          Get the current title Text
 ToolTip getTooltip()
          Gets the tooltip.
 XAxis getXAxis()
          Get the current XAxis object
 Text getXLegend()
          Get the current x legend Text
 YAxis getYAxis()
          Get the current YAxis object (left side)
 YAxis getYAxisRight()
          Get the current YAxis object (right side)
 Text getYLegend()
          Get the current y legend Text
 Text getYRightLegend()
          Get the current y right legend Text
 boolean isDecimalSeparatorComma()
           
 boolean isFixedNumDecimalsForced()
           
 boolean isThousandSeparatorDisabled()
           
 boolean removeElement(Element e)
          Removes an element from the list of elements
 void setBackgroundColour(java.lang.String bg_colour)
          Sets the chart background colour in HTML hex format (#ffffff).
 void setDecimalSeparatorComma(boolean isDecimalSeparatorComma)
           
 void setElements(java.util.Collection<Element> elements)
          Clears and then sets the list of elements to this collection
 void setFixedNumDecimalsForced(boolean isFixedNumDecimalsForced)
           
 void setLegend(Legend legend)
          Sets the chart legend
 void setNumDecimals(java.lang.Integer numDecimals)
           
 void setRadarAxis(RadarAxis radar_axis)
          Sets the RadarAxis to this RadarAxis object
 void setThousandSeparatorDisabled(boolean isThousandSeparatorDisabled)
           
 void setTitle(Text title)
          Sets the title to this Text object
 void setTooltip(ToolTip tooltip)
          Sets the tooltip.
 void setXAxis(XAxis x_axis)
          Sets the XAxis to this XAxis object
 void setXLegend(Text x_legend)
          Sets the x legend to this Text object
 void setYAxis(YAxis y_axis)
          Sets the left YAxis to this YAxis object
 void setYAxisLabelStyle(java.lang.Integer size, java.lang.String colour)
          Sets the y axis label style.
 void setYAxisRight(YAxis y_axis_right)
          Sets the right YAxis to this YAxis object
 void setYAxisRightLabelStyle(java.lang.Integer size, java.lang.String colour)
          Sets the y axis right label style.
 void setYLegend(Text y_legend)
          Sets the y legend to this Text object
 void setYRightLegend(Text y2_legend)
          Sets the y right legend to this Text object
 java.lang.String toString()
          Returns the json formatted string of this chart data object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChartData

public ChartData()
Creates a new chart data instance.


ChartData

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

Parameters:
titleText -

ChartData

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

Parameters:
titleText -
style -
Method Detail

addElements

public void addElements(java.util.Collection<Element> collection)
Adds a collection of chart elements to the list of elements

Parameters:
collection - of type Element

addElements

public void addElements(Element... e)
Adds an element to the list of elements

Parameters:
e - the element

buildJSON

public com.google.gwt.json.client.JSONValue buildJSON()
Description copied from interface: JSONizable
Build (and return) a JSONObject that contains all the items of this object. If required, will call.buildJSON() on any contained JSONizable objects, thus producing an entire JSON tree.

Specified by:
buildJSON in interface JSONizable
Returns:
the JSONObject

getBackgroundColour

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

Returns:
String background colour

getElements

public java.util.Collection<Element> getElements()
Get the current elements collection

Returns:
Element collection

getLegend

public Legend getLegend()
Get the current chart legend

Returns:
Legend chart legend

getNumDecimals

public java.lang.Integer getNumDecimals()
Returns:
the numDecimals

getRadarAxis

public RadarAxis getRadarAxis()
Get the current RadarAxis object

Returns:
RadarAxis object

getTitle

public Text getTitle()
Get the current title Text

Returns:
Text title

getTooltip

public ToolTip getTooltip()
Gets the tooltip.

Returns:
the tooltip

getXAxis

public XAxis getXAxis()
Get the current XAxis object

Returns:
XAxis object

getXLegend

public Text getXLegend()
Get the current x legend Text

Returns:
Text x legend

getYAxis

public YAxis getYAxis()
Get the current YAxis object (left side)

Returns:
YAxis object

getYAxisRight

public YAxis getYAxisRight()
Get the current YAxis object (right side)

Returns:
YAxis object

getYLegend

public Text getYLegend()
Get the current y legend Text

Returns:
Text y legend

getYRightLegend

public Text getYRightLegend()
Get the current y right legend Text

Returns:
Text y right legend

isDecimalSeparatorComma

public boolean isDecimalSeparatorComma()
Returns:
the isDecimalSeparatorComma

isFixedNumDecimalsForced

public boolean isFixedNumDecimalsForced()
Returns:
the isFixedNumDecimalsForced

isThousandSeparatorDisabled

public boolean isThousandSeparatorDisabled()
Returns:
the isThousandSeparatorDisabled

removeElement

public boolean removeElement(Element e)
Removes an element from the list of elements

Parameters:
e - the element
Returns:
true if an element was removed as a result of this call

setBackgroundColour

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

Parameters:
bg_colour - String colour

setDecimalSeparatorComma

public void setDecimalSeparatorComma(boolean isDecimalSeparatorComma)
Parameters:
isDecimalSeparatorComma - the isDecimalSeparatorComma to set

setElements

public void setElements(java.util.Collection<Element> elements)
Clears and then sets the list of elements to this collection

Parameters:
elements - Collection

setFixedNumDecimalsForced

public void setFixedNumDecimalsForced(boolean isFixedNumDecimalsForced)
Parameters:
isFixedNumDecimalsForced - the isFixedNumDecimalsForced to set

setLegend

public void setLegend(Legend legend)
Sets the chart legend

Parameters:
legend - Legend object

setNumDecimals

public void setNumDecimals(java.lang.Integer numDecimals)
Parameters:
numDecimals - the numDecimals to set

setRadarAxis

public void setRadarAxis(RadarAxis radar_axis)
Sets the RadarAxis to this RadarAxis object

Parameters:
radar_axis - RadarAxis object

setThousandSeparatorDisabled

public void setThousandSeparatorDisabled(boolean isThousandSeparatorDisabled)
Parameters:
isThousandSeparatorDisabled - the isThousandSeparatorDisabled to set

setTitle

public void setTitle(Text title)
Sets the title to this Text object

Parameters:
title - Text object

setTooltip

public void setTooltip(ToolTip tooltip)
Sets the tooltip.

Parameters:
tooltip - the new tooltip

setXAxis

public void setXAxis(XAxis x_axis)
Sets the XAxis to this XAxis object

Parameters:
x_axis - XAxis object

setXLegend

public void setXLegend(Text x_legend)
Sets the x legend to this Text object

Parameters:
x_legend - Text object

setYAxis

public void setYAxis(YAxis y_axis)
Sets the left YAxis to this YAxis object

Parameters:
y_axis - YAxis object

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 y_axis_right)
Sets the right YAxis to this YAxis object

Parameters:
y_axis_right - YAxis object

setYAxisRightLabelStyle

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

Parameters:
size - the size
colour - the label colour

setYLegend

public void setYLegend(Text y_legend)
Sets the y legend to this Text object

Parameters:
y_legend - Text object

setYRightLegend

public void setYRightLegend(Text y2_legend)
Sets the y right legend to this Text object

Parameters:
y2_legend - Text object

toString

public java.lang.String toString()
Returns the json formatted string of this chart data object. Calls.buildJSON()

Overrides:
toString in class java.lang.Object
Returns:
json string