Re: Dual Y Axis proposed changes

"Nathaniel G. Auvil" <[email protected]> Tue, 22 Jun 2004 06:22:28 -0700 (PDT)
Newsgroups gmane.comp.krysalis.jcharts.devel
Message-ID <[email protected]>
--- Chris McKay <[email protected]> wrote:
> Hi all,
> 
> Over the weekend I reached the stage where I was about to commit my Dual
> Y axis changes into the tree (Would have been sooner apart from a dose
> of the flu but it's a wonder what pseudoephedrine and paracetamol will
> do for you). 
> 
> However I'm coming to the conclusion that further work is required. Let
> me outline what is there now, what is damn ugly, and what is required
> further and then I'll accept some guidance from the group. (Being a new
> boy and all)
> 
> Currently in the alpha code is a pretty rudimentary dual axis
> implementation where only a line chart can be plotted against the Y
> axis.
> You manually set the scaling factor between the LHS and RHS, manually
> set a min and max RHS value and the RHS is drawn utilising the LHS axis
> properties, same font, tick increment etc. However it did the job for us
> personally in a tight development squeeze a year or so ago.
> 
> Later I came back to it and added in a new right hand AxisTypeProperties
> that is stored in AxisProperties, this enabled us to allow the RHS to
> have it's own scale calculator, title and label fonts, tick marks etc.
> 
> Currently the major methods used to control the axis behaviour can be
> seen from the following sample code:
> 
>         AxisProperties axisProperties = new AxisProperties(false);
>         axisProperties.getYAxisProperties().setShowRightAxis(true);
>         axisProperties.getYAxisProperties().setRightYAxisTitle("Success
> Percentage");
>         AxisTypeProperties rightYAxisProperties =
> axisProperties.getRightYAxisProperties();
> 
> Then you have all the methods of AxisTypeProperties and
> DataAxisProperties to mess with the RHS axis.
>  
> 		((DataAxisProperties)
> axisProperties.getRightYAxisProperties()).setNumItems(5);
>  		((DataAxisProperties)
> axisProperties.getRightYAxisProperties()).setUserDefinedScale(0, 25);
> 	
> axisProperties.getRightYAxisProperties().setTitleChartFont(axisTitleFont
> );
> 	
> axisProperties.getRightYAxisProperties().setScaleChartFont(axisScaleFont
> );
> 	
> axisProperties.getRightYAxisProperties().setAxisTitleChartFont(axisTitle
> Font);
> 	
> axisProperties.getRightYAxisProperties().setPaddingBetweenAxisTitleAndLa
> bels(3);
> 	
> axisProperties.getRightYAxisProperties().setTitleChartFont(axisTitleFont
> );
> 
> Then there is the only tricky bit:
> 
> If you don't have a UserDefinedScale you have to define a scale ratio
> (this is a hang over from the previous implementation...) The ratio is
> the maximum data value from the LHS data divided by the max value from
> the RHS.
> If you do have a UserDefinedScale then the ratio is the max LHS tick
> divided by the max RHS tick.
> 
> // using the following line scales the RHS data points by this factor,
> max LHS data point / max RHS data point
> //
> axisProperties.getYAxisProperties().setSecondScaleRight((float)
> 178/100);
> // if you're using UserDefinedScales then the ratio must be the max LHS
> tick point/ max RHS tick point
>         axisProperties.getYAxisProperties().setSecondScaleRight((float)
> 200/100);
> 
> So there it is. What I want to know is should I commit this now? It
> works, is in production at our site etc. and this functionality is in
> demand from community members. However there is some ugliness lurking.
> Given we are in an Alpha cycle is it appropriate to commit something
> knowing it will/should be changed soon?

Sure.  An 'Alpha' release means things can and most likely will change.



> 
> Ugliness:
> 
> setSecondScaleRight:
> There is no need to have a method that sets the Scale factor. This
> information should be able to be gleaned from the jCharts
> ScaleCalculators (mins and maxes).
> 

Yeah, you should not have to directly specify that for the axis as that is the intent of the
ScaleCalculator Implementations.


> setRightYAxisTitle:
> The RHS Y Axis title is stored in the left AxisTypeProperties, as is the
> SecondScaleRight and the ShowRightAxis flag - ugh. It should go in the
> AxisDataSeries class perhaps? Maybe the AxisChartDataSet should have a
> "plot against the RHS" method so that when it comes to scaling it is
> stored with the data to scale.

Yeah, I think that would make sense.  So you would just add a boolean to the AxisChartDataSet to
tell which axis to plot on?


> Deprecation of existing dev code:
> With the introduction of these changes a few methods that were
> originally in the development tree are now no longer the best way of
> doing things (setMinRightAxis for instance). Should I deprecate those
> methods or remove them completely?

I would say kill them as they have never been in an official release.  What do you think?






		
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail


-------------------------------------------------------
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