|
||||||||
| 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()| 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()
Returns the hovertextTemplate of the given curve. |
java.lang.String |
getLegendLabel()
Returns the HTML defining this curve's legend label. |
int |
getNPoints()
Returns the number of points this curve contains. |
GChart.Point |
getPoint()
Convenience method equivalent to getPoint(getNPoints()-1). |
GChart.Point |
getPoint(int iPoint)
Retrieves a reference to the point at the specified index. |
GChart.Symbol |
getSymbol()
Returns the symbol associated with this curve. |
com.googlecode.gchart.client.GChart.YAxisId |
getYAxis()
Retrieves 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(int iPoint)
Removes the point at the specified index. |
void |
setHovertextTemplate(java.lang.String hovertextTemplate)
Defines the "hovertext" that appears whenever the user points their mouse at a point on the curve. |
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 in the plotting region and on the legend key, or not. |
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)
If Double.NaN is specified for either x or y, the point is created, but it will not be visible in the charting region.
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()
setHovertextTemplatepublic java.lang.String getLegendLabel()
setLegendLabelpublic int getNPoints()
getPoint,
addPoint(double,double),
addPoint(int,double,double),
removePoint,
clearPointspublic GChart.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.Point getPoint(int iPoint)
iPoint - the index of the point to be returned.
addPoint(double,double),
addPoint(int,double,double),
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 setHovertextTemplate(java.lang.String hovertextTemplate)
Two special keywords, XXX and YYY, are supported within the hovertext String. The first occurrence of "XXX" in the string will be replaced with the x-coordinate of the point, formatted as per the specified tick label format of the x-axis. The first occurrence of "YYY" within the string will be replaced with the y-coordinate of the point, formatted either using the y-axis or y2-axis tick label format, depending on the axis on which the curve is displayed.
HTML is not supported within hovertext.
hovertextTemplate - defines the hoverText to display when the mouse
moves over a point on this curve, with XXX and YYY indicating
where the x and y coordinates of the point will appear
within this text.getHovertextTemplate,
DEFAULT_HOVERTEXT_TEMPLATEpublic void setLegendLabel(java.lang.String legendHTML)
legendHTML - the HTML defining this curve's legend label.getLegendLabelpublic void setVisible(boolean isVisible)
isVisible - false to hide curve, true to reveal it.public void setYAxis(com.googlecode.gchart.client.GChart.YAxisId axisId)
axisId - must be either GChart.Y_AXIS or
GChart.Y2_AXISgetYAxis,
Y_AXIS,
Y2_AXIS
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||