|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart2djava.ChartObj
com.quinncurtis.chart2djava.GraphObj
com.quinncurtis.chart2djava.ChartPlot
com.quinncurtis.chart2djava.PieChart
public class PieChart
The PieChart class extends the Plot class and displays pie charts. The x-values of the simple dataset used for data storage specify the pie wedge values, the y-values of the dataset specify the "explode" percentage for each pie wedge.
Field Summary |
---|
Constructor Summary | |
---|---|
PieChart()
The default PieChart constructor. |
|
PieChart(PhysicalCoordinates transform,
SimpleDataset dataset,
java.lang.String[] spiestring1s,
ChartAttribute[] attribs,
int labelinout1,
int pielabelformat)
This constructor creates a new PieChart object and scales it to match the specified minimum and maximum values. |
Method Summary | |
---|---|
boolean |
calcNearestPoint(ChartPoint2D testpoint,
int nmode,
NearestPointData nearestpoint)
This method compares a test point against the pie wedges in a simple pie chart and calculates which wedge is nearest the test point. |
boolean |
checkIntersection(ChartPoint2D testpoint,
NearestPointData np)
Returns true if the test point is intersects one of the pie slices. |
java.lang.Object |
clone()
Returns an object that is a clone of this PieChart object. |
void |
copy(PieChart source)
Copies the source pie chart. |
void |
draw(java.awt.Graphics2D g2)
The draw method for this class. |
void |
drawPieChart(java.awt.Graphics2D g2)
The draw method for this class. |
int |
errorCheck(int nerror)
Checks the PieChart object for common errors. |
ChartDataset |
getDataset()
Returns a reference to the current SimpleDataset. |
int |
getLabelInOut(int index)
Returns the pie slice labeling mode associated with a specific pie slice. |
int |
getPieSliceLabelFormat()
Returns the pie slice labeling format associated with a specific pie slice. |
void |
getPieSlicePoints(int pieslice,
ChartPoint2D arcstart,
ChartPoint2D arcstop,
ChartPoint2D arcorigin)
Returns the starting, ending and arc origin for a specific pie slice in the pie chart. |
java.lang.String |
getPieSliceStrings(int index)
Returns the text string associated with a specific pie slice. |
double |
getStartPieSliceAngle()
Returns the start angle in degrees for the first pie slice in the pie chart. |
double |
getSumPieSlices()
Returns the sum of all pie slice values. |
void |
setDataset(SimpleDataset dataset)
Replaces the current SimpleDataset object with a new one. |
void |
setLabelInOut(int index,
int labelinout1)
Sets the pie slice labeling mode associated with a specific pie slice. |
void |
setPieSliceLabelFormat(int format)
Sets the pie slice labeling format associated with a specific pie slice. |
void |
setPieSliceStrings(int index,
java.lang.String piestring1)
Sets the text string associated with a specific pie slice. |
void |
setStartPieSliceAngle(double angle)
Sets the start angle in degrees for the first pie slice in the pie chart. |
Methods inherited from class com.quinncurtis.chart2djava.ChartObj |
---|
copy, getChartObjIDCntr, getChartObjType, getThisChartObjID, TypeSafeVectorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PieChart()
public PieChart(PhysicalCoordinates transform, SimpleDataset dataset, java.lang.String[] spiestring1s, ChartAttribute[] attribs, int labelinout1, int pielabelformat)
transform
- The pie chart is placed in the coordinate system defined by transform.dataset
- The pie chart represents the values in this data set.spiestring1s
- An array of strings, size dataset.getNumberDatapoints(), used as labels
for the pie slices.attribs
- An array of ChartAttribute objects, size dataset.getNumberDatapoints() that
specify the attributes (out1line color and fill color) for each wedge of a pie chart.labelinout1
- An array of integer, size theDataset.getNumberDatapoints(), specifying
if a specific pie slice text label is drawn inside the pie slice, or outside of the pie slice. Use one of
the constants: PIELABEL_OUTSLICE or PIELABEL_INSLICE.pielabelformat
- All pie slice labels share the same format. Use one of the pie slice
label format constants: PIELABEL_NONE Do not display and pie slice text PIELABEL_STRING Display only
the pie text strings, no numeric values PIELABEL_NUMVALUE Display the pie numeric value only, no pie text
strings. PIELABEL_STRINGNUMVAL Display the pie text string and numeric value.Method Detail |
---|
public boolean calcNearestPoint(ChartPoint2D testpoint, int nmode, NearestPointData nearestpoint)
calcNearestPoint
in class ChartPlot
testpoint
- The test point for the nearness calculation.nmode
- Ignored.nearestpoint
- Returns the parameters of the nearest pie wedge.
public boolean checkIntersection(ChartPoint2D testpoint, NearestPointData np)
checkIntersection
in class ChartPlot
testpoint
- The test pointnp
- Nearest point information for data based objects.
public java.lang.Object clone()
clone
in class GraphObj
public void copy(PieChart source)
source
- The source pie chart object.public void draw(java.awt.Graphics2D g2)
draw
in class GraphObj
g2
- The graphics context.public void drawPieChart(java.awt.Graphics2D g2)
g2
- The graphics context.public int errorCheck(int nerror)
errorCheck
in class ChartPlot
nerror
- Current error state.
public ChartDataset getDataset()
getDataset
in class ChartPlot
public int getLabelInOut(int index)
index
- The index of the pie slice.
public int getPieSliceLabelFormat()
public void getPieSlicePoints(int pieslice, ChartPoint2D arcstart, ChartPoint2D arcstop, ChartPoint2D arcorigin)
pieslice
- The index of the pie slice.arcstart
- Returns the starting point of the pie slice in window device coordinatesarcstop
- Returns the ending point of the pie slice in window device coordinates.arcorigin
- Returns the arc origin of the pie slice in window device coordinates.public java.lang.String getPieSliceStrings(int index)
index
- The index of the pie slice.
public double getStartPieSliceAngle()
public double getSumPieSlices()
public void setDataset(SimpleDataset dataset)
dataset
- Specifies the new SimpleDataset object.public void setLabelInOut(int index, int labelinout1)
index
- The index of the pie slice.labelinout1
- Sets the pie slice labeling mode associated with a specific pie slice.
Use one of the constants: PIELABEL_OUTSLICE or PIELABEL_INSLICE.public void setPieSliceLabelFormat(int format)
format
- Sets the pie slice labeling format associated with a specific pie slice.
Use one of the pie slice label format constants: PIELABEL_NONE, PIELABEL_STRING, PIELABEL_NUMVALUE or
PIELABEL_STRINGNUMVAL.public void setPieSliceStrings(int index, java.lang.String piestring1)
index
- The index of the pie slice.piestring1
- Sets the text string associated with a specific pie slice.public void setStartPieSliceAngle(double angle)
angle
- The start angle of the first pie slice in the pie chart in degrees.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |