com.googlecode.gchart.client
Class GChart

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.googlecode.gchart.client.GChart
All Implemented Interfaces:
com.google.gwt.user.client.EventListener

public class GChart
extends com.google.gwt.user.client.ui.Composite

A GChart can represent and display a line chart, a bar chart, a pie chart, an area chart, or a chart that contains arbitrary combinations of line, bar, pie, and/or area based curves.

For detailed examples, with screen shots, visit the Chart Gallery.

For detailed instructions on how to integrate Client-side GChart into your GWT application, see Installing Client-side GChart.

CSS Style Rule

It is sometimes more natural to consider certain CSS attributes as properties of a GChart Java object. So, GChart supports "CSS convenience methods" that let you (optionally) use Java to specify GChart CSS attributes such as border-color and background-color. See USE_CSS for a detailed description of these CSS convenience methods, and how to assure that they don't interfere with more traditional, CSS attribute-based, specifications.


Nested Class Summary
static class GChart.AnnotationLocation
          Defines the location of a data point's annotation (text label) relative to the location of that point's symbol.
 class GChart.Axis
          Represents an axis of the chart, for example, the x, y, or y2 axis.
 class GChart.Curve
          Represents a curve on a chart, which includes information such as the x,y coordinates of each point, the symbol used to represent points on the curve, etc.
static class GChart.Point
          Represents a single point on one of the chart's curves.
 class GChart.Symbol
          Defines a chart curve symbol.
static class GChart.SymbolType
          Specifies the type of symbol used by a curve.
 class GChart.XAxis
          The x-axis of a GChart.
 class GChart.Y2Axis
          The right, or "y2", axis of a GChart.
 class GChart.YAxis
          The left y-axis of a GChart.
 
Field Summary
static int DEFAULT_ANNOTATION_FONTSIZE
          Default size, in pixels, of text used to annotate individual plotted points on a curve.
static java.lang.String DEFAULT_BLANK_IMAGE_URL
          The default URL GChart will use to access the blank image (specifically, a 1 x 1 pixel transparent GIF) it requires to prevent "missing image" icons from appearing in your charts.
static java.lang.String DEFAULT_FONT_COLOR
          The default color of any text appearing in a chart's legend, annotations, or tick labels.
static java.lang.String DEFAULT_FONT_STYLE
           
static java.lang.String DEFAULT_FONT_WEIGHT
           
static java.lang.String DEFAULT_GRID_COLOR
          The default color used for all axes, gridlines, and ticks.
static java.lang.String DEFAULT_HOVERTEXT_TEMPLATE
          The default template string used to generate the hovertext displayed when the user hovers their mouse above a point on a curve.
static java.lang.String DEFAULT_LEGEND_BACKGROUND_COLOR
          Default color of background of the chart legend
static java.lang.String DEFAULT_LEGEND_BORDER_COLOR
          Default color of border around the chart legend
static java.lang.String DEFAULT_LEGEND_BORDER_STYLE
          Default style of border around the chart legend
static int DEFAULT_LEGEND_BORDER_WIDTH
          Default width of border around the chart legend
static int DEFAULT_LEGEND_FONTSIZE
          The default fontsize of text that appears in the chart's legend (key).
static double DEFAULT_PIE_SLICE_FILL_SPACING
          The default "spacing" between corresponding edges of the rectangular elements used to simulate continuous fill of pie slices.
static int DEFAULT_PIE_SLICE_FILL_THICKNESS
          The default "thickness" of the rectangular elements used to simulate continous fill of pie slices.
static java.lang.String DEFAULT_PIE_SLICE_HOVERTEXT_TEMPLATE
          The default hovertext template used by symbols when they have a symbol type of of the form PIE_SLICE_*.
static java.lang.String DEFAULT_PLOTAREA_BACKGROUND_COLOR
          The default background color used for the chart's plot area if none is specified.
static java.lang.String DEFAULT_PLOTAREA_BORDER_COLOR
          The default border color used for the chart's plot area if none is specified.
static java.lang.String DEFAULT_PLOTAREA_BORDER_STYLE
          The default style of the border around the chart's plot area if none is specified.
static int DEFAULT_PLOTAREA_BORDER_WIDTH
          The default width of the border around the chart's plot area if none is specified.
static java.lang.String DEFAULT_SYMBOL_BACKGROUND_COLOR
          The default CSS background color used for symbols if none is specified.
static java.lang.String[] DEFAULT_SYMBOL_BORDER_COLORS
          The default CSS border colors used for symbols if none are specified.
static java.lang.String DEFAULT_SYMBOL_BORDER_STYLE
          The default CSS border style used for symbols if none is specified; this default is "solid".
static int DEFAULT_SYMBOL_BORDER_WIDTH
          The default CSS border width used for symbols if none is specified; this default is 1 pixel.
static double DEFAULT_SYMBOL_FILL_SPACING
          The default spacing between discrete, rectangular, elements used to simulate continous graphical objects, such as connecting lines in line charts or a shaded pie slice.
static int DEFAULT_SYMBOL_FILL_THICKNESS
          The default "thickness" of the rectangular elements used to simulate continous graphical objects, such as connecting lines in line charts.
static int DEFAULT_SYMBOL_HEIGHT
          The default height (including borders) used for symbols if none is specified; this default is the same as for DEFAULT_SYMBOL_WIDTH
static GChart.SymbolType DEFAULT_SYMBOL_TYPE
          The default symbol type for curve if none is specified; this default is BOX_CENTER
static int DEFAULT_SYMBOL_WIDTH
          The default width (including borders) used for symbols if none is specified.
static int DEFAULT_TICK_COUNT
          The default number of tick marks on each Axis.
static java.lang.String DEFAULT_TICK_LABEL_FONT_COLOR
          The default color (a CSS color specification) of tick labels
static int DEFAULT_TICK_LABEL_FONTSIZE
          The default fontsize (in pixels) of tick labels
static java.lang.String DEFAULT_TICK_LABEL_FORMAT
          The default GWT NumberFormat format string used to convert numbers to the text strings displayed as tick labels on X, Y, and Y2 axes.
static int DEFAULT_TICK_LENGTH
          The default length of tick marks, in pixels.
static int DEFAULT_TICK_THICKNESS
          The default thickness of tick marks, in pixels.
static int DEFAULT_X_CHARTSIZE
          The default width of the area of the chart in which curves are displayed, in pixels.
static int DEFAULT_Y_CHARTSIZE
          The default height of the area of the chart in which curves are displayed, in pixels.
static int NAI
          In analogy to how it uses Double.NaN (Not a Number), GChart uses NAI (Not an Integer) to represent integers whose values have not been explicitly specified.
static java.lang.String USE_CSS
          A special value used to tell GChart that a property should be defined via CSS, not via an explicit Java API specification.
static com.googlecode.gchart.client.GChart.YAxisId Y_AXIS
          Keyword used to indicate that a curve should be displayed on the left y-axis.
static com.googlecode.gchart.client.GChart.YAxisId Y2_AXIS
          Keyword used to indicate that a curve should be displayed on the right (the so-called y2) y-axis.
 
Constructor Summary
GChart()
          Convenience no-arg constructor equivalent to GChart(DEFAULT_X_CHARTSIZE,DEFAULT_Y_CHARTSIZE).
GChart(int xChartSize, int yChartSize)
          Instantiates a GChart with a curve display region of the specified size.
 
Method Summary
 void addCurve()
          Adds a new curve to the chart, at the end of the current list of curves.
 void addCurve(int iCurve)
          Adds a new curve to the chart, at the specified position in the curve sequence.
 void clearCurves()
          Removes every curve this chart contains.
 java.lang.String getBackgroundColor()
          Returns the background color of the chart as a whole.
static java.lang.String getBlankImageURL()
          Returns a URL that points to a 1 x 1 pixel blank image file GChart requires to render its charts without producing missing image icons.
 java.lang.String getBorderColor()
          Returns the color of the border around the chart as a whole.
 java.lang.String getBorderStyle()
          Returns the style of the border around the chart as a whole
 java.lang.String getBorderWidth()
          Returns the width of the border around the chart as a whole
 com.google.gwt.user.client.ui.Widget getChartFootnotes()
          Returns the previously specified chart footnotes widget
 com.google.gwt.user.client.ui.Widget getChartTitle()
          Returns the previously specified widget representing the chart's title.
 GChart.Curve getCurve()
          Convenience method equivalent to getCurve(getNCurves()-1).
 GChart.Curve getCurve(int iCurve)
          Returns a reference to the curve at the specified positional index.
 java.lang.String getFontFamily()
          Returns the font-family used in tick labels, point annotations, legends, and as the default in titles, footnotes, and axis labels.
 java.lang.String getGridColor()
          Returns CSS color specification for all gridlines, axes, and tickmarks.
 double getInitialPieSliceOrientation()
          Returns a previously specified initial pie slice orientation.
 java.lang.String getLegendBackgroundColor()
          Returns the background color of the chart's legend.
 java.lang.String getLegendBorderColor()
          Returns the border color of the chart's legend.
 java.lang.String getLegendBorderStyle()
          Returns the style of the chart's legend's border
 int getLegendBorderWidth()
          Returns the width of the chart's legend's border
 java.lang.String getLegendFontColor()
          Returns the color of the font used to display the labels within the legend (chart key)
 int getLegendFontSize()
          Returns the font size, in pixels, of text displayed in the chart's legend (also know as a chart's key).
 java.lang.String getLegendFontStyle()
          Returns the font-style in which this GChart's legend text will be rendered.
 java.lang.String getLegendFontWeight()
          Returns true if legend text will be rendered in a bold, or false if in normal, weight font.
 int getNCurves()
          Returns the number of curves on this chart.
 java.lang.String getPadding()
          Returns the CSS string that specifies the width of the padding between the chart and it's external border
 java.lang.String getPlotAreaBackgroundColor()
          Returns the background color of the area of the chart in which symbols representing curve data are displayed
 java.lang.String getPlotAreaBorderColor()
          Returns the border color of the area of the chart in which symbols representing curve data are displayed
 java.lang.String getPlotAreaBorderStyle()
          Returns the style of the border around the area of the chart in which symbols representing curve data are displayed (the so-called plot area).
 int getPlotAreaBorderWidth()
          Returns the width of the border around the area of the chart in which symbols representing curve data are displayed.
 boolean getShowOffChartPoints()
          Determinines if this chart will display points whose x,y locations are outside of the axis limits associated with the chart.
 GChart.Axis getXAxis()
          Returns the x-axis associated with this chart.
 int getXChartSize()
          Returns the number of x-pixels in the region of the chart used for curve display purposes.
 GChart.Axis getY2Axis()
          Returns the y2-axis (right y axis) associated with this chart.
 GChart.Axis getYAxis()
          Returns the (left) y-axis associated with this chart.
 int getYChartSize()
          Returns the number of y-pixels in the region of the chart used for curve display purposes.
 boolean hasY2Axis()
          Determines if this chart has a "y2" (right) y-axis.
 boolean hasYAxis()
          Determines if this chart has an ordinary, or left, y-axis.
 boolean isLegendVisible()
          Determines if the legend of this chart is visible.
 void removeCurve(int iCurve)
          Removes the curve at the specified positional index.
 void setBackgroundColor(java.lang.String cssColor)
          Specifies the background color of the chart as a whole.
static void setBlankImageURL(java.lang.String blankImageURL)
          Specifies a URL that points to the transparent, 1 x 1 pixel, "blank GIF" that GChart uses in order to render your chart without adding spurious "missing image" icons to it.
 void setBorderColor(java.lang.String cssColor)
          Specifies the color of the border around the chart as a whole.
 void setBorderStyle(java.lang.String borderStyle)
          Sets style of the border around the chart as a whole.
 void setBorderWidth(java.lang.String cssWidth)
          Specifies the width of the border around the chart as a whole.
 void setChartFootnotes(java.lang.String html)
          Convenience method equivalent to setChartFootnotes(new HTML(html)).
 void setChartFootnotes(com.google.gwt.user.client.ui.Widget chartFootnotes)
          Sets widget the appears centered just below the chart
 void setChartSize(int xChartSize, int yChartSize)
          Convenience method equivalent to setXChartSize(xChartSize); setYChartSize(yChartSize).
 void setChartTitle(java.lang.String html)
          Convenience method equivalent to setChartTitle(new HTML(html)).
 void setChartTitle(com.google.gwt.user.client.ui.Widget chartTitle)
          Specifies the widget that appears centered just above the chart.
 void setFontFamily(java.lang.String fontFamily)
          Sets the font-family used in tick labels, point annotations, legends, titles, footnotes, and axis labels.
 void setGridColor(java.lang.String cssColor)
          Specifies the single color used for all gridlines, axes lines, and tick marks.
 void setInitialPieSliceOrientation(double orientation)
          Sets the default initial orientation for pie slices.
 void setLegendBackgroundColor(java.lang.String cssColor)
          Sets the background color of the chart's legend.
 void setLegendBorderColor(java.lang.String cssColor)
          Sets the border color of the chart's legend.
 void setLegendBorderStyle(java.lang.String borderStyle)
          Sets style of the border around the chart's legend (key).
 void setLegendBorderWidth(int width)
          Sets the width of the chart legend's border.
 void setLegendFontColor(java.lang.String cssColor)
          Specifies the color of the legend's font.
 void setLegendFontSize(int legendFontSize)
          Specifies the font size, in pixels, of text displayed in the chart's legend (also know as a chart's key).
 void setLegendFontStyle(java.lang.String cssStyle)
          Specifies the cssStyle of the font used to render the legend's labels.
 void setLegendFontWeight(java.lang.String cssWeight)
          Specifies the weight of the font used in the labels of the legend.
 void setLegendVisible(boolean isLegendVisible)
          Specifies if the legend is to be visible on this chart.
 void setPadding(java.lang.String cssPadding)
          Specifies the amount of padding to add just inside of the chart's border, as a CSS padding specification string.
 void setPlotAreaBackgroundColor(java.lang.String cssColor)
          Specifies the background color of the area of the chart in which symbols representing curve data are displayed
 void setPlotAreaBorderColor(java.lang.String cssColor)
          Specifies the color of the border around the area of the chart in which symbols representing curve data are displayed.
 void setPlotAreaBorderStyle(java.lang.String borderStyle)
          Sets style of the border around the chart's plot area (the rectangular area where the curves are drawn).
 void setPlotAreaBorderWidth(int width)
          Specifies the width of the border around the area of the chart in which symbols representing curve data are displayed.
 void setShowOffChartPoints(boolean showOffChartPoints)
          Specifies if points falling outside the ranges defined by the chart's axis limits are to be visible or hidden.
 void setXChartSize(int xChartSize)
          Sets the number of pixels, in the horizontal dimension, available for curve display.
 void setYChartSize(int yChartSize)
          Sets the number of pixels, in the vertical dimension, available for curve display.
 void update()
          Builds a chart that reflects current user-specified chart specs (curve data, symbol choices, etc.)
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, onBrowserEvent, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_CSS

