|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.image.WebImage
org.hyperic.image.chart.Chart
public abstract class Chart
Chart is an abstract base class for the Covalent charting library. Chart uses Java AWT drawing to draw charts dynamically into a Java Image which can be then be used to display the chart in an application. The most common use of the charting library is to draw the chart image and then convert the image to a GIF to send to a Web Browser. Chart is responsible for all of the background drawing of the Chart the Chart frame, text labels, data point crossing lines, etc. Sublcasses of Chart draw on top of the image produce by the Chart class to draw the actual lines, columns, etc. that represent the data points of the chart. To create a chart you instantiate a subclass of Chart (e.g., LineChart, ColumnChart, etc.), call getData() to retrieve a collection, poplulate the collection and then call Chart.getImage() to get a java.awt.Image object that represents the drawn chart. The chart class is very configurable through get/set methods including configuring things like the text for labels, fonts, line colors, etc. After changing one or more options you call Chart.getImage() again to get a new image based on your options. The chart should have at least three datums in its Datum collection to display without errors.
Image
Field Summary | |
---|---|
protected static java.lang.String |
ARG_MUST_BE_ZERO_OR_GREATER
|
java.awt.Color |
averageLineColor
Color of the average data point horizontal line. |
protected static java.lang.String |
AVG
|
double |
baseline
Baseline in the chart. |
protected static java.lang.String |
BASELINE
|
java.awt.Color |
baselineColor
Color of the baseline horizontal line. |
double |
ceiling
Top number for the left axis of the chart. |
java.awt.Color |
chartColor
Retrieves the chart's interior background color. |
protected static java.awt.Font |
DEFAULT_LABEL_FONT
|
protected static java.awt.Font |
DEFAULT_LEGEND_FONT
|
protected static java.awt.Font |
DEFAULT_LEGEND_PLAIN
|
protected static java.lang.String |
DEFAULT_UNIT_LEGEND
|
protected static java.lang.String |
DEFAULT_VALUE_LEGEND
|
static java.lang.String |
EMPTY_STRING
|
double |
floor
Bottom number for the left axis of the chart. |
double |
highRange
High range in the chart. |
java.awt.Color |
highRangeColor
High range color in the chart. |
java.awt.Font |
legendFont
Font that is used to draw the legend for the chart's X and Y axis. |
java.awt.Color |
legendTextColor
Color that is used to draw the legend text for the chart's X and Y axis. |
int |
lineWidth
Width of lines in the chart. |
protected static java.lang.String |
LOW
|
java.awt.Color |
lowLineColor
Retrieves the color of the low data point horizontal line. |
double |
lowRange
Low range in the chart. |
java.awt.Color |
lowRangeColor
High range color in the chart. |
protected double[] |
m_adRangeMarks
|
protected boolean |
m_bNoData
|
protected double |
m_dAvgValue
|
protected double |
m_dLowValue
|
protected double |
m_dPeakValue
|
protected double |
m_floor
|
protected int |
m_fmtScale
|
protected int |
m_fmtType
|
protected java.awt.FontMetrics |
m_metricsLabel
|
protected java.awt.FontMetrics |
m_metricsLegend
|
protected static java.lang.String |
PEAK
|
java.awt.Color |
peakLineColor
Color of the peak data point horizontal line. |
int |
rightLabelWidth
Sets a fixed size for the label width on the right vertical axis. |
boolean |
showAverage
Calculates and shows an Average line in the chart. |
boolean |
showBaseline
Shows a Baseline in the chart. |
boolean |
showBottomLabels
Shows labels on the X axis bottom side. |
boolean |
showBottomLegend
Shows a top legend. |
boolean |
showEvents
Shows events plotted on a chart. |
boolean |
showFullLabels
Show full labels on the bottom x axis. |
boolean |
showHighRange
Shows a shaded high range in the chart. |
boolean |
showLeftLabels
Shows labels on the Y axis left side. |
boolean |
showLeftLegend
Shows a Left legend. |
boolean |
showLow
Calculates and shows a Low line in the chart. |
boolean |
showLowRange
Shows a shaded low range in the chart. |
boolean |
showPeak
Calculates and shows a peak line in the chart. |
boolean |
showRightLabels
Shows labels on the Y axis right side. |
boolean |
showRightLegend
Shows a Right legend. |
boolean |
showTopLabels
Shows labels on the X axis top side. |
boolean |
showTopLegend
Shows a top legend. |
boolean |
showUnitLines
Shows vertical crossing lines at each data point on the y axis. |
boolean |
showValueLines
Shows horizontal crossing lines at each data point on the x axis. |
boolean |
showValues
Shows values. |
int |
textWhitespace
The width of the white space between tick marks and the label text. |
int |
tickMarkHeight
The height, in pixels, of the tick mark lines that extend outside the chart's border. |
int |
valueIndent
Number of pixels to indent the value axis. |
int |
valueLines
Number of value lines that the chart draws at data points along the chart's value axis. |
protected static int |
VARIABLE_HEIGHT
|
protected static int |
VARIABLE_WIDTH
|
int |
x2VertLabels
|
int |
x2VertMarks
|
int |
xLabelsSkip
|
java.awt.Color |
xLineColor
Color of the border lines, horizontal lines and tick marks |
int |
xOffset
Amount to offset the chart on the X axis in pixels. |
int |
xRLabel
|
int |
xVertLegend
|
int |
xVertMarks
|
int |
yBottomLegend
|
int |
yHorzLabels
|
int |
yOffset
Amount to offset the chart on the Y axis in pixels. |
int |
yTopLegend
|
Fields inherited from class org.hyperic.image.WebImage |
---|
antiAliased, ARG_CANNOT_BE_NULL, backgroundColor, bottomBorder, DEFAULT_BACKGROUND_COLOR, DEFAULT_BOLD_TYPEFACE, DEFAULT_BORDER_COLOR, DEFAULT_BORDER_SIZE, DEFAULT_FONT, DEFAULT_FONT_METRICS, DEFAULT_HEIGHT, DEFAULT_PLAIN_TYPEFACE, DEFAULT_SHADOW_WIDTH, DEFAULT_WIDTH, font, frameImage, height, indexColors, leftBorder, m_graphics, rightBorder, shadowWidth, SMALL_FONT, textColor, topBorder, width |
Constructor Summary | |
---|---|
protected |
Chart()
Constructs a Chart class with a default width of 755 pixels and a default height of 300 pixels. |
protected |
Chart(int charts)
Constructs a Chart class with a default width of 755 pixels and a default height of 300 pixels. |
protected |
Chart(int width,
int height)
Constructs a Chart class with a specified width and height. |
protected |
Chart(int width,
int height,
int charts)
Constructs a Chart class with a specified width and height. |
Method Summary | |
---|---|
protected java.awt.Rectangle |
adjustRectangle(java.awt.Graphics2D g,
java.awt.Rectangle rect)
Give the child class an opportunity to change the size of the interior rectangle. |
protected void |
calc(java.awt.Graphics2D g)
|
protected void |
calcRanges()
Calculates the high, low and average values of the chart data set. |
protected int |
calcVariableHeight()
|
protected int |
calcVariableWidth()
|
protected boolean |
checkHighLow()
|
protected java.awt.Rectangle |
draw(ChartGraphics g)
|
protected void |
draw(java.awt.Graphics2D g)
|
double |
getAverageValue()
Retrieves the average value of the chart's data set. |
protected java.lang.Class |
getDataCollectionClass()
|
protected java.awt.Point |
getDataPoint(int valuePixels,
int unitPixels,
int datapoint,
DataPointCollection coll)
Retrieves the value and unit coordinate for a data point in the chart. |
DataPointCollection |
getDataPoints()
Retrieves the data set of the chart. |
DataPointCollection |
getDataPoints(int index)
|
int |
getDataSetCount()
|
java.util.Iterator |
getDataSetIterator()
|
protected java.awt.Point |
getDisplayPoint(int valuePixels,
int unitPixels,
int unitPoints,
double value,
int unitIndex)
Retrieves the value and unit coordinate for a value on the x and y axis in the chart. |
EventPointCollection |
getEventPoints()
|
EventPointCollection |
getEventPoints(int index)
|
java.util.Iterator |
getEventSetIterator()
|
protected int |
getExteriorHeight()
|
java.awt.Rectangle |
getExteriorRectangle()
|
protected abstract java.awt.Rectangle |
getInteriorRectangle(ChartGraphics g)
|
double |
getLowValue()
Retrieves the low value of the chart's data set. |
java.lang.String |
getNoDataString()
|
double |
getPeakValue()
Retrieves the peak value of the chart's data set. |
java.lang.String |
getTitle()
Get the chart's title. |
protected java.lang.String |
getUnitLabel(IDisplayDataPoint data)
|
java.lang.String |
getUnitLegend()
Retrieves the legend for the chart's Unit axis. |
java.lang.String |
getValueLegend()
Retrieves the legend for the chart's Value axis. |
protected int |
getXLabelHeight()
|
protected abstract java.lang.String[] |
getXLabels()
|
protected int |
getXLabelWidth()
Calculates the label width of the horizontal axis of the chart. |
protected int |
getXLegendHeight()
|
protected abstract int |
getYLabelWidth(java.awt.Graphics2D g)
Calculates the label width of the vertical axis of the chart. |
protected boolean |
hasData()
|
protected java.util.Collection |
initData(java.util.Collection coll)
|
protected void |
initFonts()
|
protected void |
postInit(java.awt.Graphics2D g)
|
protected void |
preInit()
|
protected double |
scale(int height)
Calculates the scale of the graph data points. |
void |
setAbsTimeLabels(boolean useAbsTimeLabels,
long interval)
|
void |
setFormat(int type,
int scale)
|
void |
setNoDataString(java.lang.String s)
|
void |
setNumberDataSets(int number)
|
void |
setTitle(java.lang.String title)
Set the chart's title. |
void |
setUnitLegend(java.lang.String legend)
Sets the legend for the chart's Unit axis. |
void |
setValueLegend(java.lang.String legend)
Sets the legend for the chart's Value axis. |
Methods inherited from class org.hyperic.image.WebImage |
---|
getFontMetrics, getImage, getTextCenter, getTextCenter, getTextCenter, isRunnable, setBorder, writeJpegImage, writeJpegImage, writePngImage, writePngImage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EMPTY_STRING
protected static final java.lang.String ARG_MUST_BE_ZERO_OR_GREATER
protected static final java.lang.String AVG
protected static final java.lang.String BASELINE
protected static final java.lang.String LOW
protected static final java.lang.String PEAK
protected static final java.lang.String DEFAULT_UNIT_LEGEND
protected static final java.lang.String DEFAULT_VALUE_LEGEND
protected static final int VARIABLE_HEIGHT
protected static final int VARIABLE_WIDTH
protected static final java.awt.Font DEFAULT_LABEL_FONT
protected static final java.awt.Font DEFAULT_LEGEND_PLAIN
protected static final java.awt.Font DEFAULT_LEGEND_FONT
protected java.awt.FontMetrics m_metricsLabel
protected java.awt.FontMetrics m_metricsLegend
protected int m_fmtType
protected int m_fmtScale
protected double m_dAvgValue
protected double m_dLowValue
protected double m_dPeakValue
protected double[] m_adRangeMarks
protected double m_floor
protected boolean m_bNoData
public int yTopLegend
public int yBottomLegend
public int xVertLegend
public int yHorzLabels
public int x2VertLabels
public int xRLabel
public int xVertMarks
public int x2VertMarks
public int xLabelsSkip
public java.awt.Color averageLineColor
public java.awt.Color baselineColor
public double ceiling
public java.awt.Color chartColor
public double floor
public double baseline
public double highRange
public java.awt.Color highRangeColor
public java.awt.Font legendFont
public java.awt.Color legendTextColor
public int lineWidth
public java.awt.Color lowLineColor
public double lowRange
public java.awt.Color lowRangeColor
public java.awt.Color peakLineColor
public int rightLabelWidth
public boolean showAverage
public boolean showBaseline
public boolean showBottomLabels
public boolean showBottomLegend
public boolean showEvents
public boolean showFullLabels
public boolean showHighRange
public boolean showLeftLabels
public boolean showLeftLegend
public boolean showLow
public boolean showLowRange
public boolean showPeak
public boolean showRightLabels
public boolean showRightLegend
public boolean showTopLabels
public boolean showTopLegend
public boolean showUnitLines
public boolean showValueLines
public boolean showValues
public int textWhitespace
public int tickMarkHeight
public int valueIndent
public int valueLines
public java.awt.Color xLineColor
public int xOffset
public int yOffset
Constructor Detail |
---|
protected Chart()
protected Chart(int charts)
charts
- The number of charts to display.protected Chart(int width, int height)
width
- The width of the chart in pixels.height
- The height of the chart in pixels.protected Chart(int width, int height, int charts)
width
- The width of the chart in pixels.height
- The height of the chart in pixels.charts
- The number of charts to display.Method Detail |
---|
protected void draw(java.awt.Graphics2D g)
draw
in class WebImage
protected java.awt.Rectangle draw(ChartGraphics g)
protected void calc(java.awt.Graphics2D g)
protected java.awt.Rectangle adjustRectangle(java.awt.Graphics2D g, java.awt.Rectangle rect)
protected void calcRanges()
protected int calcVariableHeight()
protected int calcVariableWidth()
protected int getXLabelWidth()
graph
- The java.awt.Graphics context to draw into.
protected int getXLegendHeight()
protected abstract int getYLabelWidth(java.awt.Graphics2D g)
graph
- The ChartGraphics context to draw into.
protected abstract java.lang.String[] getXLabels()
protected int getXLabelHeight()
protected abstract java.awt.Rectangle getInteriorRectangle(ChartGraphics g)
protected int getExteriorHeight()
protected java.util.Collection initData(java.util.Collection coll)
protected void initFonts()
protected void preInit()
preInit
in class WebImage
protected void postInit(java.awt.Graphics2D g)
postInit
in class WebImage
protected java.awt.Point getDataPoint(int valuePixels, int unitPixels, int datapoint, DataPointCollection coll)
valuePixels
- An int that specifies the size of the value axis in pixels.unitPixels
- An int that specifies the size of the unit axis in pixels.datapoint
- An int that specifies the zero-based index of the datum to
calculate coordinates for.collection
- The DataPointCollection the datapoint is located in.
Rectangle
protected java.awt.Point getDisplayPoint(int valuePixels, int unitPixels, int unitPoints, double value, int unitIndex)
valuePixels
- An int that specifies the size of the value axis in pixels.unitPixels
- An int that specifies the size of the unit axis in pixels.unitPoints
- Number of ticks on the unit axis.value
- A double that specifies the value to get coordinates for.unitIndex
- Ticks on the unit axis to get coordinates for.
protected java.lang.String getUnitLabel(IDisplayDataPoint data)
protected boolean hasData()
protected double scale(int height)
height
- The height of the rectangle to calculate the vertical scale for.
protected java.lang.Class getDataCollectionClass()
protected boolean checkHighLow()
public double getAverageValue()
public java.lang.String getNoDataString()
public void setNoDataString(java.lang.String s)
public DataPointCollection getDataPoints()
net.hyperic.chart.DataPointCollection
public EventPointCollection getEventPoints()
public DataPointCollection getDataPoints(int index)
public EventPointCollection getEventPoints(int index)
public int getDataSetCount()
public java.util.Iterator getDataSetIterator()
public java.util.Iterator getEventSetIterator()
public void setNumberDataSets(int number)
public void setFormat(int type, int scale)
public java.awt.Rectangle getExteriorRectangle()
public double getLowValue()
public double getPeakValue()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- A string containing the chart's title.public java.lang.String getUnitLegend()
public void setUnitLegend(java.lang.String legend)
label
- A java.lang.String object that contains the chart's Unit axis
legend.
java.lang.IllegalArgumentException
- If the legend parameter is null.public java.lang.String getValueLegend()
public void setValueLegend(java.lang.String legend)
label
- A java.lang.String object that contains the chart's Value axis
legend.
java.lang.IllegalArgumentException
- If the legend parameter is null.public void setAbsTimeLabels(boolean useAbsTimeLabels, long interval)
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |