krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart AxisChart.java,1.12,1.13
Gann Bierner <[email protected]> Mon, 18 Oct 2004 03:04:17 +0000
| Newsgroups | gmane.comp.krysalis.jcharts.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10190/src/java/org/krysalis/jcharts/axisChart
Modified Files:
AxisChart.java
Log Message:
Allow horizontal/bar combo charts. Allow rendering of combo charts in order of addition. Fixed bug when rending axis chart with no data.
Index: AxisChart.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart/AxisChart.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** AxisChart.java 21 Sep 2004 03:48:07 -0000 1.12
--- AxisChart.java 18 Oct 2004 03:04:14 -0000 1.13
***************
*** 69,72 ****
--- 69,73 ----
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
+ import java.util.Iterator;
***************
*** 85,88 ****
--- 86,90 ----
private IAxisDataSeries iAxisDataSeries;
+ private boolean automaticComboChartLayout;
***************
*** 107,112 ****
--- 109,124 ----
this.axisProperties = axisProperties;
this.iAxisDataSeries = iAxisDataSeries;
+ this.automaticComboChartLayout = true;
}
+ /*************************************************************************************************
+ *
+ * @param automatic Layout of combo chart will be performed
+ * automatically; not in the order of addition
+ *************************************************************************************************/
+ public void setAutomaticComboChartLayout( boolean automatic ) {
+ automaticComboChartLayout = automatic;
+ }
+
/*************************************************************************************************
***************
*** 527,530 ****
--- 539,593 ----
protected void overlayCharts() throws PropertyException, ChartDataException
{
+ if (automaticComboChartLayout)
+ {
+ overlayChartsAutomatically();
+ }
+ else
+ {
+ overlayChartsInOrder();
+ }
+ }
+
+ protected void overlayChartsInOrder() throws PropertyException, ChartDataException {
+ for (Iterator i = this.iAxisDataSeries.getIAxisPlotDataSetIterator(); i.hasNext();)
+ {
+ IAxisPlotDataSet iAxisPlotDataSet = (IAxisPlotDataSet) i.next();
+ ChartType type = iAxisPlotDataSet.getChartType();
+ if (type == ChartType.AREA_STACKED)
+ {
+ StackedAreaChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.AREA)
+ {
+ AreaChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.BAR)
+ {
+ BarChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.BAR_STACKED)
+ {
+ StackedBarChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.BAR_CLUSTERED)
+ {
+ ClusteredBarChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.STOCK )
+ {
+ StockChart.render( this, ( IStockChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.LINE)
+ {
+ LineChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ else if (type == ChartType.POINT)
+ {
+ PointChart.render( this, ( IAxisChartDataSet ) iAxisPlotDataSet );
+ }
+ }
+ }
+
+ protected void overlayChartsAutomatically() throws PropertyException, ChartDataException {
IAxisPlotDataSet iAxisPlotDataSet;
***************
*** 606,610 ****
/**********************************************************************************************
* Currently, 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
--- 669,674 ----
/**********************************************************************************************
* Currently, we only support the bar chart types being horizontal, and you can not have a
! * horizontally plotted bar chart in a combo chart unless the combo
! * chart consists only of bar charts.
*
* @throws PropertyException
***************
*** 614,623 ****
if( axisProperties.isPlotHorizontal() )
{
- //---if there is only one data set, there is no need to do any validations.
- if( this.iAxisDataSeries.size() > 1 )
- {
- throw new PropertyException( "You can not have a combo chart on a horizontal plot." );
- }
-
if( !this.allowHorizontalPlot() )
{
--- 678,681 ----
***************
*** 629,633 ****
/******************************************************************************************
! * We only allow horizontal plots for the Bar Chart types in this release.
*
* @return boolean
--- 687,692 ----
/******************************************************************************************
! * We only allow horizontal plots for the Bar Chart types in this
! * release. But Combo Charts of only Bart Chart types are allowed.
*
* @return boolean
***************
*** 635,654 ****
private boolean allowHorizontalPlot()
{
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR ) != null )
{
! return true;
}
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR_STACKED ) != null )
{
! return true;
}
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR_CLUSTERED ) != null )
{
! return true;
}
! return false;
}
--- 694,715 ----
private boolean allowHorizontalPlot()
{
! int numBarCharts = 0;
!
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR ) != null )
{
! numBarCharts++;
}
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR_STACKED ) != null )
{
! numBarCharts++;
}
! if( this.iAxisDataSeries.getIAxisPlotDataSet( ChartType.BAR_CLUSTERED ) != null )
{
! numBarCharts++;
}
! return numBarCharts == this.iAxisDataSeries.size();
}
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl