From: Chris M. <ki...@us...> - 2004-07-01 01:25:37
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5688/src/java/org/krysalis/jcharts/axisChart Modified Files: AxisChart.java Log Message: Dual Y axis changes Index: AxisChart.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart/AxisChart.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AxisChart.java 14 Jun 2004 04:59:09 -0000 1.8 --- AxisChart.java 1 Jul 2004 01:25:23 -0000 1.9 *************** *** 70,78 **** import java.awt.geom.Rectangle2D; - // Dual Y axis changes integrated CMC 25Aug03 - //import java.lang.Math.*; - //import java.lang.Float.*; - - /************************************************************************************* --- 70,73 ---- *************** *** 161,212 **** { s = new AutomaticScaleCalculator(); ! // Dual Y axis changes integrated CMC 25Aug03 ! // s.setMaxValue( axisChartDataProcessor.getMaxValue() ); ! // s.setMinValue( axisChartDataProcessor.getMinValue() ); ! if (this.axisProperties.getYAxisProperties().getMaxRightAxis()>0) ! { ! s.setMaxValue( this.axisProperties.getYAxisProperties().getMaxRightAxis() ); ! } ! else ! { ! s.setMaxValue( axisChartDataProcessor.getMaxValue() ); ! } ! ! if (this.axisProperties.getYAxisProperties().getMinRightAxis()<0) ! { ! s.setMinValue( this.axisProperties.getYAxisProperties().getMinRightAxis() ); ! } ! else ! { ! s.setMinValue( axisChartDataProcessor.getMinValue() ); ! } ! } ! axis.setScaleCalculator( s ); } else { axis.setScaleCalculator( dataAxisProperties.getScaleCalculator() ); ! // Dual Y axis changes integrated CMC 25Aug03 ! // axis.getScaleCalculator().setMaxValue( axisChartDataProcessor.getMaxValue() ); ! // axis.getScaleCalculator().setMinValue( axisChartDataProcessor.getMinValue() ); ! ! if (this.axisProperties.getYAxisProperties().getMaxRightAxis()>0) ! { ! axis.getScaleCalculator().setMaxValue( this.axisProperties.getYAxisProperties().getMaxRightAxis() ); ! } ! else ! { ! axis.getScaleCalculator().setMaxValue( axisChartDataProcessor.getMaxValue() ); ! } ! ! if (this.axisProperties.getYAxisProperties().getMinRightAxis()<0) ! { ! axis.getScaleCalculator().setMinValue( this.axisProperties.getYAxisProperties().getMinRightAxis() ); ! } ! else ! { ! axis.getScaleCalculator().setMinValue( axisChartDataProcessor.getMinValue() ); ! } ! } axis.getScaleCalculator().setRoundingPowerOfTen( dataAxisProperties.getRoundToNearest() ); --- 156,170 ---- { s = new AutomaticScaleCalculator(); ! s.setMaxValue( axisChartDataProcessor.getMaxValue() ); ! s.setMinValue( axisChartDataProcessor.getMinValue() ); ! } ! axis.setScaleCalculator( s ); } else { axis.setScaleCalculator( dataAxisProperties.getScaleCalculator() ); ! axis.getScaleCalculator().setMaxValue( axisChartDataProcessor.getMaxValue() ); ! axis.getScaleCalculator().setMinValue( axisChartDataProcessor.getMinValue() ); ! } axis.getScaleCalculator().setRoundingPowerOfTen( dataAxisProperties.getRoundToNearest() ); *************** *** 305,338 **** NumericTagGroup numericTagGroup= setupDataAxisProperties( this.yAxis, dataAxisProperties, axisChartDataProcessor, fontRenderContext ); this.yAxis.setAxisLabelsGroup( numericTagGroup ); ! // Dual Y axis changes integrated CMC 25Aug03 ! // compute the labels of the right axis if necessary ! if ( this.axisProperties.getYAxisProperties().getSecondScaleRight()!=1 ) ! { ! NumericTagGroup numericTagGroup2 = new NumericTagGroup( dataAxisProperties.getScaleChartFontRight(), ! fontRenderContext, ! dataAxisProperties.useDollarSigns(), ! dataAxisProperties.usePercentSigns(), ! dataAxisProperties.useCommas(), ! dataAxisProperties.getRoundToNearest() ); ! int j=0; ! while (j<this.getYAxis().getNumberOfScaleItems()) ! { ! Float myFloat = new Float (this.yAxis.getAxisLabelsGroup().getTextTag(j).getText()); ! float temp = myFloat.floatValue(); ! // Rounding problems were causing errors ! //Integer myInteger = new Integer ( Math.round(Math.round((float)(temp / this.axisProperties.getYAxisProperties().getSecondScaleRight()))/10)*10 ); ! //String myString = new String (""); ! //myString = myInteger.toString(); ! String myString = new String (String.valueOf(Math.round(temp / this.axisProperties.getYAxisProperties().getSecondScaleRight())) ); ! numericTagGroup2.addLabel(myString); ! j++; ! } ! this.yAxis.setAxisLabelsGroupRight(numericTagGroup2); ! } } //---if yAxisTitle is null, do not show title ! this.yAxis.computeMinimumWidthNeeded( iDataSeries.getYAxisTitle() ); this.xAxis.computeMinimumHeightNeeded( iDataSeries.getXAxisTitle() ); } --- 263,306 ---- NumericTagGroup numericTagGroup= setupDataAxisProperties( this.yAxis, dataAxisProperties, axisChartDataProcessor, fontRenderContext ); this.yAxis.setAxisLabelsGroup( numericTagGroup ); ! // compute the labels of the right axis if necessary ! if ( this.axisProperties.getRightYAxisProperties().getShowAxis() ) ! { ! DataAxisProperties rightDataAxisProperties = ( DataAxisProperties ) this.getAxisProperties().getRightYAxisProperties(); ! NumericTagGroup numericTagGroup2 = new NumericTagGroup( rightDataAxisProperties.getScaleChartFont(), ! fontRenderContext, ! rightDataAxisProperties.useDollarSigns(), ! rightDataAxisProperties.usePercentSigns(), ! rightDataAxisProperties.useCommas(), ! rightDataAxisProperties.getRoundToNearest() ); ! ! if( rightDataAxisProperties.hasUserDefinedScale() ) ! { ! ScaleCalculator s = new UserDefinedScaleCalculator( rightDataAxisProperties.getUserDefinedMinimumValue(), ! rightDataAxisProperties.getUserDefinedIncrement() ); ! s.setRoundingPowerOfTen( rightDataAxisProperties.getRoundToNearest() ); ! s.setNumberOfScaleItems( rightDataAxisProperties.getNumItems() ); ! s.computeScaleValues(); ! numericTagGroup2.createAxisScaleLabels( s ); ! this.yAxis.setRightScaleCalculator( s ); ! ! } ! else ! { ! ScaleCalculator s = new AutomaticScaleCalculator(); ! s.setMaxValue( axisChartDataProcessor.getRightMaxValue() ); ! s.setMinValue( axisChartDataProcessor.getRightMinValue() ); ! s.setRoundingPowerOfTen( rightDataAxisProperties.getRoundToNearest() ); ! s.setNumberOfScaleItems( rightDataAxisProperties.getNumItems() ); ! s.computeScaleValues(); ! numericTagGroup2.createAxisScaleLabels( s ); ! this.yAxis.setRightScaleCalculator( s ); ! } ! this.yAxis.setAxisLabelsGroupRight(numericTagGroup2); ! } } //---if yAxisTitle is null, do not show title ! this.yAxis.computeMinimumWidthNeeded( iDataSeries.getYAxisTitle(), iDataSeries.getRightYAxisTitle() ); this.xAxis.computeMinimumHeightNeeded( iDataSeries.getXAxisTitle() ); } *************** *** 349,360 **** { //---SUBTRACT space for axis titles, labels, ticks... ! // Dual Y axis changes integrated CMC 25Aug03 ! // if there is a right axis to render we subtract twice the minimum width needed ! if (this.axisProperties.getYAxisProperties().getShowRightAxis()) ! xAxisWidth -= 2*this.yAxis.getMinimumWidthNeeded(); ! else ! xAxisWidth -= this.yAxis.getMinimumWidthNeeded(); ! yAxisHeight -= this.xAxis.getMinimumHeightNeeded(); //---SET THE PIXEL LENGTH OF THE AXIS --- 317,324 ---- { //---SUBTRACT space for axis titles, labels, ticks... ! // if there is a right axis to render we subtract the minimum width needed for that ! xAxisWidth = xAxisWidth - (this.yAxis.getMinimumLHSWidthNeeded() + this.yAxis.getMinimumRHSWidthNeeded()); ! yAxisHeight -= this.xAxis.getMinimumHeightNeeded(); //---SET THE PIXEL LENGTH OF THE AXIS *************** *** 376,380 **** || ( this.getLegend().getLegendProperties().getPlacement() == LegendAreaProperties.BOTTOM ) ) { ! this.xAxis.setOrigin( this.yAxis.getMinimumWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( yAxisHeight + super.getChartProperties().getEdgePadding() + chartTitleHeight ); } --- 340,344 ---- || ( this.getLegend().getLegendProperties().getPlacement() == LegendAreaProperties.BOTTOM ) ) { ! this.xAxis.setOrigin( this.yAxis.getMinimumLHSWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( yAxisHeight + super.getChartProperties().getEdgePadding() + chartTitleHeight ); } *************** *** 387,391 **** else if( this.getLegend().getLegendProperties().getPlacement() == LegendAreaProperties.TOP ) { ! this.xAxis.setOrigin( this.yAxis.getMinimumWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( super.getImageHeight() - super.getChartProperties().getEdgePadding() - this.xAxis.getMinimumHeightNeeded() ); } --- 351,355 ---- else if( this.getLegend().getLegendProperties().getPlacement() == LegendAreaProperties.TOP ) { ! this.xAxis.setOrigin( this.yAxis.getMinimumLHSWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( super.getImageHeight() - super.getChartProperties().getEdgePadding() - this.xAxis.getMinimumHeightNeeded() ); } *************** *** 393,397 **** else { ! this.xAxis.setOrigin( this.yAxis.getMinimumWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( yAxisHeight + super.getChartProperties().getEdgePadding() + chartTitleHeight ); } --- 357,361 ---- else { ! this.xAxis.setOrigin( this.yAxis.getMinimumLHSWidthNeeded() + super.getChartProperties().getEdgePadding() ); this.yAxis.setOrigin( yAxisHeight + super.getChartProperties().getEdgePadding() + chartTitleHeight ); } *************** *** 523,527 **** ! this.yAxis.render( g2d, this.getAxisProperties(), iAxisDataSeries.getYAxisTitle() ); this.xAxis.render( g2d, this.getAxisProperties(), iAxisDataSeries.getXAxisTitle() ); --- 487,491 ---- ! this.yAxis.render( g2d, this.getAxisProperties(), iAxisDataSeries.getYAxisTitle(), iAxisDataSeries.getRightYAxisTitle() ); this.xAxis.render( g2d, this.getAxisProperties(), iAxisDataSeries.getXAxisTitle() ); |