For downloads, demos, and more visit the
Client-side GChart Home Page

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.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasDoubleClickHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.dom.client.HasMouseWheelHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener

public class GChart
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasDoubleClickHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.dom.client.HasMouseWheelHandlers

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--which won't interfere with standard CSS-based specifications if you never invoke them.


Nested Class Summary
static class GChart.AnnotationLocation
          Defines the location of a data point's annotation or hover annotation (which can be defined by either plain text, HTML, or a widget) 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.LegendLocation
          Defines keywords that specify the location of the legend on the chart.
 class GChart.Symbol
          Defines a chart curve symbol.
static class GChart.SymbolType
          Specifies the type of symbol used by a curve.
static class GChart.TickLocation
          Defines keywords INSIDE, OUTSIDE, and CENTERED that specify the location of ticks relative to their axis.
static class GChart.TouchedPointUpdateOption
          Defines how the update method updates the touched point, that is, the point the user is considered to be hovered over.
 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.
 
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
static int DEFAULT_ANNOTATION_FONTSIZE
          Default size, in pixels, of text used to annotate individual plotted points on a curve.
static double DEFAULT_BAR_FILL_SPACING
          The default spacing between discrete, rectangular, elements used to simulate continuous filling of polygonal regions formed by connecting corresponding ends of successive bars in a bar chart.
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_BLANK_IMAGE_URL_FULLPATH
          The full path to the default GChart blank image (specifically, a 1 x 1 pixel transparent GIF) it requires to prevent "missing image" icons from appearing in your charts.
static int DEFAULT_BRUSH_HEIGHT
          Default pixel height of rectangular "brush" that defines how close the mouse cursor must be to a rendered symbol for it to be "touched" (which pops up its hover feedback).
static int DEFAULT_BRUSH_WIDTH
          Default pixel width of rectangular "brush" that defines how close the mouse cursor must be to a rendered symbol for it to be "touched" (which pops up its hover feedback).
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_FAMILY
          The font-family that GChart uses by default for all textual annotations on a chart (tick labels, point annotation, legend key text, titles, and footnotes).
static java.lang.String DEFAULT_FONT_STYLE
          Default style of axis label and legend fonts.
static java.lang.String DEFAULT_FONT_WEIGHT
          Default weight of axis label and legend fonts.
static int DEFAULT_FOOTNOTES_THICKNESS
          The default thickness (height) of the rectangular region at the bottom of the chart allocated for footnotes, per <br> or <li> delimited HTML line.
static java.lang.String DEFAULT_GRID_COLOR
          The default color used for all axes, gridlines, and ticks.
static GChart.AnnotationLocation DEFAULT_HBAR_BASELINE_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a HBAR_BASELINE_* symbol type.
static GChart.AnnotationLocation DEFAULT_HBARLEFT_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses an HBAR_*WEST symbol type.
static GChart.AnnotationLocation DEFAULT_HBARRIGHT_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses an HBAR_*EAST symbol type.
static GChart.AnnotationLocation DEFAULT_HOVER_LOCATION
          The default hover feedback location used to position the hover feedback when the user hovers their mouse above a point on a curve (pie slices, and bar symbols have different defaults).
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 (pie slices have a different default).
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 int DEFAULT_LINE_FILL_SPACING
          The default spacing between discrete, rectangular, elements used to simulate continuously connected lines between successive points on a curve that uses the LINE symbol type.
static int DEFAULT_LINE_FILL_THICKNESS
          The default thickness of connecting lines drawn on curves whose symbols have the LINE symbol type.
static double DEFAULT_MAX_CANVAS_PIXELS
          Default upper bound on the number of pixels any canvas widget used by GChart can have.
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 continuous fill of pie slices.
static GChart.AnnotationLocation DEFAULT_PIE_SLICE_HOVER_LOCATION
          The default hover feedback location used by symbols when they have a symbol type of of the form PIE_SLICE_*.
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 continuous graphical elements.
static int DEFAULT_SYMBOL_FILL_THICKNESS
          The default "thickness" of the rectangular elements used to simulate continuous 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 java.lang.String DEFAULT_TICK_LABEL_FONT_STYLE
          The default CSS font-style applied to tick labels
static java.lang.String DEFAULT_TICK_LABEL_FONT_WEIGHT
          The default CSS font-weight applied to 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 GChart.TickLocation DEFAULT_TICK_LOCATION
          The default tick location.
static int DEFAULT_TICK_THICKNESS
          The default thickness of tick marks, in pixels.
static int DEFAULT_TITLE_THICKNESS
          The default thickness (height) of the rectangular region at the top of the chart allocated for the chart's title, per <br> or <li> delimited HTML line.
static GChart.AnnotationLocation DEFAULT_VBAR_BASELINE_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_BASELINE_* symbol type.
static GChart.AnnotationLocation DEFAULT_VBARBOTTOM_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_SOUTH* symbol type.
static GChart.AnnotationLocation DEFAULT_VBARTOP_HOVER_LOCATION
          The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_NORTH* symbol type.
static int DEFAULT_WIDGET_HEIGHT_UPPERBOUND
          The default upper bound on the height of widgets used in annotations and tick labels that GChart will assume for centering and similar alignment purposes.
static int DEFAULT_WIDGET_WIDTH_UPPERBOUND
          The default upper bound on the width of widgets used in annotations and tick labels that GChart will assume for centering and similar alignment purposes.
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 GChart.NAI (Not an Integer) to represent integers whose values have not been explicitly specified.
static java.lang.String TRANSPARENT_BORDER_COLOR
          Due to a well-known bug (see, for example, this explanation on Hedger Wang's blog), though white may not be black in IE6, transparent borders certainly are.
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.
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
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
 com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
          Adds an object to handle click events on this chart, that is, an object whose ClickHandler.onClick method will be called whenever the user clicks on this chart.
 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.
 com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler handler)
          Adds a DoubleClickEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
          Adds a MouseDownEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler)
          Adds a MouseMoveEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler)
          Adds a MouseOutEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler)
          Adds a MouseOverEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler)
          Adds a MouseUpEvent handler.
 com.google.gwt.event.shared.HandlerRegistration addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler handler)
          Adds a MouseWheelEvent handler.
 void clearCurves()
          Removes every curve this chart contains.
static java.lang.String formatAsHovertext(java.lang.String plainTextLabel)
          Convenience method that, given a plain text label, returns an HTML snippet appropriate for use as an argument to the setHovertextTemplate or setAnnotationText methods, that will display the plain text label with formatting appropriate for use with hovertext.
 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
static GChartCanvasFactory getCanvasFactory()
          Returns the GChart class' canvas factory, or null if no canvas factory has been specified.
 com.google.gwt.user.client.ui.Widget getChartFootnotes()
          Returns the previously specified chart footnotes widget.
 boolean getChartFootnotesLeftJustified()
          Returns flag indicating if this chart's footnotes are left-justified or centered.
 int getChartFootnotesThickness()
          Returns the thickness (height) of the rectangular region at the bottom of the chart allocated for footnotes.
 com.google.gwt.user.client.ui.Widget getChartTitle()
          Returns the previously specified widget representing the chart's title.
 int getChartTitleThickness()
          Returns the thickness (height) of the rectangular region at the top of the chart allocated for the title.
 boolean getClipToDecoratedChart()
          Determines if this chart will clip any chart elements that extend beyond the bounds of the decorated chart.
 boolean getClipToPlotArea()
          Returns true if graphical aspects of the chart that fall outside of the plot area are being clipped off, false otherwise.
 GChart.Curve.Point getClosestBrushTouchingPoint(int xPlotArea, int yPlotArea)
          Returns the point that would be touched if the mouse were moved to the given x,y plot-area pixel coordinates, or null if the moving the mouse to these coordinates would not have touched any points.
static java.lang.Object getCurrentCurveData()
          Returns a reference to the auxiliary data object of the curve that is currently being rendered by GChart.
 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.
 int getCurveIndex(GChart.Curve curve)
          Returns the positional index (within this chart's list of curves) of the specified curve.
 java.lang.String getFontFamily()
          Returns the font-family that is used, by default, for all textual annotations (tick labels, point lables, title, footnotes, legend labels, and axis labels) on that chart.
 java.lang.String getGridColor()
          Returns CSS color specification for all gridlines, axes, and tickmarks.
 HoverParameterInterpreter getHoverParameterInterpreter()
          Returns this GChart's hover parameter interpreter.
 boolean getHoverTouchingEnabled()
          Is it possible to select points and have their hover annotations pop up, merely by "touching" them with the mouse-attached "brush"?
 double getInitialPieSliceOrientation()
          Returns a previously specified initial pie slice orientation.
 com.google.gwt.user.client.ui.Widget getLegend()
          Returns the developer-defined widget used for this chart's Legend.
 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)
 java.lang.String getLegendFontFamily()
          Returns the font-family used to render this GChart's legend text.
 int getLegendFontSize()
          Returns the CSS 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 getLegendThickness()
          Returns the thickness (width) of the rectangular region to the right of the y2-axis label allocated for the chart legend.
 int getLegendXShift()
          The amount, in pixels, the legend is shifted along the x axis from its base position.
 int getLegendYShift()
          The amount, in pixels, the legend is shifted along the y axis from its base position.
 double getMaxCanvasPixels()
          Returns the maximum number of pixels any canvas Widget used in GChart's rendering can have.
 int getNCurves()
          Returns the number of curves on this chart.
 boolean getOptimizeForMemory()
          Returns a flag that tells if GChart is configured to perform updates so that the chart uses less memory.
 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.
 java.lang.String getPlotAreaImageURL()
          Returns the image URL that will be used to define the plot area's background the next time update is called.
 double getRenderPaddingFactor()
          Returns the previously specified render padding factor.
 boolean getShowOffChartPoints()
          Deprecated. Equivalent to !getClipToPlotArea(). Use that method instead.
 boolean getShowOffDecoratedChartGlyphs()
          Deprecated. Equivalent to !getClipToDecoratedChart(). Use that method instead.
 GChart.Curve getTouchedCurve()
          Returns the curve that the mouse "brush" is currently "touching" (the so-called "hovered over" point), or null if none.
 GChart.Curve.Point getTouchedPoint()
          Returns the point that the mouse "brush" is currently "touching" (the so-called "hovered over" point), or null if none.
 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.
 int getXChartSizeDecorated()
          Returns the number of x-pixels reserved for the chart as a whole, including space reserved for decorations (title, footnotes, axis labels, ticks, tick labels, legend key, etc.).
 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.
 int getYChartSizeDecorated()
          Returns the number of y-pixels reserved for the chart as a whole, including space reserved for decorations (title, footnotes, axis labels, ticks, tick labels, etc.).
 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.
 boolean isUpdateNeeded()
          Is the in-browser rendition of the chart inconsistent with the current chart specs? In other words, is a call to GChart's update method needed to bring the browser's display into agreement with current chart specs?
 void removeCurve(GChart.Curve curve)
          Removes the given curve from this GChart.
 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 setCanvasExpansionFactors(double widthExpansionFactor, double heightExpansionFactor)
          Specifies the fractional amount that the default width and height of each canvas used to render this chart will be increased.
