|
For downloads, demos, and more
visit the Client-side GChart Home Page |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.googlecode.gchart.client.GChart.Curve
public 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.
To create a new curve, use the GChart.addCurve method.
addCurve()| Nested Class Summary | |
|---|---|
class |
GChart.Curve.Point
Represents a single point on one of the chart's curves. |
| Method Summary | |
|---|---|
void |
addPoint(double x,
double y)
Adds a new point to the curve, at the end of the current list of points, with the specified coordinates in model-units (arbitrary, application-specific, units). |
void |
addPoint(int iPoint,
double x,
double y)
Adds a new point at the specified position in the point sequence, increasing the indexes of existing points at or after the specified position by 1. |
void |
clearPoints()
Removes every point this curve contains. |
java.lang.String |
getHovertextTemplate()
Deprecated. This method is equivalent to: getSymbol().getHovertextTemplate() It is retained only for GChart 1.1 compatibility purposes. |
java.lang.String |
getLegendLabel()
Returns the HTML defining this curve's legend label. |
int |
getNPoints()
Returns the number of points this curve contains. |
GChart |
getParent()
Returns a reference to the GChart that contains this curve. |
GChart.Curve.Point |
getPoint()
Convenience method equivalent to getPoint(getNPoints()-1). |
GChart.Curve.Point |
getPoint(int iPoint)
Returns a reference to the point at the specified index. |
int |
getPointIndex(GChart.Curve.Point point)
Returns the positional index (within this curve's list of points) of the specified point. |
GChart.Symbol |
getSymbol()
Returns the symbol associated with this curve. |
com.googlecode.gchart.client.GChart.YAxisId |
getYAxis()
Returns the y-axis (Y_AXIS or Y2_AXIS) this curve is plotted on. |
boolean |
isVisible()
Is this curve visible on the chart and legend key, or is it hidden from view. |
boolean |
onY2()
Convenience method equivalent to getYAxis()==Y2_AXIS. |
void |
removePoint(GChart.Curve.Point p)
Removes the given point from this curve. |
void |
removePoint(int iPoint)
Removes the point at the specified index. |
void |
setHovertextTemplate(java.lang.String hovertextTemplate)
Deprecated. This method is equivalent to: getSymbol().setHovertextTemplate(hovertextTemplate) It is retained only for GChart 1.1 compatibility purposes. |
void |
setLegendLabel(java.lang.String legendHTML)
Sets the HTML that defines the label shown to the right of the icon representing the curve's symbol in the chart's legend. |
void |
setVisible(boolean isVisible)
Defines if this curve is visible both in the plotting region and on the legend key. |
void |
setYAxis(com.googlecode.gchart.client.GChart.YAxisId axisId)
Sets the y-axis that this curve is plotted on. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void addPoint(double x,
double y)
GChart gives a special interpretation to the following values:
Tip: Connecting lines to/from such Double.NaN points are elided, so you can use such a point to create a break in an otherwise connected curve.
x - the x-coordinate of the new pointy - the y-coordinate of the new pointgetPoint,
addPoint(int,double,double),
removePoint,
clearPoints,
getNPoints
public void addPoint(int iPoint,
double x,
double y)
iPoint - the position that the new point will occupyx - the x-coordinate of the new point (model units)y - the y-coordinate of the new point (model units)getPoint,
addPoint(double,double),
removePoint,
clearPoints,
getNPointspublic void clearPoints()
Point,
getPoint,
addPoint(double,double),
addPoint(int,double,double),
removePoint,
getNPointspublic java.lang.String getHovertextTemplate()
getSymbol().getHovertextTemplate()
It is retained only for GChart 1.1 compatibility purposes.
Symbol.getHovertextTemplatepublic java.lang.String getLegendLabel()
setLegendLabelpublic int getNPoints()
getPoint,
addPoint(double,double),
addPoint(int,double,double),
removePoint,
clearPointspublic GChart getParent()
public GChart.Curve.Point getPoint()
This method makes code more readable for the common case when you first add a point to the end of a curve, and then modify that point's attributes, as illustrated below:
class MyChart extends GChart {
public MyChart() {
addCurve();
for (int i=0; i < 10; i++) {
getCurve().addPoint(i,i);
getCurve().getPoint().setAnnotationText("Point " + i);
}
update();
}
}
getPoint(int),
getNPoints()public GChart.Curve.Point getPoint(int iPoint)
iPoint - the index of the point to be returned.
addPoint(double,double),
addPoint(int,double,double),
removePoint,
clearPoints,
getNPointspublic int getPointIndex(GChart.Curve.Point point)
Returns GChart.NAI if the specified point is not found on this curve's point list.
point - point whose list position is to be retrieved
getPoint(),
getPoint(int),
addPoint,
removePoint,
clearPoints,
getNPointspublic GChart.Symbol getSymbol()
Though you cannot set the symbol itself (there is no setSymbol method) you can have essentially the same effect by setting the SymbolType (to get qualitatively different kinds of symbols, e.g. bar-chart bars vs. boxes) and by changing symbol attributes such as background color, height, and width.
Symbol.setSymbolType,
Symbol.setBackgroundColor,
Symbol.setBorderWidth,
Symbol.setBorderStyle,
Symbol.setWidth,
Symbol.setHeight,
Symbol.setModelWidth,
Symbol.setModelHeightpublic com.googlecode.gchart.client.GChart.YAxisId getYAxis()
setYAxis,
Y_AXIS,
Y2_AXISpublic boolean isVisible()
setVisiblepublic boolean onY2()
getYAxispublic void removePoint(int iPoint)
iPoint - index of point to be removed.getPoint,
addPoint(double,double),
addPoint(int,double,double),
clearPoints,
getNPointspublic void removePoint(GChart.Curve.Point p)
If the given point is not on this curve, or is null, an exception is thrown.
p - the point to be removed.public void setHovertextTemplate(java.lang.String hovertextTemplate)
getSymbol().setHovertextTemplate(hovertextTemplate)
It is retained only for GChart 1.1 compatibility purposes.
Symbol.setHovertextTemplatepublic void setLegendLabel(java.lang.String legendHTML)
Setting the legend label to null removes the entire row (the label and the icon) associated with this curve from the chart key.
Note that, since null is the default, unless you set at least one legend label, no chart key will appear at all.
legendHTML - the HTML defining this curve's legend label.
or null to remove the curve from
the legend entirely.getLegendLabel,
setLegendThicknesspublic void setVisible(boolean isVisible)
Notes:
isVisible - false to hide curve, true to reveal it.isVisible,
setLegendLabelpublic void setYAxis(com.googlecode.gchart.client.GChart.YAxisId axisId)
axisId - must be either GChart.Y_AXIS or
GChart.Y2_AXISgetYAxis,
Y_AXIS,
Y2_AXIS
|
For downloads, demos, and more
visit the Client-side GChart Home Page |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||