public static final java.lang.String USE_CSS
A special value used to tell GChart that a property should be defined via CSS, not via an explicit Java API specification.

This value is mainly used by GChart's "CSS convenience methods" which make it possible to use the Java API to specify certain properties of a GChart that can also be specified via CSS. When the value of the Java property is set to USE_CSS GChart ignores the API specification and allows the standard "CSS cascade" to define the property. The discussion below elaborates on why GChart supports CSS convenience methods, and how the USE_CSS keyword fits into that support.

CSS Convenience Methods and the GChart.USE_CSS keyword

Like all GWT Widgets, a GChart is both an object in a Java application, and an HTML element in a web page.

This duality naturally divides the properties of a GChart into three categories:

  1. Those you can access only via the Java API.
  2. Those you can access only via CSS and the DOM.
  3. Those you can access both ways.

I've used the following criteria to determine the access method appropriate for a given GChart property:

  1. Those properties that mainly define the chart itself--independent of its relationship to any containing web page--are exclusively accessed via the Java API

    For example, the x,y data values of a curve have everything to do with the chart itself and nothing to do with the enclosing web page, so all the defining x,y data of a curve can only be accessed via the Java API.

  2. Those properties that mainly define how the chart fits into the enclosing web page and have nothing to do with the chart itself are accessed exclusively via CSS stylesheets or the GWT DOM class.

    For example, how big of a margin should be placed around a GChart is only about how the GChart fits into the enclosing web page, so you must define a GChart's margins using a CSS stylesheet (or via the GWT DOM class)--there is no GChart.setMargin method.

  3. Finally, those properties that, in some situations are best viewed as part of the chart itself, and in other situations as defining how the chart fits into the enclosing web page can be accessed either via the Java API, or via CSS/DOM.

    For example, if you are focused on assuring that the chart has a the same border as every other element on the page, the border around the chart as a whole can be viewed as relating to how the chart fits into the enclosing web page. On the other hand, if you are focused on assuring that, like the frame around a picture, the border looks good around that particular chart, it makes more sense to view it as a part of the chart itself.

The Java API methods for GChart properties in this third category are known as "CSS convenience methods" because, though you could do the same thing by exploiting the "GChart as HTML element" perspective, these methods save you the trouble of looking up CSS syntax, splitting up your chart's specification between Java code and a CSS stylesheet, invoking a rather hard-to-remember method call in the GWT DOM class, etc.

Specifications made via the GChart Java API always take precedence over those made via stylesheets or the DOM class. To instruct GChart that you want one of these properties to be defined via CSS or the DOM, set the associated Java API property to the special value GChart.USE_CSS.

Fortunately, since USE_CSS is the default value for every one of these CSS convenience properties, if you never use the Java API to set them, you can use CSS to control them just as you would for a GWT widget that did not support convenience properties. Unfortunately, these CSS defaults rarely produce a great looking chart out of the box; the example CSS snippet below defines all of these convenience properties and attaches them to GChart's default CSS selector (aka stylename) in a way that I think looks better. A comment to the right of each line contains the corresponding CSS convenience-method call that has the same effect.

 .gchart-GChart {
   background-color: #DDF;   /* setBackgroundColor("#DDF"); */
   border-width: 1px;         /* setBorderWidth("1px"); */
   border-color: black;       /* setBorderColor("black"); */ 
   border-style: solid;       /* setBorderStyle("solid");  */ 
   font-family: Arial, sans-serif;  /* setFontFamily("Arial, sans-serif"); */
 }
 
Note that certain CSS convenience methods that could in principle have been added, such as those for defining the background image of a chart, were omitted because I thought they would almost never be used. Of course, you can always access these CSS properties "the old fashioned way" (via a CSS specification or methods of the GWT DOM class).

See Also:
setBorderColor, setBorderStyle, setBackgroundColor, setBorderWidth, setFontFamily, Constant Field Values

NAI

public static final int NAI
In analogy to how it uses Double.NaN (Not a Number), GChart uses NAI (Not an Integer) to represent integers whose values have not been explicitly specified.

See Also:
Constant Field Values

DEFAULT_ANNOTATION_FONTSIZE

public static final int DEFAULT_ANNOTATION_FONTSIZE
Default size, in pixels, of text used to annotate individual plotted points on a curve.

See Also:
Point.setFontSize, Constant Field Values

DEFAULT_LEGEND_BORDER_COLOR

public static final java.lang.String DEFAULT_LEGEND_BORDER_COLOR
Default color of border around the chart legend

See Also:
setLegendBorderColor, Constant Field Values

DEFAULT_LEGEND_BORDER_WIDTH

public static final int DEFAULT_LEGEND_BORDER_WIDTH
Default width of border around the chart legend

See Also:
setLegendBorderWidth, Constant Field Values

DEFAULT_LEGEND_BORDER_STYLE

public static final java.lang.String DEFAULT_LEGEND_BORDER_STYLE
Default style of border around the chart legend

See Also:
setLegendBorderStyle, Constant Field Values

DEFAULT_LEGEND_BACKGROUND_COLOR

public static final java.lang.String DEFAULT_LEGEND_BACKGROUND_COLOR
Default color of background of the chart legend

See Also:
setLegendBackgroundColor, Constant Field Values

DEFAULT_FONT_COLOR

public static final java.lang.String DEFAULT_FONT_COLOR
The default color of any text appearing in a chart's legend, annotations, or tick labels.

See Also:
setLegendFontColor, setTickLabelFontColor, setAnnotationFontColor, Constant Field Values

DEFAULT_FONT_STYLE

public static final java.lang.String DEFAULT_FONT_STYLE
See Also:
Constant Field Values

DEFAULT_FONT_WEIGHT

public static final java.lang.String DEFAULT_FONT_WEIGHT
See Also:
Constant Field Values

DEFAULT_HOVERTEXT_TEMPLATE

public static final java.lang.String DEFAULT_HOVERTEXT_TEMPLATE
The default template string used to generate the hovertext displayed when the user hovers their mouse above a point on a curve.

See Also:
setHovertextTemplate, Constant Field Values

DEFAULT_LEGEND_FONTSIZE

public static final int DEFAULT_LEGEND_FONTSIZE
The default fontsize of text that appears in the chart's legend (key).

See Also:
setTickLabelFontSize, getXAxis, getYAxis, getY2Axis, Constant Field Values

DEFAULT_PLOTAREA_BACKGROUND_COLOR

public static final java.lang.String DEFAULT_PLOTAREA_BACKGROUND_COLOR
The default background color used for the chart's plot area if none is specified.

See Also:
setPlotAreaBackgroundColor, Constant Field Values

DEFAULT_PLOTAREA_BORDER_COLOR

public static final java.lang.String DEFAULT_PLOTAREA_BORDER_COLOR
The default border color used for the chart's plot area if none is specified.

See Also:
setPlotAreaBorderColor, Constant Field Values

DEFAULT_PLOTAREA_BORDER_STYLE

public static final java.lang.String DEFAULT_PLOTAREA_BORDER_STYLE
The default style of the border around the chart's plot area if none is specified.

See Also:
setPlotAreaBorderStyle, Constant Field Values

DEFAULT_PLOTAREA_BORDER_WIDTH

public static final int DEFAULT_PLOTAREA_BORDER_WIDTH
The default width of the border around the chart's plot area if none is specified.

See Also:
setPlotAreaBorderWidth, Constant Field Values

DEFAULT_SYMBOL_BACKGROUND_COLOR

public static final java.lang.String DEFAULT_SYMBOL_BACKGROUND_COLOR
The default CSS background color used for symbols if none is specified.

See Also:
getSymbol, setBackgroundColor, Constant Field Values

DEFAULT_SYMBOL_BORDER_COLORS

public static final java.lang.String[] DEFAULT_SYMBOL_BORDER_COLORS
The default CSS border colors used for symbols if none are specified. These defaults are, in order of the curve's integer index: red, green, blue, fuchsia, aqua, teal, maroon, lime, navy, silver, olive, purple. This sequence repeats if there are more than 12 curves.

See Also:
getSymbol, setBorderColor

DEFAULT_SYMBOL_BORDER_STYLE

public static final java.lang.String DEFAULT_SYMBOL_BORDER_STYLE
The default CSS border style used for symbols if none is specified; this default is "solid".

See Also:
getSymbol, setBorderStyle, Constant Field Values

DEFAULT_SYMBOL_BORDER_WIDTH

public static final int DEFAULT_SYMBOL_BORDER_WIDTH
The default CSS border width used for symbols if none is specified; this default is 1 pixel.

See Also:
getSymbol, setBorderWidth, Constant Field Values

DEFAULT_SYMBOL_FILL_SPACING

public static final double DEFAULT_SYMBOL_FILL_SPACING
The default spacing between discrete, rectangular, elements used to simulate continous graphical objects, such as connecting lines in line charts or a shaded pie slice.

Note that if fill thickness is 0 (the default for all symbols except pie slices) no filling will be performed, regardless of the fill spacing.

See Also:
getSymbol, setFillSpacing, setFillThickness, Constant Field Values

DEFAULT_SYMBOL_FILL_THICKNESS

public static final int DEFAULT_SYMBOL_FILL_THICKNESS
The default "thickness" of the rectangular elements used to simulate continous graphical objects, such as connecting lines in line charts. This default applies to all symbol types except for those representing pie slices, whose default is DEFAULT_PIE_SLICE_FILL_THICKNESS

Since this default thickness is 0 px, this implies that, except for pie slices, no such continuous fill elements are generated by default. For example, if you want to have connecting lines drawn between individual data points represented using the BOX_CENTER symbol type, you must explicitly specify a positive fill thickness.

See Also:
DEFAULT_PIE_SLICE_FILL_THICKNESS, getSymbol, setFillSpacing, setFillThickness, Constant Field Values

DEFAULT_PIE_SLICE_FILL_SPACING

public static final double DEFAULT_PIE_SLICE_FILL_SPACING
The default "spacing" between corresponding edges of the rectangular elements used to simulate continuous fill of pie slices.

See Also:
DEFAULT_SYMBOL_FILL_SPACING, DEFAULT_PIE_SLICE_FILL_THICKNESS, getSymbol, setFillSpacing, setFillThickness, Constant Field Values

DEFAULT_PIE_SLICE_FILL_THICKNESS

public static final int DEFAULT_PIE_SLICE_FILL_THICKNESS
The default "thickness" of the rectangular elements used to simulate continous fill of pie slices. This thickness defines the height of horizontal pie slice shading bars, and the width of vertical shading bars.

See Also:
DEFAULT_SYMBOL_FILL_THICKNESS, getSymbol, setFillSpacing, setFillThickness, Constant Field Values

DEFAULT_PIE_SLICE_HOVERTEXT_TEMPLATE

public static final java.lang.String DEFAULT_PIE_SLICE_HOVERTEXT_TEMPLATE
The default hovertext template used by symbols when they have a symbol type of of the form PIE_SLICE_*.

See Also:
setHovertextTemplate, PIE_SLICE_OPTIMAL_SHADING, Constant Field Values

DEFAULT_SYMBOL_HEIGHT

public static final int DEFAULT_SYMBOL_HEIGHT
The default height (including borders) used for symbols if none is specified; this default is the same as for DEFAULT_SYMBOL_WIDTH

See Also:
getSymbol, setHeight, DEFAULT_SYMBOL_WIDTH, Constant Field Values

DEFAULT_SYMBOL_TYPE

public static final GChart.SymbolType DEFAULT_SYMBOL_TYPE
The default symbol type for curve if none is specified; this default is BOX_CENTER

See Also:
BOX_CENTER, setSymbolType

DEFAULT_SYMBOL_WIDTH

public static final int DEFAULT_SYMBOL_WIDTH
The default width (including borders) used for symbols if none is specified.

See Also:
getSymbol, setWidth, DEFAULT_SYMBOL_WIDTH, Constant Field Values

DEFAULT_TICK_COUNT

public static final int DEFAULT_TICK_COUNT
The default number of tick marks on each Axis.

See Also:
setTickCount, Constant Field Values

DEFAULT_TICK_LABEL_FONT_COLOR

public static final java.lang.String DEFAULT_TICK_LABEL_FONT_COLOR
The default color (a CSS color specification) of tick labels

See Also:
setTickLabelFontColor, getXAxis, getYAxis, getY2Axis, Constant Field Values

DEFAULT_TICK_LABEL_FONTSIZE

public static final int DEFAULT_TICK_LABEL_FONTSIZE
The default fontsize (in pixels) of tick labels

See Also:
setTickLabelFontSize, getXAxis, getYAxis, getY2Axis, Constant Field Values

DEFAULT_TICK_LABEL_FORMAT

public static final java.lang.String DEFAULT_TICK_LABEL_FORMAT
The default GWT NumberFormat format string used to convert numbers to the text strings displayed as tick labels on X, Y, and Y2 axes.

See Also:
setTickLabelFormat, getXAxis, getYAxis, getY2Axis, Constant Field Values

DEFAULT_TICK_LENGTH

public static final int DEFAULT_TICK_LENGTH
The default length of tick marks, in pixels.

See Also:
setTickLength, Constant Field Values

DEFAULT_TICK_THICKNESS

public static final int DEFAULT_TICK_THICKNESS
The default thickness of tick marks, in pixels.

See Also:
setTickThickness, Constant Field Values

DEFAULT_X_CHARTSIZE

public static final int DEFAULT_X_CHARTSIZE
The default width of the area of the chart in which curves are displayed, in pixels.

See Also:
Constant Field Values

DEFAULT_Y_CHARTSIZE

public static final int DEFAULT_Y_CHARTSIZE
The default height of the area of the chart in which curves are displayed, in pixels.

See Also:
Constant Field Values

Y_AXIS

public static final com.googlecode.gchart.client.GChart.YAxisId Y_AXIS
Keyword used to indicate that a curve should be displayed on the left y-axis.

See Also:
Y2_AXIS, setYAxis

Y2_AXIS

public static final com.googlecode.gchart.client.GChart.YAxisId Y2_AXIS
Keyword used to indicate that a curve should be displayed on the right (the so-called y2) y-axis.

See Also:
Y_AXIS, setYAxis

DEFAULT_BLANK_IMAGE_URL

public static final java.lang.String DEFAULT_BLANK_IMAGE_URL
The default URL GChart will use to access the blank image (specifically, a 1 x 1 pixel transparent GIF) it requires to prevent "missing image" icons from appearing in your charts.

See Also:
setBlankImageURL, Constant Field Values

DEFAULT_GRID_COLOR

public static final java.lang.String DEFAULT_GRID_COLOR
The default color used for all axes, gridlines, and ticks.

See Also:
setGridColor, Constant Field Values
Constructor Detail

GChart

public GChart()
Convenience no-arg constructor equivalent to GChart(DEFAULT_X_CHARTSIZE,DEFAULT_Y_CHARTSIZE).