static void setCanvasFactory(GChartCanvasFactory factory)
          Tells GChart how to create the canvas widgets it needs (specifically, widgets that implement GChart's GChartCanvasLite interface) to render your charts using an external vector graphics library.
 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 that appears just below the chart.
 void setChartFootnotesLeftJustified(boolean footnotesLeftJustified)
          Defines if this chart's footnotes are left justified, or horizontally centered across the bottom edge of the chart.
 void setChartFootnotesThickness(int thickness)
          Sets the thickness (height) of the rectangular region at the bottom of the chart allocated for the footnotes.
 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 setChartTitleThickness(int thickness)
          Sets the thickness (height) of the rectangular region at the top of the chart allocated for the title.
 void setClipToDecoratedChart(boolean clipToDecoratedChart)
          Specifies if this chart will clip any rendered chart elements (including hover selection feedback and popup annotations) that extends beyond the bounds of the decorated chart.
 void setClipToPlotArea(boolean clipToPlotArea)
          Specifies if rendered graphics falling outside the plot area will be clipped off.
static void setDefaultSymbolBorderColors(java.lang.String[] defaultBorderColors)
          Sets the symbol border colors that are used by default for newly created curves.
 void setFontFamily(java.lang.String fontFamily)
          Specifies the font-family that is used, by default, for all textual annotations (tick labels, point labels, title, footnotes, legend labels, and axis labels) on this chart.
 void setGridColor(java.lang.String cssColor)
          Specifies the single color used for all gridlines, axes lines, and tick marks.
 void setHoverParameterInterpreter(HoverParameterInterpreter hpi)
          Defines this GChart's hover parameter interpreter.
 void setHoverTouchingEnabled(boolean hoverTouchingEnabled)
          Specifies if merely hovering over a point is sufficient to select it and display its hover annotation (true), or if an actual click is needed (false).
 void setInitialPieSliceOrientation(double orientation)
          Sets the default initial orientation for pie slices.
 void setLegend(com.google.gwt.user.client.ui.Widget legend)
          This method allows you to replace GChart's legend with a Widget you create to represent the chart legend.
 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 setLegendFontFamily(java.lang.String cssFontFamily)
          Specifies the CSS font-family of the font used to render the legend's labels.
 void setLegendFontSize(int legendFontSize)
          Specifies the CSS 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 setLegendLocation(GChart.LegendLocation legendLocation)
          Specifies the position of the legend on the chart.
 void setLegendThickness(int legendThickness)
          Sets the thickness (width) of the rectangular region at the right or left of the chart allocated for the legend key.
 void setLegendVisible(boolean isLegendVisible)
          Specifies if the legend is to be visible on this chart.
 void setLegendXShift(int xShift)
          Specifies the number of pixels (along the x-axis) to move the legend from its default, LegendLocation-defined, position.
 void setLegendYShift(int yShift)
          Specifies the number of pixels (along the y-axis) to move the legend from its default, LegendLocation-defined, position.
 void setMaxCanvasPixels(double maxCanvasPixels)
          Sets the upper bound on the number of pixels any canvas widget used by GChart can have.
 void setOptimizeForMemory(boolean optimizeForMemory)
          By default, this property is false, which means that GChart will retain no-longer-needed Image and Grid widgets (plus any user object references associated with those widgets, such as those created via the setAnnotationText and setAnnotationWidget methods) between updates in the expectation that they may be needed by future updates.
 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 setPlotAreaImageURL(java.lang.String imageURL)
          Sets the image URL that defines the background of the GChart plot area.
 void setRenderPaddingFactor(double renderPaddingFactor)
          Defines a region around the perimeter of the currently visible area of the chart that will be rendered, even though it cannot at present be seen (due to clipping).
 void setShowOffChartPoints(boolean showOffChartPoints)
          Deprecated. Equivalent to setClipToPlotArea(!showOffChartPoints) . Use that method instead.

As of GChart 2.5, the clip-to-plot-area algorithm no longer drops the entire symbol if it's x,y coordinates are outside of the plot area; instead, it clips them off in the traditional "overflow: hidden" manner. Though unlikely you would need to, there is no easy way to recreate the previous behavior.

This change was made so that both rectangular HTML and continuous, canvas-rendered chart elements would be clipped in a consistent and sensible way.

 void setShowOffDecoratedChartGlyphs(boolean showOffDecoratedChartGlyphs)
          Deprecated. Equivalent to setClipToDecoratedChart(!showOffDecoratedChart), please use that method instead.
 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 touch(GChart.Curve.Point pointToTouch)
          Simulates the user "touching" a point with the mouse, by performing those operations that occur when the user "hovers over" the specified point.
 void update()
          Updates the chart, using an appropriate default touched point update option, depending on if hover touching is enabled or not.
 void update(GChart.TouchedPointUpdateOption option)
          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
isAttached, onBrowserEvent
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getLayoutData, getParent, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Field Detail

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_BRUSH_HEIGHT

public static final int DEFAULT_BRUSH_HEIGHT
Default pixel height of rectangular "brush" that defines how close the mouse cursor must be to a rendered symbol for it to be "touched" (which pops up its hover feedback).

See Also:
setBrushHeight, setBrushWidth, DEFAULT_BRUSH_WIDTH, Constant Field Values

DEFAULT_BRUSH_WIDTH

public static final int DEFAULT_BRUSH_WIDTH
Default pixel width of rectangular "brush" that defines how close the mouse cursor must be to a rendered symbol for it to be "touched" (which pops up its hover feedback).

See Also:
setBrushHeight, setBrushWidth, DEFAULT_BRUSH_HEIGHT, 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_FAMILY

public static final java.lang.String DEFAULT_FONT_FAMILY
The font-family that GChart uses by default for all textual annotations on a chart (tick labels, point annotation, legend key text, titles, and footnotes).

Chosen to be the same font-family as that used in GWT's standard CSS stylesheet ("theme").

See Also:
setLegendFontFamily, setTickLabelFontFamily, setAnnotationFontFamily, Constant Field Values

DEFAULT_FONT_STYLE

public static final java.lang.String DEFAULT_FONT_STYLE
Default style of axis label and legend fonts.

See Also:
setLegendFontStyle, setTickLabelFontStyle, setAnnotationFontStyle, Constant Field Values

DEFAULT_FONT_WEIGHT

public static final java.lang.String DEFAULT_FONT_WEIGHT
Default weight of axis label and legend fonts.

See Also:
setLegendFontWeight, setTickLabelFontWeight, setAnnotationFontWeight, 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 (pie slices have a different default).

See Also:
setHovertextTemplate, DEFAULT_PIE_SLICE_HOVERTEXT_TEMPLATE

DEFAULT_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_HOVER_LOCATION
The default hover feedback location used to position the hover feedback when the user hovers their mouse above a point on a curve (pie slices, and bar symbols have different defaults).

See Also:
setHoverLocation, DEFAULT_PIE_SLICE_HOVER_LOCATION, DEFAULT_VBAR_BASELINE_HOVER_LOCATION, DEFAULT_VBARBOTTOM_HOVER_LOCATION, DEFAULT_VBARTOP_HOVER_LOCATION, DEFAULT_HBAR_BASELINE_HOVER_LOCATION, DEFAULT_HBARLEFT_HOVER_LOCATION, DEFAULT_HBARRIGHT_HOVER_LOCATION

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 continuous graphical elements. This default does not apply to bar chart symbol types or the LINE symbol type, which have their own default fill spacings.

See Also:
getSymbol, setFillSpacing, setFillThickness, DEFAULT_BAR_FILL_SPACING, DEFAULT_LINE_FILL_SPACING, 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 continuous 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, and the LINE symbol type, whose default is DEFAULT_LINE_FILL_THICKNESS.

Since this default thickness is 0 px, this implies that, except for pie slices and lines, no such continuous fill elements are generated by default. For example, if you want to have dotted connecting lines drawn between individual data points represented using the BOX_CENTER symbol type, you must explicitly specify a positive fill thickness (for solid connecting lines, the LINE symbol is usually far more efficient than using a fill thickness of 1px with the BOX_CENTER symbol).

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

DEFAULT_BAR_FILL_SPACING

public static final double DEFAULT_BAR_FILL_SPACING
The default spacing between discrete, rectangular, elements used to simulate continuous filling of polygonal regions formed by connecting corresponding ends of successive bars in a bar chart.

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

DEFAULT_LINE_FILL_THICKNESS

public static final int DEFAULT_LINE_FILL_THICKNESS
The default thickness of connecting lines drawn on curves whose symbols have the LINE symbol type.

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

DEFAULT_LINE_FILL_SPACING

public static final int DEFAULT_LINE_FILL_SPACING
The default spacing between discrete, rectangular, elements used to simulate continuously connected lines between successive points on a curve that uses the LINE symbol type.

See Also:
getSymbol, setFillSpacing, setFillThickness, DEFAULT_SYMBOL_FILL_SPACING, 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 continuous 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, DEFAULT_LINE_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, DEFAULT_HOVERTEXT_TEMPLATE

DEFAULT_PIE_SLICE_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_PIE_SLICE_HOVER_LOCATION
The default hover feedback location used by symbols when they have a symbol type of of the form PIE_SLICE_*.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

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_FONT_STYLE

public static final java.lang.String DEFAULT_TICK_LABEL_FONT_STYLE
The default CSS font-style applied to tick labels

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

DEFAULT_TICK_LABEL_FONT_WEIGHT

public static final java.lang.String DEFAULT_TICK_LABEL_FONT_WEIGHT
The default CSS font-weight applied to tick labels

See Also:
setTickLabelFontWeight, 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_LOCATION

public static final GChart.TickLocation DEFAULT_TICK_LOCATION
The default tick location.

See Also:
setTickLocation

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_VBAR_BASELINE_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_VBAR_BASELINE_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_BASELINE_* symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_VBARBOTTOM_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_VBARBOTTOM_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_SOUTH* symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_VBARTOP_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_VBARTOP_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a VBAR_NORTH* symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_HBAR_BASELINE_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_HBAR_BASELINE_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses a HBAR_BASELINE_* symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_HBARLEFT_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_HBARLEFT_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses an HBAR_*WEST symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_HBARRIGHT_HOVER_LOCATION

public static final GChart.AnnotationLocation DEFAULT_HBARRIGHT_HOVER_LOCATION
The default location used to position the hover feedback when the user hovers their mouse above a point on a curve that uses an HBAR_*EAST symbol type.

See Also:
setHoverLocation, DEFAULT_HOVER_LOCATION

DEFAULT_MAX_CANVAS_PIXELS

public static final double DEFAULT_MAX_CANVAS_PIXELS
Default upper bound on the number of pixels any canvas widget used by GChart can have.

See Also:
setMaxCanvasPixels, Constant Field Values

DEFAULT_WIDGET_WIDTH_UPPERBOUND

public static final int DEFAULT_WIDGET_WIDTH_UPPERBOUND
The default upper bound on the width of widgets used in annotations and tick labels that GChart will assume for centering and similar alignment purposes.

See Also:
setAnnotationWidget, addTick, Constant Field Values

DEFAULT_WIDGET_HEIGHT_UPPERBOUND

public static final int DEFAULT_WIDGET_HEIGHT_UPPERBOUND
The default upper bound on the height of widgets used in annotations and tick labels that GChart will assume for centering and similar alignment purposes.

See Also:
setAnnotationWidget, addTick, 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

NAI

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

See Also:
Constant Field Values

TRANSPARENT_BORDER_COLOR

public static final java.lang.String TRANSPARENT_BORDER_COLOR
Due to a well-known bug (see, for example, this explanation on Hedger Wang's blog), though white may not be black in IE6, transparent borders certainly are. Besides this outright bug, different browsers define which element's background color "shines through" a transparent border differently. For example, in FF2, the background of the element containing the border shines through, which makes setting the border color to "transparent" equivalent to setting the border color to equal the background color. In IE7, the color of the chart's background "shines through"--which is more likely what you intended when you set a symbol's border to transparent.

To make it easy for you to eliminate such problems, and obtain a consistently behaving transparent-border behavior cross-browser, this special GChart-only "color" (recognized by all GChart border color related methods except GChart.setBorderColor) causes GChart to emulate a transparent border by eliminating the border entirely (setting it's width to 0) and changing the size and position of the element so as to make it look like the border is still "taking up space".

Note:The GChart.setBorderColor method, which sets the color of the border around the entire chart, does not support this keyword because GChart's transparent border emulation relies on changing the size of, and shifting the position of, the transparently bordered element. But, the position of the GChart as a whole is determined not by GChart, but by the enclosing page. Well-known CSS tricks, such as described in the "hedgerwow" link above, can be used if you need a truely transparent border around the entire chart. Or, just fake it by setting the border color to equal the background color of the containing page.

This differs from setting the border color to "transparent" (which you can still do should you need the "standard non-standard" transparent border color behavior) in subtle ways that can matter in special cases. For example, because the element is smaller than it is with "transparent", if you draw your symbols outside the chart rectangle, GChart will not be able to track the mouse moves inside the transparent region (yes, this is a fine point, but there could be other differences I'm not aware of). In almost every other case I can think of, though, setting the border color to this special keyword instead of "transparent" will be the simplest way to eliminate these inconsistent transparent border problems from your charts.

See Also:
setBorderColor

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");  */ 
  }
 
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, 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_BLANK_IMAGE_URL_FULLPATH

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

Convenience constant equal to:

 GWT.getModuleBaseURL() + GChart.DEFAULT_BLANK_IMAGE_URL
 

See Also:
setBlankImageURL

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

DEFAULT_FOOTNOTES_THICKNESS

public static final int DEFAULT_FOOTNOTES_THICKNESS
The default thickness (height) of the rectangular region at the bottom of the chart allocated for footnotes, per <br> or <li> delimited HTML line. This default is only used when the footnote thickness is set to GChart.NAI (the default).

See Also:
setChartFootnotesThickness, Constant Field Values

DEFAULT_TITLE_THICKNESS

public static final int DEFAULT_TITLE_THICKNESS
The default thickness (height) of the rectangular region at the top of the chart allocated for the chart's title, per <br> or <li> delimited HTML line. This default is only used when the title thickness is set to GChart.NAI.

See Also:
setChartTitleThickness, Constant Field Values
Constructor Detail

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

GChart

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

See Also:
GChart(int,int)
Method Detail

setCanvasFactory

public static void setCanvasFactory(GChartCanvasFactory factory)
Tells GChart how to create the canvas widgets it needs (specifically, widgets that implement GChart's GChartCanvasLite interface) to render your charts using an external vector graphics library.

You must define a class that implements GChartCanvasFactory and then pass an instance of that class to this method, if you want to have the fast, crisply drawn connecting lines, polygonal areas, and 2-D pie slices that only a vector graphics library can provide.

Note: If all of your charts only have rectangular elements (e.g. bar charts) GChart will continue to render those charts using HTML elements, even if a canvas factory is provided. Thus, there is no point to defining a canvas factory if all you use GChart for is bar charts, scatter plots without connecting lines between each point, banded-fill pie slices, and so on.

On the other hand, if you need continously connected lines, solid-fill pie slices, or solid-fill area charts (all of which will also need a setFillSpacing(0) to specify continuous filling) you will gain substantial performance/quality improvements if you add a canvas factory.

In detail, to exploit browser-based vector graphics (Mozilla's canvas, IE's VML, etc.) rendering in your charts, you must:

  1. Import an external GWT canvas library, such as provided by the GWT incubator project's GWTCanvas class, into your project. For example, our GChart test application uses GWTCanvas and imports it by adding this line to its .gwt.xml file:

       <inherits name='com.google.gwt.widgetideas.GWTCanvas' />
     
    To make this work, we also had to add the gwt-incubator.jar file (which contains GWTCanvas) to our build path via Eclipse's "Configure Build Path..." command and to the libraries listed in the classpath=... line of our ant build script's java task.

    For more on the GWTCanvas widget, see the GWTCanvas Wiki page within the GWT incubator site.

  2. Implement a class that extends Widget and implements the GChartCanvasLite interface that GChart expects. Again, in GChart's GWTCanvas-based test application we use:

    package com.googlecode.gchart.gcharttestapp.client;
    import com.googlecode.gchart.client.GChartCanvasLite;
    
    import com.google.gwt.widgetideas.graphics.client.GWTCanvas; 
    import com.google.gwt.widgetideas.graphics.client.Color; 
    
    public class GWTCanvasBasedCanvasLite
             extends GWTCanvas implements GChartCanvasLite {
         // GChartCanvasLite requires CSS/RGBA color strings, but
         // GWTCanvas uses its own Color class instead, so we wrap:
         public void setStrokeStyle(String cssColor) {
         // Sharp angles of default MITER can overwrite adjacent pie slices
            setLineJoin(GWTCanvas.ROUND);
            setStrokeStyle(new Color(cssColor));
         }
         public void setFillStyle(String cssColor) {
            setFillStyle(new Color(cssColor));
         }
         // Note: all other GChartCanvasLite methods (lineTo, moveTo,
         // arc, etc.) are directly inherited from GWTCanvas, so no
         // wrapper methods are needed.
    }
    

  3. Create a GChartCanvasFactory class that has a single create method that returns new instances of your GChartCanvasLite Widget. GChart's test application uses:

    package com.googlecode.gchart.gcharttestapp.client;
    import com.googlecode.gchart.client.GChartCanvasLite;
    import com.googlecode.gchart.client.GChartCanvasFactory;
    
    public class GWTCanvasBasedCanvasFactory 
       implements GChartCanvasFactory {
    
       public GChartCanvasLite create() {
          GChartCanvasLite result = new GWTCanvasBasedCanvasLite();
          return result;
       }
       
    }
    

  4. Finally pass an instance of that factory to GChart via a single invocation of setCanvasFactory:
     static {
       GChart.setCanvasFactory(new GWTCanvasBasedCanvasFactory());
     }
     

    Because the above line essentially completes the definition of the GChart class (and thus should only be executed once per application) a good home for it is in a static initializer, as shown above. I recommend placing that initializer within your application's EntryPoint class.

Note: To make things a bit simpler for you, the following code combines steps 2, 3, and 4 into a single chunk of easily pasted boilerplate:

// Required imports:
import com.googlecode.gchart.client.GChart;
import com.googlecode.gchart.client.GChartCanvasFactory;
import com.googlecode.gchart.client.GChartCanvasLite;
import com.google.gwt.widgetideas.graphics.client.Color;
import com.google.gwt.widgetideas.graphics.client.GWTCanvas;
// Paste these lines into the top-level GWT class that kicks off your
// application (the one that "implements EntryPoint"):
      static final class GWTCanvasBasedCanvasLite
         extends GWTCanvas implements GChartCanvasLite {
     // GChartCanvasLite requires CSS/RGBA color strings, but
     // GWTCanvas uses its own Color class instead, so we wrap:
         public void setStrokeStyle(String cssColor) {
     // Sharp angles of default MITER can overwrite adjacent pie slices
            setLineJoin(GWTCanvas.ROUND);
            setStrokeStyle(new Color(cssColor));
         }
         public void setFillStyle(String cssColor) {
            setFillStyle(new Color(cssColor));
         }
      // Note: all other GChartCanvasLite methods (lineTo, moveTo,
      // arc, etc.) are directly inherited from GWTCanvas, so no
      // wrapper methods are needed.
      }
      static final class GWTCanvasBasedCanvasFactory 
          implements GChartCanvasFactory {
         public GChartCanvasLite create() {
           GChartCanvasLite result = new GWTCanvasBasedCanvasLite();
           return result;
         }
      }
   
    // This line "teaches" GChart how to create the canvas
    // widgets it needs to render any continuous,
    // non-rectangular, chart aspects (solid fill pie slices,
    // continously connected lines, etc.) clearly and
    // efficiently.  It's generally best to do this exactly once,
    // when your entire GWT application loads.
   static {
      GChart.setCanvasFactory(new GWTCanvasBasedCanvasFactory());
   } 

To see the above boilerplate within a working example application, follow the link at the bottom of GChart's live demo page to examine its EntryPoint class' code.

GChart's mixed canvas and HTML rendering

Even with an external canvas factory enabled, many aspects of your chart will remain HTML-rendered. In general, GChart only renders non-rectangular, "continuously filled" aspects of your chart using canvas. Other aspects, such as the bars on a bar chart, or the individual rectangular point markers on a line chart, as well as all chart text, will remain HTML rendered.

The rendering mode (HTML-only or HTML+canvas) for each curve is defined by if a canvas factory is available and if that curve uses the special setFillSpacing(0) setting (meaning: "continuously filled"). So, to force any curve to be only HTML rendered, simply set this fill spacing to a value greater than 0.

HTML rendering offers some features not available with canvas rendering. For example, only HTML-rendered curves can overwrite the enclosing page without monopolizing mouse events within that curve's bounding rectangle, and only HTML-rendered curves can define their "fill" via an image. HTML rendered curves can sometimes even be more memory-efficent, provided the number of pixels greatly exceeds the number of HTML elements. And the HTML only rendering option provides a useful least common denominator/fall-back, supported by even the most obscure browsers.

Note that the internal curves that GChart uses to render tick marks, gridlines, etc. are never canvas rendered, because they only involve vertical or horizontal rectangles, which GChart always renders with HTML.

Finally, if you are content with GChart's built-in HTML-based rendering, or if your charts only use rectangular elements (e.g. bar charts) you don't need to bother with any of the steps listed above. Your charts will then only depend on the standard GWT distribution and the 3,000 or so lines of pure GWT Java that implement GChart.

Important: GChart only uses your external canvas facility to draw a chart's non-rectangular aspects. Given how GChart works, a curve can only have non-rectangular aspects if setFillSpacing has been set to 0 (which implies "continuous filling"), and setFillThickness has been set to a value > 0. If you are not seeing crisp, canvas-rendered area, line, or pie charts, be sure to check these two settings on the curves in question.

See Also:
GChartCanvasFactory, GChartCanvasLite, getCanvasFactory, setFillSpacing, setFillThickness

getCanvasFactory

public static GChartCanvasFactory getCanvasFactory()
Returns the GChart class' canvas factory, or null if no canvas factory has been specified.

Returns:
the previously specified canvas factory
See Also:
setCanvasFactory

addClickHandler

public com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
Adds an object to handle click events on this chart, that is, an object whose ClickHandler.onClick method will be called whenever the user clicks on this chart.

When implementing a class that handles GChart click events, you'll need to know the following facts:

  1. You can use the getSource method of the ClickEvent passed into your onClick handler to retrieve the GChart that was clicked on. For example:

     // Deletes the clicked-on curve
     public void onClick(ClickEvent event) {
       GChart theGChart = (GChart) event.getSource();
       GChart.Curve c = theGChart.getTouchedCurve();
       if (null != c) {
         theGChart.removeCurve(c);
         // what you see in browser won't change without an update 
         theGChart.update();
       }
     }
     

  2. The GChart methods getTouchedPoint and getTouchedCurve return either the point and curve that were clicked on, or null if the click didn't "touch" any points.

The editable pie chart example on the GChart live demo page illustrates how to use this method to launch a popup modal DialogBox whenever the user clicks on a point, and how to change the selected point from within that dialog by using GChart's touch method.

For a much simpler example that lets the user delete points by clicking on them, see the Chart Gallery's GChartExample18a.

Specified by:
addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlers
Parameters:
handler - the click handler that will handle click events on this chart.
Returns:
the handler's registration object. You need to retain a reference to this registration object only if you may later need to remove the handler (via the registration's removeHandler method). Most applications don't remove handlers (handlers tend to be statically defined) and so can ignore the value returned from this method.
See Also:
getTouchedPoint, getTouchedCurve, touch, isUpdateNeeded

addDoubleClickHandler

public com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler handler)
Adds a DoubleClickEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addDoubleClickHandler in interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
Parameters:
handler - the double click handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseDownHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
Adds a MouseDownEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseDownHandler in interface com.google.gwt.event.dom.client.HasMouseDownHandlers
Parameters:
handler - the mouse down handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseMoveHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler)
Adds a MouseMoveEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseMoveHandler in interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
Parameters:
handler - the mouse move handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseOutHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler)
Adds a MouseOutEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseOutHandler in interface com.google.gwt.event.dom.client.HasMouseOutHandlers
Parameters:
handler - the mouse out handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseOverHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler)
Adds a MouseOverEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseOverHandler in interface com.google.gwt.event.dom.client.HasMouseOverHandlers
Parameters:
handler - the mouse over handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseUpHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler)
Adds a MouseUpEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseUpHandler in interface com.google.gwt.event.dom.client.HasMouseUpHandlers
Parameters:
handler - the mouse up handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

addMouseWheelHandler

public com.google.gwt.event.shared.HandlerRegistration addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler handler)
Adds a MouseWheelEvent handler.

See addClickHandler for GChart-specific information you will need to properly handle the event.

Specified by:
addMouseWheelHandler in interface com.google.gwt.event.dom.client.HasMouseWheelHandlers
Parameters:
handler - the mouse wheel handler
Returns:
HandlerRegistration used to remove this handler
See Also:
addClickHandler

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

formatAsHovertext

public static java.lang.String formatAsHovertext(java.lang.String plainTextLabel)
Convenience method that, given a plain text label, returns an HTML snippet appropriate for use as an argument to the setHovertextTemplate or setAnnotationText methods, that will display the plain text label with formatting appropriate for use with hovertext.

When the string returned from this method is used as an argument to setHovertextTemplate, the hovertext that is generated is similar in format (light yellow background, black 1px border) to what is produced via the setTitle method (standard browser element hovertext).

In detail, this method creates the returned string via the line:

 result = "<html><div style='background-color:#FFFFF0; border-color:black; border-style:solid; border-width:1px; padding:2px'>"
     + plainTextLabel + "</div>";
 

This method is provided mainly to simplify transitioning from the old hover feedback system to the new one introduced in v2.4.

It is expected that many pre v2.4 GChart applications will find that simply wrapping a formatAsHovertext call around existing hovertext templates will provide acceptable (though somewhat different) hover feedback for existing charts:

 getCurve().getSymbol().setHovertextTemplate(
     GChart.formatAsHovertext("(x,y) = (${x}, ${y})"));
 

