krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart LineChart.java,1.3,1.4
Chris McKay <[email protected]> Thu, 01 Jul 2004 01:26:22 +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-serv5935/src/java/org/krysalis/jcharts/axisChart
Modified Files:
LineChart.java
Log Message:
Dual Y axis changes
Index: LineChart.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart/LineChart.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LineChart.java 26 Sep 2003 00:44:02 -0000 1.3
--- LineChart.java 1 Jul 2004 01:26:20 -0000 1.4
***************
*** 66,72 ****
LineChartProperties lineChartProperties=(LineChartProperties) iAxisChartDataSet.getChartTypeProperties();
lineChartProperties.validate( iAxisChartDataSet );
! //DataAxisProperties dataAxisProperties= (DataAxisProperties) axisChart.getAxisProperties().getYAxisProperties();
! IDataSeries iDataSeries= (IDataSeries) axisChart.getIAxisDataSeries();
//---cache the computed values
--- 66,85 ----
LineChartProperties lineChartProperties=(LineChartProperties) iAxisChartDataSet.getChartTypeProperties();
lineChartProperties.validate( iAxisChartDataSet );
+
+ float scaleFactor = 1;
+ float minRHSValue = 0;
+ float minLHSValue = 0;
+ if (iAxisChartDataSet.getPlotAgainstRHS() == true) {
+ float maxLHSValue = (float)axisChart.getYAxis().getScaleCalculator().getMaxValue();
+ float maxRHSValue = (float)axisChart.getYAxis().getRightScaleCalculator().getMaxValue();
+ minLHSValue = (float)axisChart.getYAxis().getScaleCalculator().getMinValue();
+ minRHSValue = (float)axisChart.getYAxis().getRightScaleCalculator().getMinValue();
! // what happens if abs(minRHS) is larger than maxRHSValue????
! scaleFactor = (maxLHSValue - minLHSValue) / (maxRHSValue - minRHSValue);
! }
!
! IDataSeries iDataSeries= (IDataSeries) axisChart.getIAxisDataSeries();
!
//---cache the computed values
***************
*** 85,99 ****
if( iAxisChartDataSet.getValue( i, j ) != Double.NaN )
{
- // Dual Y axis changes integrated CMC 25Aug03
//yAxisCoordinates[ i ][ j ]= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
// iAxisChartDataSet.getValue( i, j ),
// axisChart.getYAxis().getScaleCalculator().getMinValue() );
! // The coordinates of the line charts are drawn with the default scale and
! // multiplicate with the second scale for the right axis (by default equal 1)
! // if the second scale at the right is unchanged then there will be no impact
! yAxisCoordinates[ i ][ j ]= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
! iAxisChartDataSet.getValue( i, j )*axisChart.axisProperties.getYAxisProperties().getSecondScaleRight(),
! axisChart.getYAxis().getScaleCalculator().getMinValue() );
//---if we are generating an ImageMap, store the image coordinates
--- 98,112 ----
if( iAxisChartDataSet.getValue( i, j ) != Double.NaN )
{
//yAxisCoordinates[ i ][ j ]= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
// iAxisChartDataSet.getValue( i, j ),
// axisChart.getYAxis().getScaleCalculator().getMinValue() );
! // The coordinates of the line charts are drawn against the LHS axis
! // so we recalculate with RHS scale factors (if present) to match LHS
! // need to adjust axis start temporarily to 0 point to make sure scale
! // factor is accurate
! yAxisCoordinates[ i ][ j ]= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
! ((iAxisChartDataSet.getValue( i, j )-minRHSValue)*scaleFactor)+minLHSValue,
! axisChart.getYAxis().getScaleCalculator().getMinValue() );
//---if we are generating an ImageMap, store the image coordinates
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com