See Also:
GChart(int,int)

GChart

public GChart(int xChartSize,
              int yChartSize)
Instantiates a GChart with a curve display region of the specified size.

Parameters:
xChartSize - the width of the curve display region, in pixels.
yChartSize - the height of the curve display region, in pixels.
See Also:
setXChartSize, setYChartSize, setChartSize
Method Detail

setInitialPieSliceOrientation

public void setInitialPieSliceOrientation(double orientation)
Sets the default initial orientation for pie slices. The default initial orientation is used as the first pie slice's first edge's orientation setting only if the symbol associated with that pie slice has the default, undefined, orientation setting of Double.NaN.

The default value of this setting is 0, which corresponds to due south (6 o'clock). The value specifies the fraction of a complete clockwise rotation, beginning at due south required to reach the first edge of the pie slice.

Parameters:
orientation - the orientation to use for the first edge of the first pie slice in this GChart, in cases in which that first pie slice's orientation is undefined (Double.NaN).
See Also:
setPieSliceOrientation

getInitialPieSliceOrientation

public double getInitialPieSliceOrientation()
Returns a previously specified initial pie slice orientation.

Returns:
the fraction of a clockwise rotation, beginning from the 6 o'clock postion, needed to reach the default initial pie slice orientation.
See Also:
setInitialPieSliceOrientation

addCurve

public void addCurve()
Adds a new curve to the chart, at the end of the current list of curves.

See Also:
getCurve, addCurve(int), removeCurve, clearCurves, getNCurves

addCurve

public void addCurve(int iCurve)
Adds a new curve to the chart, at the specified position in the curve sequence. Existing curves at postions at or greater than the specified position have their positional indexes increased by 1.

See Also:
getCurve, addCurve(), removeCurve, clearCurves, getNCurves

clearCurves

public void clearCurves()
Removes every curve this chart contains.

See Also:
getCurve, addCurve(), addCurve(int), removeCurve, getNCurves

getBackgroundColor

public java.lang.String getBackgroundColor()
Returns the background color of the chart as a whole.

Returns:
the chart's background color, in a standard CSS color string format.
See Also:
setBackgroundColor

getBorderColor

public java.lang.String getBorderColor()
Returns the color of the border around the chart as a whole.

Returns:
the color of the chart's border, in a standard CSS color string format.
See Also:
setBorderColor

getBorderWidth

public java.lang.String getBorderWidth()
Returns the width of the border around the chart as a whole

Returns:
width of the border around the chart as a whole, as a CSS border width specification string (e.g. "1px").
See Also:
setBorderWidth

getBorderStyle

public java.lang.String getBorderStyle()
Returns the style of the border around the chart as a whole

Returns:
cssStyle for the border around the chart as a whole
See Also:
setBorderStyle

getChartFootnotes

public com.google.gwt.user.client.ui.Widget getChartFootnotes()
Returns the previously specified chart footnotes widget

Returns:
widget representing chart's footnotes or null if none.
See Also:
setChartFootnotes(Widget), setChartFootnotes(String), getChartTitle

getChartTitle

public com.google.gwt.user.client.ui.Widget getChartTitle()
Returns the previously specified widget representing the chart's title.

Returns:
widget representing chart's title or null of no title
See Also:
setChartTitle(Widget), setChartTitle(String)

getCurve

public GChart.Curve getCurve()
Convenience method equivalent to getCurve(getNCurves()-1).

This method, when used in conjunction with no-arg addCurve, method, makes code blocks that create and define the properties of a chart's curves more readable/editable. For example:

      addCurve(); // add 1st curve
      getCurve().setYAxis(Y2_AXIS); // first setting for 1st curve
      //... other settings for first curve
      addCurve(); // add 2nd curve
      getCurve().setYAxis(Y_AXIS); // first setting for 2nd curve
      // ... other settings for 2nd curve    
      

Note that using the no-arg methods in this way allows you to copy entire groups of curve properties, unchanged, between such curve related blocks.

Returns:
the curve with the highest integer index. In other words, the curve with an index of getNCurves()-1.
See Also:
getCurve(int), getNCurves, addCurve()

getCurve

public GChart.Curve getCurve(int iCurve)
Returns a reference to the curve at the specified positional index. Use the reference returned by this method to modify properties of a curve (the symbol, data points, etc.)

Parameters:
iCurve - index of the curve to be retrieved.
Returns:
reference to the Curve at the specified position.
See Also:
getCurve(), addCurve(), addCurve(int), removeCurve, clearCurves, getNCurves

getFontFamily

public java.lang.String getFontFamily()
Returns the font-family used in tick labels, point annotations, legends, and as the default in titles, footnotes, and axis labels.

See Also:
setFontFamily

getGridColor

public java.lang.String getGridColor()
Returns CSS color specification for all gridlines, axes, and tickmarks.

Returns:
the color, in CSS standard color format, used for all gridlines, axes, and tick marks.
See Also:
setGridColor

getLegendBackgroundColor

public java.lang.String getLegendBackgroundColor()
Returns the background color of the chart's legend.

Returns:
the legend's background color, in a standard CSS color string format.
See Also:
setLegendBackgroundColor

getLegendBorderColor

public java.lang.String getLegendBorderColor()
Returns the border color of the chart's legend.

Returns:
the color of the legend's border, in a standard CSS color string format.
See Also:
setLegendBordergroundColor

getLegendBorderWidth

public int getLegendBorderWidth()
Returns the width of the chart's legend's border

Returns:
width of the legend's border, in pixels
See Also:
setLegendBorderWidth

getLegendBorderStyle

public java.lang.String getLegendBorderStyle()
Returns the style of the chart's legend's border

Returns:
cssStyle of the legend's border
See Also:
setLegendBorderStyle

getLegendFontWeight

public java.lang.String getLegendFontWeight()
Returns true if legend text will be rendered in a bold, or false if in normal, weight font.

Returns:
if the legend's text is in bold or not.
See Also:
setLegendFontWeight

getLegendFontColor

public java.lang.String getLegendFontColor()
Returns the color of the font used to display the labels within the legend (chart key)

Returns:
CSS color string defining the legend text's color
See Also:
setLegendFontColor

getLegendFontStyle

public java.lang.String getLegendFontStyle()
Returns the font-style in which this GChart's legend text will be rendered.

Returns:
font-style of legend text (italic, normal, etc.)
See Also:
setLegendFontStyle

getLegendFontSize

public int getLegendFontSize()
Returns the font size, in pixels, of text displayed in the chart's legend (also know as a chart's key).

