Package org.jCharts.axisChart
Class AxisChart
- java.lang.Object
-
- org.jCharts.Chart
-
- org.jCharts.axisChart.AxisChart
-
- All Implemented Interfaces:
java.io.Serializable,HTMLChartTestable
- Direct Known Subclasses:
ScatterPlotAxisChart
public class AxisChart extends Chart implements HTMLChartTestable
This Class is used to create all axis chart types. This class knows how to render charts based on the ChartType specified in on the iAxisChartDataSet.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AxisPropertiesaxisPropertiesprivate IAxisDataSeriesiAxisDataSeriesprotected XAxisxAxisprotected YAxisyAxis
-
Constructor Summary
Constructors Constructor Description AxisChart(IAxisDataSeries iAxisDataSeries, ChartProperties chartProperties, AxisProperties axisProperties, LegendProperties legendProperties, int pixelWidth, int pixelHeight)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallowHorizontalPlot()We only allow horizontal plots for the Bar Chart types in this release.AxisChartDataProcessorcreateAxisChartDataProcessor()ScatterPlots create a subclass of AxisChartDataProcessor so we need this method so we can overload it.protected voidderiveAxisValues()AxisPropertiesgetAxisProperties()IAxisDataSeriesgetIAxisDataSeries()XAxisgetXAxis()YAxisgetYAxis()protected voidoverlayCharts()Draws the charts over the axis.protected voidrenderChart()Implement the method to render the Axis based chartprotected voidsetupAxis(AxisChartDataProcessor axisChartDataProcessor, java.awt.font.FontRenderContext fontRenderContext)protected NumericTagGroupsetupDataAxisProperties(Axis axis, DataAxisProperties dataAxisProperties, AxisChartDataProcessor axisChartDataProcessor, java.awt.font.FontRenderContext fontRenderContext)Once we determine which axis is the data axis, the logic to set it up is the same whether it is a horizontal or vertical plot.private voidsizeAndPositionAxis(float xAxisWidth, float yAxisHeight, float chartTitleHeight)Finalizes the size of both Axis and sets the origin positionvoidtoHTML(HTMLGenerator htmlGenerator, java.lang.String imageFileName, ImageMap imageMap)Enables the testing routines to display the contents of this Object.private voidvalidateHorizontalPlot()Currently, we only support the bar chart types being horizontal, and you can not have a horizontally plotted bar chart in a combo chart.-
Methods inherited from class org.jCharts.Chart
getBufferedImage, getChartProperties, getGenerateImageMapFlag, getGraphics2D, getImageHeight, getImageMap, getImageWidth, getLegend, hasLegend, render, renderChartTitle, renderWithImageMap, setGraphics2D, setImageMap
-
-
-
-
Field Detail
-
xAxis
protected XAxis xAxis
-
yAxis
protected YAxis yAxis
-
axisProperties
protected AxisProperties axisProperties
-
iAxisDataSeries
private IAxisDataSeries iAxisDataSeries
-
-
Constructor Detail
-
AxisChart
public AxisChart(IAxisDataSeries iAxisDataSeries, ChartProperties chartProperties, AxisProperties axisProperties, LegendProperties legendProperties, int pixelWidth, int pixelHeight)
Constructor- Parameters:
iAxisDataSeries-chartProperties-axisProperties-legendProperties- if no legend is desired, pass NULLpixelWidth-pixelHeight-
-
-
Method Detail
-
getIAxisDataSeries
public IAxisDataSeries getIAxisDataSeries()
- Returns:
- IAxisDataSeries
-
createAxisChartDataProcessor
public AxisChartDataProcessor createAxisChartDataProcessor()
ScatterPlots create a subclass of AxisChartDataProcessor so we need this method so we can overload it.- Returns:
- AxisChartDataProcessor
-
setupDataAxisProperties
protected NumericTagGroup setupDataAxisProperties(Axis axis, DataAxisProperties dataAxisProperties, AxisChartDataProcessor axisChartDataProcessor, java.awt.font.FontRenderContext fontRenderContext)
Once we determine which axis is the data axis, the logic to set it up is the same whether it is a horizontal or vertical plot.- Parameters:
dataAxisProperties-axisChartDataProcessor-fontRenderContext-- Returns:
- NumericTagGroup need to set this on the right axis
-
setupAxis
protected void setupAxis(AxisChartDataProcessor axisChartDataProcessor, java.awt.font.FontRenderContext fontRenderContext) throws ChartDataException
- Parameters:
axisChartDataProcessor-fontRenderContext-- Throws:
ChartDataException
-
sizeAndPositionAxis
private void sizeAndPositionAxis(float xAxisWidth, float yAxisHeight, float chartTitleHeight)Finalizes the size of both Axis and sets the origin position- Parameters:
xAxisWidth-yAxisHeight-chartTitleHeight-
-
deriveAxisValues
protected void deriveAxisValues()
-
renderChart
protected void renderChart() throws ChartDataException, PropertyExceptionImplement the method to render the Axis based chart- Specified by:
renderChartin classChart- Throws:
ChartDataExceptionPropertyException- there are several validations done to aid in development of the charts.
-
overlayCharts
protected void overlayCharts() throws PropertyException, ChartDataExceptionDraws the charts over the axis. We have to render in a specific order so combo charts get drawn correctly- Throws:
PropertyExceptionChartDataException
-
validateHorizontalPlot
private void validateHorizontalPlot() throws PropertyExceptionCurrently, we only support the bar chart types being horizontal, and you can not have a horizontally plotted bar chart in a combo chart.- Throws:
PropertyException
-
allowHorizontalPlot
private boolean allowHorizontalPlot()
We only allow horizontal plots for the Bar Chart types in this release.- Returns:
- boolean
-
getAxisProperties
public AxisProperties getAxisProperties()
-
getXAxis
public XAxis getXAxis()
-
getYAxis
public YAxis getYAxis()
-
toHTML
public void toHTML(HTMLGenerator htmlGenerator, java.lang.String imageFileName, ImageMap imageMap)
Enables the testing routines to display the contents of this Object. Override Chart implementation as PieCharts use AreaProperties directly rather than a child.- Specified by:
toHTMLin interfaceHTMLChartTestable- Overrides:
toHTMLin classChart- Parameters:
htmlGenerator-imageFileName-imageMap- if this is NULL we are not creating image map data in html
-
-