Note that GChart v2.4 automatically includes such a wrapping formatAsHovertext call on all default hovertext templates.

See the setHoverAnnotationSymbolType method for a code snippet that emulates not just the formatting, but also the at-the-mouse positioning behaviour, of setTitle-based hovertext.

Parameters:
plainTextLabel - the plain text label that is to be HTML-wrapped to make it look like setTitle-based hovertext.
See Also:
setHovertextTemplate, setAnnotationText, setHoverAnnotationSymbolType

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

getChartFootnotesLeftJustified

public boolean getChartFootnotesLeftJustified()
Returns flag indicating if this chart's footnotes are left-justified or centered.

Returns:
true if footnotes are flush against the left edge of the chart, false if they are horizontally centered across the bottom edge of the chart.
See Also:
setChartFootnotesLeftJustified, setChartFootnotes(String), setChartTitle

getChartFootnotesThickness

public int getChartFootnotesThickness()
Returns the thickness (height) of the rectangular region at the bottom of the chart allocated for footnotes.

The width of this region always equals the width of the entire GChart (including legend and axis labels).

Your footnotes widget is always vertically centered in this region.

Your footnotes widget will either be horizontally centered in this region, or left justified in it, depending on the property defined by the setChartFootnotesLeftJustified method.

This method always returns 0 if the footnotes widget is null (the default); the rectangular footnotes region is entirely eliminated in that case.

Returns:
the thickness (height) of the rectangular region at the bottom of the chart allocated for footnotes, in pixels.
See Also:
setChartFootnotesThickness, setChartFootnotesLeftJustified

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 if none
See Also:
setChartTitle(Widget), setChartTitle(String)

getChartTitleThickness

public int getChartTitleThickness()
Returns the thickness (height) of the rectangular region at the top of the chart allocated for the title.

This method always returns 0 if the title widget is null (the default); the rectangular title region is entirely eliminated in that case.

Your title widget is always centered vertically and horizontally within this rectangular region.

Returns:
the thickness (height) of the rectangle that contains the chart's title, in pixels.
See Also:
setChartTitleThickness

getClipToDecoratedChart

public boolean getClipToDecoratedChart()
Determines if this chart will clip any chart elements that extend beyond the bounds of the decorated chart. The decorated chart includes title, footnotes, etc. as well as the plot area proper.

Returns:
true if off-the-decorated-chart elements are clipped, false otherwise.
See Also:
setClipToDecoratedChart

getClipToPlotArea

public boolean getClipToPlotArea()
Returns true if graphical aspects of the chart that fall outside of the plot area are being clipped off, false otherwise.

Returns:
true if clipping to plot area, else false.
See Also:
setClipToPlotArea

getClosestBrushTouchingPoint

public GChart.Curve.Point getClosestBrushTouchingPoint(int xPlotArea,
                                                       int yPlotArea)
Returns the point that would be touched if the mouse were moved to the given x,y plot-area pixel coordinates, or null if the moving the mouse to these coordinates would not have touched any points.

This method only works if the chart rendering is up-to-date (if isUpdateNeeded returns false). Otherwise, null is returned.

GChart's hit testing method works best if a chart's points are approximately evenly distributed across the plot area's x or y axis, across a small number of curves. In particular, charts that have many points bunched up into a small part of the plot area, or that have many points completely outside of the plot area, or that place each point into a separate curve, could experience significantly worse that usual hit testing performance. Though such cases are expected to be rare, in the worst case, GChart could be reduced to a simple linear search across all the chart's points during hit testing.

Parameters:
xPlotArea - x-coordinate of trial mouse position, in GChart's plot area pixel coordinates.
yPlotArea - y-coordinate of trial mouse position, in GChart's plot area pixel coordinates.
Returns:
reference to the point that would have been "touched" by the mouse, or null if positioning the mouse to these coordinates would not have touched any point.
See Also:
getMouseCoordinate, modelToPlotAreaPixel, isUpdateNeeded, touch

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

getCurveIndex

public int getCurveIndex(GChart.Curve curve)
Returns the positional index (within this chart's list of curves) of the specified curve.

Returns GChart.NAI if the specified curve is not found on this GChart's curve list.

Parameters:
curve - whose list position is to be retrieved
Returns:
position of curve in GChart's curve list, or GChart.NAI if not on this chart's curve list.
See Also:
getCurve(), getCurve(int), addCurve(), addCurve(int), removeCurve, clearCurves, getNCurves

getFontFamily

public java.lang.String getFontFamily()
Returns the font-family that is used, by default, for all textual annotations (tick labels, point lables, title, footnotes, legend labels, and axis labels) on that chart.

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, or else the special GChart keyword TRANSPARENT_BORDER_COLOR.
See Also:
setLegendBordergroundColor, TRANSPARENT_BORDER_COLOR

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

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

getLegendFontSize

public int getLegendFontSize()
Returns the CSS 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

getLegendFontFamily

public java.lang.String getLegendFontFamily()
Returns the font-family used to render this GChart's legend text.

Returns:
font-famly of legend text.
See Also:
setLegendFontFamily

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

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

getLegendThickness

public int getLegendThickness()
Returns the thickness (width) of the rectangular region to the right of the y2-axis label allocated for the chart legend.

The region extends vertically in parallel with the right edge of the plot area. The legend is always centered vertically and horizontally within this rectangular region.

This method always returns 0 if the legend is not visible; the rectangular legend region is entirely eliminated in that case.

Returns:
thickness (width) of legend key holding region, in pixels.
See Also:
setLegendThickness

getLegend

public com.google.gwt.user.client.ui.Widget getLegend()
Returns the developer-defined widget used for this chart's Legend.

If null (the default) GChart will generate a legend widget internally.

Returns:
the developer-defined legend, or null if none.
See Also:
setLegend

getLegendXShift

public int getLegendXShift()
The amount, in pixels, the legend is shifted along the x axis from its base position.

Returns:
amount legend is shifted along the x axis
See Also:
setLegendXShift

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 position, needed to reach the default initial pie slice orientation.
See Also:
setInitialPieSliceOrientation

getLegendYShift

public int getLegendYShift()
The amount, in pixels, the legend is shifted along the y axis from its base position.

Returns:
amount legend is shifted along the y axis
See Also:
setLegendYShift

getMaxCanvasPixels

public double getMaxCanvasPixels()
Returns the maximum number of pixels any canvas Widget used in GChart's rendering can have.

Returns:
the maximum number of pixels on a GChart canvas widget
See Also:
setMaxCanvasPixels

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

getPlotAreaImageURL

public java.lang.String getPlotAreaImageURL()
Returns the image URL that will be used to define the plot area's background the next time update is called.

Returns:
url of image to be used as the background of the plot area the next time that update is called.
See Also:
setPlotAreaImageURL, update

getOptimizeForMemory

public boolean getOptimizeForMemory()
Returns a flag that tells if GChart is configured to perform updates so that the chart uses less memory.

Returns:
true if GChart optimizes updates to save memory, false (the default) if it optimizes them to save time.
See Also:
setOptimizeForMemory

getRenderPaddingFactor

public double getRenderPaddingFactor()
Returns the previously specified render padding factor.

Returns:
the render padding factor
See Also:
setRenderPaddingFactor

getShowOffChartPoints

public boolean getShowOffChartPoints()
Deprecated. Equivalent to !getClipToPlotArea(). Use that method instead.

See Also:
getClipToPlotArea

getShowOffDecoratedChartGlyphs

public boolean getShowOffDecoratedChartGlyphs()
Deprecated. Equivalent to !getClipToDecoratedChart(). Use that method instead.

See Also:
getClipToDecoratedChart

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

getCurrentCurveData

public static java.lang.Object getCurrentCurveData()
Returns a reference to the auxiliary data object of the curve that is currently being rendered by GChart. If no curve is currently being rendered, returns null.

Vector graphics widgets that implement GChartCanvasLite can use this method to retrieve auxiliary curve data that can then be used to control advanced features of the vector graphics ( GChartCanvasLite implementing) widget that GChart does not directly support. In other words, this method lets you access any custom curve specific data you may need to extend GChart's vector graphics capabilities in various ways.

For example, the GChart live demo uses this method to retrieve a special "Catmull-Rom tension parameter" from the curve's auxiliary data that it uses to adjust the amount of "curvyness" in its various connecting lines. By default, GChart only supports straight connecting lines so the live demo overrides the lineTo method in its GChartCanvasLite implementation so as to call the GWTCanvas method's cubicCurveTo to produce curvy connecting lines with the specified amount of "tension".

As you've probably gathered by now, this kind of thing is not for the faint of heart, and relies on hidden connections with aspects of GChart's internal implementation that could break your code in future GChart releases. On the other hand, there are a myriad of vector graphics library features GChart does not support (curvy lines, gradients, image-based area filling, etc.) and this "backdoor" approach is flexible enough that, if you work a bit, you may be able to exploit many of these advanced features in your charts.

If you implement such a rendering extension that would be helpful to others, please share it on the GChart issue tracker. As we learn more about how people exploit this backdoor, we can probably improve it, make it more reliable, and/or incorporate new vector graphics capabilities directly into GChart.

Tip: This method does not return a reference to the curve itself, because GChart's rendering code assumes that curve specifications proper do not change during rendering. If really you need to get at the curve itself, store a reference to it within your custom data object.

Returns:
the auxiliary, developer-defined, curve data object associated with the currently-being-rendered curve, or null if no curve is currently being rendered.
See Also:
GChartCanvasLite, setCanvasFactory, setCurveData

getHoverParameterInterpreter

public HoverParameterInterpreter getHoverParameterInterpreter()
Returns this GChart's hover parameter interpreter.

Returns:
the hover parameter interpreter used by this GChart, or null if none.
See Also:
setHoverParameterInterpreter

getHoverTouchingEnabled

public boolean getHoverTouchingEnabled()
Is it possible to select points and have their hover annotations pop up, merely by "touching" them with the mouse-attached "brush"?

Returns:
true (the default) if just hovering over a point can select it, false if you must click on a point to select it.
See Also:
setHoverTouchingEnabled

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

getXChartSizeDecorated

public int getXChartSizeDecorated()
Returns the number of x-pixels reserved for the chart as a whole, including space reserved for decorations (title, footnotes, axis labels, ticks, tick labels, legend key, etc.).

The returned size does not include the border or padding around the chart as a whole.

You cannot directly set the decorated x chart size. Instead, you must set the width of the plot area, and the thicknesses of certain of the decoration-holding regions (using methods linked to below) that, summed together, define the total width of the chart.

Returns:
the width of the entire chart, in pixels.
See Also:
setXChartSize, getYChartSizeDecorated, setAxisLabelThickness, setTickLabelThickness, setTickLength, setTickLocation, setTickLabelPadding, setLegendThickness

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

getYChartSizeDecorated

public int getYChartSizeDecorated()
Returns the number of y-pixels reserved for the chart as a whole, including space reserved for decorations (title, footnotes, axis labels, ticks, tick labels, etc.).

The returned size does not include the border or padding around the chart as a whole.

You cannot directly set the decorated y chart size. Instead, you must set sizes and thicknesses of the plot area and certain of the decoration-holding regions (using the methods linked-to below) that, when summed together, define the height of the decorated chart.

Returns:
the height of the entire chart, in pixels.
See Also:
setYChartSize, getXChartSizeDecorated, setAxisLabelThickness, setTickLabelThickness, setTickLength, setTickLocation, setTickLabelPadding, setChartTitleThickness, setChartFootnotesThickness

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.

Returns:
true if the chart has a second y axis, false otherwise.
See Also:
Curve.setYAxis

hasYAxis

public boolean hasYAxis()
Determines if this chart has an ordinary, or left, y-axis.

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

Returns:
true if the chart has a left y axis, false otherwise
See Also:
Curve.setYAxis

isLegendVisible

public boolean isLegendVisible()
Determines if the legend of this chart is visible.

Returns:
true if the legend is visible, false otherwise.
See Also:
setLegendVisible

isUpdateNeeded

public boolean isUpdateNeeded()
Is the in-browser rendition of the chart inconsistent with the current chart specs? In other words, is a call to GChart's update method needed to bring the browser's display into agreement with current chart specs?

Note: Whenever this method returns true, GChart "freezes" hover feedback, and can no longer actively track the currently "touched" point. This is because GChart, to simplify its bookkeeping, assumes in-browser (DOM) rendering and current chart specs are in synch when determining the point selection consequences of mouse events over the chart.

Returns:
true if a call to update is needed to bring current chart specifications and browser-rendered representation into synch, false otherwise.
See Also:
update, getTouchedPoint

removeCurve

public void removeCurve(int iCurve)
Removes the curve at the specified positional index.

Parameters:
iCurve - index of the curve to be removed
See Also:
removeCurve(Curve), getCurve, addCurve(), addCurve(int), clearCurves, getNCurves

removeCurve

public void removeCurve(GChart.Curve curve)
Removes the given curve from this GChart.

If the given curve is null or is not a curve on this GChart, an exception is thrown.

Parameters:
curve - the curve to be removed.
See Also:
removeCurve(int)

setBackgroundColor

public void setBackgroundColor(java.lang.String cssColor)
Specifies the background color of the chart as a whole.

The default background color is USE_CSS.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - the chart's background color, in a standard CSS color string format.
See Also:
USE_CSS

setBlankImageURL

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

When GWT compiles an application that imports the GChart library, it automatically adds an appropriate blank image, gchart.gif, to the module base directory (this is the directory into which GWT also copies your compiled Javascript, all the files in your public directory, etc.).

By default, GChart uses the following blank image URL:

 GWT.getModuleBaseURL() + "gchart.gif"
 

Earlier versions used "gchart.gif" as this default url. This GWT forum post by Dean S. Jones identified the need to add the GWT.getModuleBaseURL() prefix.

Note that this default adds a potentially very long URL to every img element added by GChart to render your chart, which can (in theory) more than double the memory required to represent your chart in the browser, because the absolute URLs can be of undetermined length. In practice, browser memory usage increases of 10% have been observed with the on-line demo GChart and a typicial, 60-odd character absolute URL.

You have several alternatives to the above default that can often reduce the length of the URL and thus save browser memory:

  1. Simply copy gchart.gif from the module base directory into your host page's base directory, and then use setBlankImageURL("gchart.gif") to access this URL relatively.
  2. If the relative path from the host page base directory to the module base directory is reasonably short, pass that alternative relative URL to this method (note that all relative URLs are interpreted relative to the base directory of the host page containing your GChart).
  3. Place a copy of gchart.gif into a directory whose absolute URL is very short, and then pass that short absolute URL to this method.

Special note to anyone reading this who designed HTML's image tag: If you had provided a src=none option, this method would not have to exist.

Tip: If you already have an appropriate blank gif on your site that is accessible from the host page via a reasonably short URL there is no need to copy gchart.gif. You can just pass that URL to this method.

Note: Though GChart uses this blank image by default, you can use the setImageURL method to specify a non-blank image for use in rendering a specific curve.

Parameters:
blankImageURL - a URL that points to a 1 x 1 pixel transparent image that GChart needs to render your charts without adding a spurious "missing image" icon.
See Also:
getBlankImageURL, DEFAULT_BLANK_IMAGE_URL, setImageURL

setBorderColor

public void setBorderColor(java.lang.String cssColor)
Specifies the color of the border around the chart as a whole.

The default border color is USE_CSS.

Tip: No border will appear if either borderStyle is none, borderWidth is 0px or borderColor is transparent. Since these will often be the "CSS inherited" values, generally, it's best to set all three properties whenever you set any one of them.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - the color of the chart's border, in a standard CSS color string format.
See Also:
setBorderWidth, setBorderStyle, getBorderColor, USE_CSS

setBorderStyle

public void setBorderStyle(java.lang.String borderStyle)
Sets style of the border around the chart as a whole.

The default border style is USE_CSS.

Tip: No border will appear if either borderStyle is none, borderWidth is 0px or borderColor is transparent. Since these will often be the "CSS inherited" values, generally, it's best to set all three properties whenever you set any one of them.

Parameters:
borderStyle - a CSS border style such as "solid", "dotted", "dashed", etc.
See Also:
getBorderStyle, setBackgroundColor, setBorderColor, setBorderWidth, USE_CSS

setBorderWidth

public void setBorderWidth(java.lang.String cssWidth)
Specifies the width of the border around the chart as a whole.

The default border width is USE_CSS.

Tip: No border will appear if either borderStyle is none, borderWidth is 0px or borderColor is transparent. Since these will often be the "CSS inherited" values, generally, it's best to set all three properties whenever you set any one of them.

Parameters:
cssWidth - width of the border around the chart as a whole, expressed as a CSS border-width specification string, such as "1px".
See Also:
getBorderWidth, setBorderStyle, setBorderColor, USE_CSS

setCanvasExpansionFactors

public void setCanvasExpansionFactors(double widthExpansionFactor,
                                      double heightExpansionFactor)
Specifies the fractional amount that the default width and height of each canvas used to render this chart will be increased. For example, with 100px x 200px default sized canvas rectangle, and canvas width and height expansion factors of 0.1 and 0.2, the canvas rectangle would be increased to 110px x 240px.

If you plug in an external vector graphics library via setCanvasFactory, GChart creates a vector graphics "canvas" for each curve that is just big enough to contain the points on that curve. These "shrink-wrapped" canvas rectangles save memory. But, if you use Bezier curves, your curves can easily extend outside of these rectangles. So, this method lets you "pad" these canvas rectangles with extra space, thus preventing such "overshooting" curves from being improperly clipped off.

To handle every possible Bezier overshoot contingency, these canvas expansion factors would have to be huge. But, in the oil price simulation of the live demo, even with its "100% curvy" option, a factor of 0.3 on the y axis and 0.0 on the x axis (a 30% memory hit for this chart) works well. 0.1 on y even works OK, if you don't mind truncatiing the wildest overshooting curves.

Parameters:
widthExpansionFactor - the fraction that the width of the canvas rectangle will be expanded. The default is 0 (no width expansion).
heightExpansionFactor - the fraction that the height of the canvas rectangle will be expanded. The default is 0 (no height expansion).
See Also:
setCanvasFactory

setChartFootnotes

public void setChartFootnotes(java.lang.String html)
Convenience method equivalent to setChartFootnotes(new HTML(html)) .

Parameters:
html - HTML text used to define the chart's title.
See Also:
setChartFootnotes(Widget)

setChartFootnotes

public void setChartFootnotes(com.google.gwt.user.client.ui.Widget chartFootnotes)
Sets widget that appears just below the chart.

The widget will vertically centered within a band just below the x axis label that stretches along the entire bottom edge of the chart, and whose height is defined by setChartFootnotesThickness.

The widget will either be left justified, or horizontally centered, within this band depending on the property defined by setChartFootnotesLeftJustified

Parameters:
chartFootnotes - widget representing the chart's footnotes
See Also:
setChartFootnotes(String), setChartFootnotesThickness, getChartFootnotes, setChartFootnotesLeftJustified

setChartFootnotesLeftJustified

public void setChartFootnotesLeftJustified(boolean footnotesLeftJustified)
Defines if this chart's footnotes are left justified, or horizontally centered across the bottom edge of the chart.

Note that a chart's footnotes are always vertically centered within the band at the bottom of the chart reserved for chart footnotes. Use the setChartFootnotesThickness method to set the height of this band.

Parameters:
footnotesLeftJustified - true to position chart footnotes flush against the left edge of the chart, false (the default) to center them horizontally across the chart's bottom edge.
See Also:
setChartFootnotes(String), getChartFootnotes, setChartFootnotesThickness(int)

setChartFootnotesThickness

public void setChartFootnotesThickness(int thickness)
Sets the thickness (height) of the rectangular region at the bottom of the chart allocated for the footnotes.

The width of this region always equals the width of the entire GChart (including legend and axis labels).

Your footnotes widget is always vertically centered in this region.

Your footnotes widget will either be horizontally centered in this region, or left justified in it, depending on the property defined by the setChartFootnotesLeftJustified method.

This setting has no impact on chart layout if the footnotes widget is null (the default); the rectangular footnotes region is entirely eliminated, and in effect has a 0 thickness, in that case.

If you set the footnotes thickness to GChart.NAI (the default) GChart will use a thickness based on the estimated number of ( <br> or <li> delimited) lines.

Parameters:
thickness - the thickness (height) of the rectangle that contains the footnotes, in pixels, or GChart.NAI to use the default thickness.
See Also:
getChartFootnotesThickness, setChartFootnotesLeftJustified, GChart.NAI, DEFAULT_FOOTNOTES_THICKNESS

setChartSize

public void setChartSize(int xChartSize,
                         int yChartSize)
Convenience method equivalent to setXChartSize(xChartSize); setYChartSize(yChartSize).

Parameters:
xChartSize - number of x-pixels in the curve display area of the chart
yChartSize - number of y-pixels in the curve display area of the chart
See Also:
setXChartSize, setYChartSize

setChartTitle

public void setChartTitle(java.lang.String html)
Convenience method equivalent to setChartTitle(new HTML(html)).

Parameters:
html - HTML text used to define the chart's title.
See Also:
setChartTitle(Widget)

setChartTitle

public void setChartTitle(com.google.gwt.user.client.ui.Widget chartTitle)
Specifies the widget that appears centered just above the chart.

Parameters:
chartTitle - the widget to be used as this chart's title.
See Also:
setChartTitle(String), setChartTitleThickness, getChartTitle

setChartTitleThickness

public void setChartTitleThickness(int thickness)
Sets the thickness (height) of the rectangular region at the top of the chart allocated for the title.

Your title widget is always centered vertically and horizontally within this rectangular region.

This setting has no impact on chart layout if the title widget is null, since the title-holding region is entirely eliminated in that case. If you set the title thickness to GChart.NAI (the default) GChart will use a thickness that is based on the the number of <br> or <li> delimited HTML lines if the title Widget implements HasHTML.

Parameters:
thickness - the thickness (height) of the rectangle that contains the title, in pixels, or GChart.NAI to use the default thickness.
See Also:
getChartTitleThickness, GChart.NAI, DEFAULT_TITLE_THICKNESS

setClipToDecoratedChart

public void setClipToDecoratedChart(boolean clipToDecoratedChart)
Specifies if this chart will clip any rendered chart elements (including hover selection feedback and popup annotations) that extends beyond the bounds of the decorated chart.

The decorated chart includes not just the plot area, but space allocated for titles, footnotes, legend key, axis labels, tick marks, etc. The size of this decorated chart can be obtained via the getXChartSizeDecorated and getYChartSizeDecorated methods.

Note that, in non-IE browsers, drawing a curve via GWTCanvas that falls outside the bounds of the decorated chart could occlude mouse events over elements on the enclosing page that fall within the smallest bounding rectangle that contains the canvas-rendered curve. HTML rendering (IE's element-based VML used by GWTCanvas is essentially HTML-like in this respect) only creates such occlusions at the positions where the curve is actually rendered.

Parameters:
clipToDecoratedChart - use true to clip off-the-decorated-chart symbols, annotations, etc. or false (the default) to allow such chart elements to be drawn outside of the rectangular region allocated for the chart.
See Also:
getClipToDecoratedChart, GChart.setClipToPlotArea, Curve.setClipToPlotArea, getXChartSizeDecorated, getYChartSizeDecorated, setCanvasFactory

setClipToPlotArea

public void setClipToPlotArea(boolean clipToPlotArea)
Specifies if rendered graphics falling outside the plot area will be clipped off.

Note: This clipping does not apply to the hover selection feedback. In particular, points that fall outside the plot area, though not visible, will still display their selection feedback and pop-up hover annotations when the user mouses over them.

Parameters:
clipToPlotArea - false (the default) to display off-the-plot-area graphics, true to clip them off.
See Also:
getClipToPlotArea, setClipToDecoratedChart, Curve.setClipToPlotArea

setDefaultSymbolBorderColors

public static void setDefaultSymbolBorderColors(java.lang.String[] defaultBorderColors)
Sets the symbol border colors that are used by default for newly created curves. The array must contain one or more elements, each a standard CSS or RGBA color specification string (see the setBackgroundColor link below for more on CSS color specification strings) or the special GChart keyword TRANSPARENT_BORDER_COLOR.

GChart uses the first color in this array as the default border color of the first curve added (via addCurve), the second color for the second curve added, and so on. If more curves are added than the number of elements in the default border colors array, the sequence is repeated.

Note that each curve/symbol's default color is "locked in" at the point when that curve/symbol is first added, based on the total number of curves at that time.

Because, by default, GChart uses a transparent symbol background color, the default border color will usually, in effect, define the default color of each curve. The default border color also defines the default color of point-to-point connecting lines in a line chart.

If not explicitly specified via this method, GChart uses GChart.DEFAULT_SYMBOL_BORDER_COLORS by default. However, most people find the color sequence used by OpenOffice's Charts more aesthetically pleasing. The World's Simplest Line Chart Editor example chart contains a line of code that makes GChart use the OpenOffice defaults.

This feature was added in response to an email from Joe Cole and this post by Sanjiv Jivan. They both pointed out the importance of changing GChart's default colors.

Parameters:
defaultBorderColors - array of CSS color strings whose successive elements define the initial symbol border colors for curves in the order that they are added.
See Also:
DEFAULT_SYMBOL_BORDER_COLORS, TRANSPARENT_BORDER_COLOR, setBackgroundColor, setBorderColor, addCurve

setFontFamily

public void setFontFamily(java.lang.String fontFamily)
Specifies the font-family that is used, by default, for all textual annotations (tick labels, point labels, title, footnotes, legend labels, and axis labels) on this chart.

This chart-specific default font family setting will be overridden if a more specific method of setting the font family has been employed.

The default overall font family is DEFAULT_FONT_FAMILY.

See Also:
setTickLabelFontFamily, setAnnotationFontFamily, setLegendFontFamily, DEFAULT_FONT_FAMILY

setGridColor

public void setGridColor(java.lang.String cssColor)
Specifies the single color used for all gridlines, axes lines, and tick marks.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - the color, in CSS standard color format, to be used for all gridlines, axes, and tick marks.
See Also:
getGridColor, DEFAULT_GRID_COLOR

setHoverParameterInterpreter

public void setHoverParameterInterpreter(HoverParameterInterpreter hpi)
Defines this GChart's hover parameter interpreter.

Hovertext template strings can include ${... } bracketed references to built-in parameters such as ${x} and ${y} that get get replaced with appropriate string representations of the x or y values of the hovered-over point in displayed hovertext. You can add new, custom, named parameters, and/or redefine the meaning of built-in parameters, by passing a hover parameter interpreter to this method.

For sample code that shows you how to define a hover parameter interpreter, see HoverParameterInterpreter.

Parameters:
hpi - the hover parameter interpreter to use with all hovertext templates on this GChart (this interpreter is responsible for replacing ${...} bracketed embedded parameter names in the hover text template with appropriate HTML snippets representing the value of that parameter at the hovered-over point).
See Also:
HoverParameterInterpreter, setHovertextTemplate

setHoverTouchingEnabled

public void setHoverTouchingEnabled(boolean hoverTouchingEnabled)
Specifies if merely hovering over a point is sufficient to select it and display its hover annotation (true), or if an actual click is needed (false).

With the default of true, points are auto-selected as the user "touches" them with the mouse-attached "brush"--no clicking is required.

When hover touching is disabled, a GChart can be used in a manner analogous to a single-selection (sorry there's no multi-selection capability) listbox, with its click-selectable points playing the role of the selectable list items. Specifically, disabling hover touching lets you move the mouse freely without any danger of changing the selected point--the point even remains selected if the mouse moves entirely off the chart. This is helpful when your application follows the common pattern of "select the thing you want to operate on, then issue a command that operates on that thing". This option is also helpful if you use very compute-intensive hover widgets, or if you simply prefer explictly-clicked-open/closed pop-up annotations.

How to Stop Leaky Clicks: In IE7 and the hosted mode browser, clicking ahead on a Button widget "leaks" clicks upwards to the enclosing parent, even if you call event.cancelBubble(true). Such "leaky clicks" can inappropriately change the selected point, when you really just wanted to operate on it. This does not happen in Firefox 2, 3, or Chrome, whose buttons properly "eat" the clicks--even when they come in fast. To workaround the problem, you can place the buttons into a hover widget (as shown in GChartExample21.java in the chart gallery). This works because GChart applies checks that ignore any mouse events that occur within the rectangular region associated with the opened hover widget.

For an example that uses setHoverTouchingEnabled(false) to allow the user to change the y-value of the selected point, see the Chart Gallery's GChartExample21.

Parameters:
hoverTouchingEnabled - true (the default) if you want users to be able to select points simply by hovering over them with their mouse, false if you want to require that they actually click on points to select them.
See Also:
getHoverTouchingEnabled, setBrushHeight, touch, update, HoverUpdateable

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

setLegendBackgroundColor

public void setLegendBackgroundColor(java.lang.String cssColor)
Sets the background color of the chart's legend.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - the legend's background color, in a standard CSS color string format.
See Also:
getLegendBackgroundColor, DEFAULT_LEGEND_BACKGROUND_COLOR

setLegendBorderColor

public void setLegendBorderColor(java.lang.String cssColor)
Sets the border color of the chart's legend.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - the color of the legend's border, in a standard CSS color string format, of the special GChart keyword TRANSPARENT_BORDER_COLOR for a transparent border.
See Also:
getLegendBorderColor, DEFAULT_LEGEND_BORDER_COLOR, TRANSPARENT_BORDER_COLOR

setLegendBorderWidth

public void setLegendBorderWidth(int width)
Sets the width of the chart legend's border.

Parameters:
width - the width of the legend's border, in pixels
See Also:
getLegendBorderWidth, DEFAULT_LEGEND_BORDER_WIDTH

setLegendBorderStyle

public void setLegendBorderStyle(java.lang.String borderStyle)
Sets style of the border around the chart's legend (key).

Parameters:
borderStyle - a CSS border style such as "solid", "dotted", "dashed", etc.
See Also:
getLegendBorderStyle, setLegendBackgroundColor, setLegendBorderColor, DEFAULT_LEGEND_BORDER_STYLE

setLegendFontColor

public void setLegendFontColor(java.lang.String cssColor)
Specifies the color of the legend's font. Default is DEFAULT_FONT_COLOR.

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - color of the font used to display the labels in the legend.
See Also:
getLegendFontColor, DEFAULT_FONT_COLOR

setLegendFontSize

public void setLegendFontSize(int legendFontSize)
Specifies the CSS font size, in pixels, of text displayed in the chart's legend (also know as a chart's key).

This size also governs the size of the symbol icon displayed in the legend.

Default is DEFAULT_LEGEND_FONTSIZE.

Parameters:
legendFontSize - the font size of legend text
See Also:
getLegendFontSize, DEFAULT_LEGEND_FONTSIZE

setLegendFontFamily

public void setLegendFontFamily(java.lang.String cssFontFamily)
Specifies the CSS font-family of the font used to render the legend's labels.

If null (the default) the legend will just use the font family specified via GChart.setFontFamily.

Parameters:
cssFontFamily - any valid CSS font-family, such as "serif", "sans-serif", "monospace", "cursive", * "fantasy" or "Arial, sans-serif".
See Also:
getLegendFontFamily, DEFAULT_FONT_FAMILY

setLegendFontStyle

public void setLegendFontStyle(java.lang.String cssStyle)
Specifies the cssStyle of the font used to render the legend's labels. Default is DEFAULT_FONT_STYLE.

Parameters:
cssStyle - any valid CSS font-style, namely, normal, italic, oblique, or inherit.
See Also:
getLegendFontStyle, DEFAULT_FONT_STYLE

setLegendFontWeight

public void setLegendFontWeight(java.lang.String cssWeight)
Specifies the weight of the font used in the labels of the legend. Default is DEFAULT_FONT_WEIGHT.

Parameters:
cssWeight - a CSS font-weight specification, such as bold, bolder, normal, light, 100, 200, ... or 900.
See Also:
getLegendFontWeight, DEFAULT_FONT_WEIGHT

setLegendLocation

public void setLegendLocation(GChart.LegendLocation legendLocation)
Specifies the position of the legend on the chart.

The default LegendLocation is LegendLocation.OUTSIDE_RIGHT.

To shift the legend relative to these base locations, use setLegendXShift and setLegendYShift.

Parameters:
legendLocation - the postion of the legend on the chart
See Also:
setLegendXShift, setLegendYShift, setLegend

setLegend

public void setLegend(com.google.gwt.user.client.ui.Widget legend)
This method allows you to replace GChart's legend with a Widget you create to represent the chart legend.

Passing in null reverts to the default GChart-generated legend.

Parameters:
legend - - a Widget that will be placed at the location specified by setLegendLocation, or null to let GChart create the legend Widget.
See Also:
getLegend, setLegendLocation, setLegendXShift, setLegendYShift

setLegendXShift

public void setLegendXShift(int xShift)
Specifies the number of pixels (along the x-axis) to move the legend from its default, LegendLocation-defined, position. Negative values move the legend in the negative x direction.

Parameters:
xShift - number of pixels to move legend along the x axis from it's default, LegendLocation-defined, position.
See Also:
setLegendLocation, setLegendYShift

setLegendYShift

public void setLegendYShift(int yShift)
Specifies the number of pixels (along the y-axis) to move the legend from its default, LegendLocation-defined, position. Postive values shift the legend towards the top of the page, negative values towards the bottom.

Parameters:
yShift - number of pixels to move legend along the y axis from it's default, LegendLocation-defined, position.
See Also:
setLegendLocation, setLegendXShift

setLegendThickness

public void setLegendThickness(int legendThickness)
Sets the thickness (width) of the rectangular region at the right or left of the chart allocated for the legend key.

This setting has no impact on chart layout if the legend key is not visible, or if the legend key is placed inside the plot area of the chart, since the legend takes up no space on the left or right sides of the chart in such cases.

If the legend thickness is set to GChart.NAI (the default) GChart uses an heuristic to set the legend thickness based on the number of characters in each curve's legend label.

Parameters:
legendThickness - the thickness (width) of the rectangle that contains the legend key, in pixels, or GChart.NAI to use a built-in heurstic to determine the legend width.
See Also:
getLegendThickness, setLegendLabel, Y2Axis.setAxisLabelThickness

setLegendVisible

public void setLegendVisible(boolean isLegendVisible)
Specifies if the legend is to be visible on this chart. Legends are visible by default. However, a legend is only generated if at least one curve's legend label has been specified.

Parameters:
isLegendVisible - true to display the legend, false to hide it.
See Also:
isLegendVisible, setLegendLabel

setMaxCanvasPixels

public void setMaxCanvasPixels(double maxCanvasPixels)
Sets the upper bound on the number of pixels any canvas widget used by GChart can have.

If the number of pixels ever exceeds this amount, GChart will scale the offending canvas down uniformly in width and height, until it has around the specified number of pixels, and then move it as close to being centered on the plot area as is consistent with remaining within the original, unshrunken, clipping rectangle. This strategy means that points furthest off the plot area could be dropped due to this max pixel limit.

Because GChart allows you to draw outside of the decorated chart, the size of the required canvas is not always known in advance. But the use of very large sized canvas widgets can lead to serious performance problems (including large memory use on some browsers, e.g. Firefox). This method provides a simple way for developers to avoid such problems without having to explicitly eliminate "far off the chart" data points from their charts.

Parameters:
maxCanvasPixels - the maximum number of pixels any single GChart canvas Widget (GChartCanvasLite) will contain.
See Also:
DEFAULT_MAX_CANVAS_PIXELS, getMaxCanvasPixels

setOptimizeForMemory

public void setOptimizeForMemory(boolean optimizeForMemory)
By default, this property is false, which means that GChart will retain no-longer-needed Image and Grid widgets (plus any user object references associated with those widgets, such as those created via the setAnnotationText and setAnnotationWidget methods) between updates in the expectation that they may be needed by future updates. This strategy often makes updates faster, because building new Image and Grid elements "from scratch" is very expensive. However, strictly speaking, GChart is holding onto memory it no longer needs to render the chart right now--which would normally be considered a memory leak if it were not being done deliberately.

If optimizeForMemory is set to true, GChart will (at the very next update() call) free up any Image or Grid elements that are no longer required to render the current chart. Should a chart's size grow back to a former size, the subsequent update would be slower, though.

Charts that use exactly the same number of Image and Grid elements for each update (for example a bar chart where the number of bars is fixed) will see no impact on either memory use or update speeds by setting this parameter. Charts that have a highly variable number of Image or Grid elements (for example, a chart whose number of points varies randomly between 5 and 500) may see a very large impact on speed (false is faster) or memory (true is more compact).

The setting of this parameter never has any impact on the speed or memory used on the very first chart update.

In one test using the future oil price simulation chart of GChart's live demo (which has only small changes in the number of elements required to render the chart between updates) setting this parameter to true made the updates, on average, around 10% slower, but also reduced the memory footprint by around 2%.

Parameters:
optimizeForMemory - true to optimize updates to use less memory, false (the default) to optimize them to use less time.
See Also:
update

setPadding

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

The default padding is USE_CSS.

Parameters:
cssPadding - the width of the padding, as a CSS padding specification string (e.g. use "1px" to introduce a 1 pixel padding just between the chart' border and the chart itself)
See Also:
getPadding, setBorderWidth, setBorderStyle, setBorderColor, USE_CSS

setPlotAreaBackgroundColor

public void setPlotAreaBackgroundColor(java.lang.String cssColor)
Specifies the background color of the area of the chart in which symbols representing curve data are displayed

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - CSS color string defining the plot area's background color
See Also:
getPlotAreaBackgroundColor

setPlotAreaBorderColor

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

For more information on standard CSS color specifications see the discussion in Symbol.setBackgroundColor.

Parameters:
cssColor - CSS color string defining the color of the plot area's border
See Also:
getPlotAreaBorderColor

setPlotAreaBorderWidth

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

Parameters:
width - the width, in pixels, of the border around the plot area
See Also:
getPlotAreaBorderWidth

setPlotAreaBorderStyle

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

Parameters:
borderStyle - a CSS border style such as "solid", "dotted", "dashed", etc.
See Also:
getPlotAreaBorderStyle, setPlotAreaBackgroundColor, setPlotAreaBorderColor

setPlotAreaImageURL

public void setPlotAreaImageURL(java.lang.String imageURL)
Sets the image URL that defines the background of the GChart plot area. The GChart plot area is the rectangular region defined by the x and y axes of the plot, but does not include those axes (or their ticks).

Note that by default, or if this URL is set to null, GChart will use the URL returned by getBlankImageURL.

Ideas/tips for using the plot area background URL:

  1. It's often best to exactly match the width and height of the image with the GChart plot area width and height (defined via (via setChartSize). Otherwise, the image will be scaled up or down to fit the plot area, which usually doesn't look that great.
  2. Note that since a Google Chart API url is just an image url to GChart, you can easily use a Google Chart API url to define the background of an otherwise client-side chart. For example, you might place a static 3-D pie chart behind a rapidly changing client-side GChart bar chart.
  3. Note that this method's image will appear behind every gridline and curve on the chart. To overlay images on top of the gridlines or other curves, or even to place them outside of the plot area, use a dedicated curve and its symbol's setImageURL method, or simply embed such images within HTML-defined point annotations.

Parameters:
imageURL - URL of the image used as the background of the plot area.
See Also:
getPlotAreaImageURL, setBlankImageURL, setImageURL

setRenderPaddingFactor

public void setRenderPaddingFactor(double renderPaddingFactor)
Defines a region around the perimeter of the currently visible area of the chart that will be rendered, even though it cannot at present be seen (due to clipping).

By default, this factor is 0.0 and GChart is free to skip the rendering any parts of the chart that would have been clipped off anyway. However, special applications, such as panning, may find it advantageous to fully render areas adjacent to the clipping window, so that these pre-rendered areas can then be quickly shifted into view via the setXShift and setYShift methods.

The width and height of the clipping window (typically the plot area) are expanded by the specified fraction along each edge. For example, a render padding factor of 1.0 expands the rendered height by a factor of 300% (100% extra above, and 100% extra below) and the width by the same factor (100% extra to the left, and 100% extra to the right).

Parameters:
renderPaddingFactor - the fractional amount to expand to the rendering window around the perimeter of the clipping window.
See Also:
setXShift, setYShift, getRenderPaddingFactor

setShowOffChartPoints

public void setShowOffChartPoints(boolean showOffChartPoints)
Deprecated. Equivalent to setClipToPlotArea(!showOffChartPoints) . Use that method instead.

As of GChart 2.5, the clip-to-plot-area algorithm no longer drops the entire symbol if it's x,y coordinates are outside of the plot area; instead, it clips them off in the traditional "overflow: hidden" manner. Though unlikely you would need to, there is no easy way to recreate the previous behavior.

This change was made so that both rectangular HTML and continuous, canvas-rendered chart elements would be clipped in a consistent and sensible way.

See Also:
setClipToPlotArea

setShowOffDecoratedChartGlyphs

public void setShowOffDecoratedChartGlyphs(boolean showOffDecoratedChartGlyphs)
Deprecated. Equivalent to setClipToDecoratedChart(!showOffDecoratedChart), please use that method instead.

See Also:
setClipToDecoratedChart

getTouchedCurve

public GChart.Curve getTouchedCurve()
Returns the curve that the mouse "brush" is currently "touching" (the so-called "hovered over" point), or null if none.

Convenience method equivalent to (when the touched point is not null) getTouchedPoint().getParent(). See getTouchedPoint for full details.

See the setBrushHeight method for the rules GChart uses to determine the currently touched point.

Returns:
a reference to the curve that the mouse "brush" is currently "touching".
See Also:
getTouchedPoint, setBrushHeight, setHoverSelectionSymbolType

getTouchedPoint

public GChart.Curve.Point getTouchedPoint()
Returns the point that the mouse "brush" is currently "touching" (the so-called "hovered over" point), or null if none.

Fine-print: If the chart clicked on needs an update, this method returns the touched point as of the last time the chart's in-browser (DOM) display was up-to-date. If you don't assure that your chart's DOM display is up-to-date via other means (e.g. updating right after you change its specifications) a quick check with the isUpdateNeeded method and a subsequent update before accessing the touched point can be a good strategy.

See the setBrushHeight method for the rules GChart uses to determine the currently touched point.

Warning: The currently touched point, on FF2 (but not in IE7) can be changed (or set to null) by invoking Window.alert. Though I originally expected that such a modal alert box would "eat" all mouse events (and it does just that in IE7) in FF2 (and possibly other browsers) some mouse events on the alert box are also passed on up to the GChart. It's best for applications that need to "lock on" to the initially touched point to grab a reference to the touched point before performing any activity that allows the user to interact with the browser in ways that could possibly generate GChart-visible mouse events.

Returns:
a reference to the point that the mouse "brush" is currently "touching".
See Also:
getTouchedCurve, touch, setBrushHeight, setHoverSelectionSymbolType, isUpdateNeeded, update, getMouseCoordinate, clientToModel, modelToClient, pixelToModel, modelToPixel

setXChartSize

public void setXChartSize(int xChartSize)
Sets the number of pixels, in the horizontal dimension, available for curve display. Note that this curve display area does not include the axes themselves, their tick marks, their labels, etc.

Note: Most modern display devices use "square" pixels, that is, pixels whose width and height are the same. GChart tacitly assumes square pixels in many of its default settings.

Parameters:
xChartSize - the number of x-pixels in the chart region used for curve display.
See Also:
getXChartSize, getXChartSizeDecorated, setYChartSize

setYChartSize

public void setYChartSize(int yChartSize)
Sets the number of pixels, in the vertical dimension, available for curve display. Note that this curve display region of the chart does not include the axes themselves, their tick marks, labels, etc.

Note: Most modern display devices use "square" pixels, that is, pixels whose width and height are the same. GChart tacitly assumes square pixels in many of its default settings.

Parameters:
yChartSize - the number of y-pixels in the chart region used for curve display.
See Also:
getYChartSize, getYChartSizeDecorated, setXChartSize

touch

public void touch(GChart.Curve.Point pointToTouch)
Simulates the user "touching" a point with the mouse, by performing those operations that occur when the user "hovers over" the specified point. In detail, this method does the following:

  1. The specified point is made the currently "touched point" (this is the reference returned by getTouchedPoint).

  2. If the previously touched point had a hover widget, that hover widget's hoverCleanup method is called.

  3. If the touched point has an associated hover widget, that widget's hoverUpdate method is called.

  4. Any hover selection feedback or hover annotation on any previously touched point is removed.

  5. Any hover annotation for the newly touched point is displayed as per the various hover annotation related specifications (e.g. setHoverLocation) associated with the symbol used to render the point.

  6. Any selection feedback for the newly touched point is displayed in accord with the hover selection feedback specificiations (e.g. setHoverSelectionBorderColor) associated with the symbol used to render the point.

Using null as the point to touch simulates the user moving the mouse into a region where it is not touching any point (for example, off the chart entirely).

Note that, as with all chart specification changes, you must invoke update before the point selection and other changes associated with this method will appear on the chart.

Tip: The touched point can sometimes be used in lieu of a point selection capability (which GChart lacks). For example, a dialog box that allowed users to choose data points by their names could "touch" the point associated with a user-selected name in order to highlight it on the chart.

Parameters:
pointToTouch - this method will perform appropriate operations (as described above) in order to simulate the user "touching" this point with their mouse.
See Also:
getTouchedPoint, getTouchedCurve, hoverUpdate, hoverCleanup, setHoverWidget, setHoverLocation, setHoverSelectionBorderColor, getMouseCoordinate, clientToModel, modelToClient, pixelToModel, modelToPixel

update

public void update(GChart.TouchedPointUpdateOption option)
Builds a chart that reflects current user-specified chart specs (curve data, symbol choices, etc.)

Before any of the chart specifications of the other methods of this class will actually be visible on the chart, you must call this method.

Typically, for efficiency, you would call this method only after you had made all of the desired chart specifications via the other methods.

By default, updates are optimized for speed, and this can end up wasting (usually not too much, though there are exceptions) memory. To optimize for memory instead, use the setOptimizeForMemory method.

For a discussion of Client-side GChart update times and how minimize them, see Tips for Making Client-side GChart Updates Faster.

Note Hover feedback is disabled whenever the currently rendered chart does not match current chart specs, that is, whenever isUpdateNeeded returns true. Thus, to assure that hover feedback remains operational once your code returns control to the browser, be sure to call update() after making a series of changes to your chart's properties.

Understanding how update impacts visibility and size:

Due to an implementation-related limitation, visibility: hidden won't hide a GChart (update commandeers the visibility attribute). Instead use display: none or, equivalently:
 myGChart.setVisible(false);
 
If you need to avoid display: none (it can change page layout), you can also hide a GChart via lines such as:
 DOM.setStyleAttribute(myGChart.getElement(), "overflow", "hidden");
 myGChart.setPixelSize(0, 0);
 
This later approach gives you the option of leaving the top corner of the GChart visible, etc. Note that, with the next update, GChart will overwrite your size (based on the GChart properties that define the size of the the chart, such as setChartSize and set*Thickness) and your overflow:hidden (based on setClipToDecoratedChart) specifications. To preserve them (or in other special cases) you may need to apply such settings to an enclosing parent element.

Parameters:
option - determines how the touched (or "hovered over") point changes as a result of this update. See TouchedPointUpdateOption for the available choices.
See Also:
TouchedPointUpdateOption, setOptimizeForMemory, isUpdateNeeded

update

public void update()
Updates the chart, using an appropriate default touched point update option, depending on if hover touching is enabled or not.

A convenience method equivalent to:

 if (getHoverTouchingEnabled())
   update(TouchedPointUpdateOption.TOUCHED_POINT_UPDATED);
 else
   update(TouchedPointUpdateOption.TOUCHED_POINT_LOCKED);
 

See Also:
update(TouchedPointUpdateOption), setHoverTouchingEnabled

For downloads, demos, and more visit the
Client-side GChart Home Page

Copyright © 2007-2009 John C. Gunther. All Rights Reserved. Portions from GWTCanvas, Copyright © Google, Inc.