Returns:
the (previously specified) font size of legend text
See Also:
setLegendFontSize

getNCurves

public int getNCurves()
Returns the number of curves on this chart.

Returns:
the number of curves on this chart
See Also:
getCurve, addCurve(), addCurve(int), removeCurve, clearCurves

getPadding

public java.lang.String getPadding()
Returns the CSS string that specifies the width of the padding between the chart and it's external border

Returns:
the CSS string that defines the CSS padding property for the GChart as a whole.
See Also:
setPadding

getPlotAreaBackgroundColor

public java.lang.String getPlotAreaBackgroundColor()
Returns the background color of the area of the chart in which symbols representing curve data are displayed

Returns:
CSS color string defining the plot area's background color
See Also:
setPlotAreaBackgroundColor

getPlotAreaBorderColor

public java.lang.String getPlotAreaBorderColor()
Returns the border color of the area of the chart in which symbols representing curve data are displayed

Returns:
CSS color string defining the color of the plot area's border
See Also:
setPlotAreaBorderColor

getPlotAreaBorderWidth

public int getPlotAreaBorderWidth()
Returns the width of the border around the area of the chart in which symbols representing curve data are displayed.

Returns:
width, in pixels, of the border around the plot area
See Also:
setPlotAreaBorderWidth

getPlotAreaBorderStyle

public java.lang.String getPlotAreaBorderStyle()
Returns the style of the border around the area of the chart in which symbols representing curve data are displayed (the so-called plot area).

Returns:
CSS style of the border around the plot area
See Also:
setPlotAreaBorderStyle

getShowOffChartPoints

public boolean getShowOffChartPoints()
Determinines if this chart will display points whose x,y locations are outside of the axis limits associated with the chart.

Returns:
true if off-the-chart points are displayed, false otherwise.
See Also:
setShowOffChartPoints

getBlankImageURL

public static java.lang.String getBlankImageURL()
Returns a URL that points to a 1 x 1 pixel blank image file GChart requires to render its charts without producing missing image icons.

Returns:
the URL of the file GChart needs to prevent missing image icons from appearing on your chart.
See Also:
setBlankImageURL

getXAxis

public GChart.Axis getXAxis()
Returns the x-axis associated with this chart. Use the returned reference to manipulate axis min and max, number of ticks, tick positions, tick label formats, etc.

Returns:
object representing the x-axis of this chart.
See Also:
getYAxis, getY2Axis

getXChartSize

public int getXChartSize()
Returns the number of x-pixels in the region of the chart used for curve display purposes.

Returns:
the number of x-pixels available for curve display.
See Also:
setXChartSize

getY2Axis

public GChart.Axis getY2Axis()
Returns the y2-axis (right y axis) associated with this chart. Use the returned reference to manipulate axis min and max, number of ticks, tick positions, tick label formats, etc.

Returns:
object representing the y2-axis of this chart.
See Also:
getYAxis, getXAxis

getYAxis

public GChart.Axis getYAxis()
Returns the (left) y-axis associated with this chart. Use the returned reference to manipulate axis min and max, number of ticks, tick positions, tick label formats, etc.

Returns:
object representing the y-axis of this chart.
See Also:
getXAxis, getY2Axis

getYChartSize

public int getYChartSize()
Returns the number of y-pixels in the region of the chart used for curve display purposes.

Returns:
the number of y-pixels available for curve display.
See Also:
setYChartSize

hasY2Axis

public boolean hasY2Axis()
Determines if this chart has a "y2" (right) y-axis.

Only charts that have at least one curve on the right y axis will have a y2-axis.