I figured I'd post this problem I encountered and the fix to get around it that I submitted to the bug tracker in case it helps someone else...
In working with the CombinedCharts I've discovered a
bug in the CombinedVerticalNumberAxis and the
CombinedHorizontalNumberAxis. In both cases if the
original axis had it's range minimum and maximum
values set, they were being overridden after the call
to adjustPlots(). In looking into the issue it seems
that the getRange() method in both the
CombinedVerticalNumberAxis and the
CombinedHorizontalNumberAxis calls the method
autoAdjustRange() without checking the state of the
autoAdjust flag via the isAutoRange() method.
My fix was to change the getRange() method in both
classes from:
/**
* Returns the AxisRange (min/max) of our Axis
*/
public AxisRange getRange() {
autoAdjustRange();
return (new NumberAxisRange(new Double
(getMinimumAxisValue()),new Double(getMaximumAxisValue
())));
}
to:
/**
* Returns the AxisRange (min/max) of our Axis
*/
public AxisRange getRange() {
if(isAutoRange())
{
autoAdjustRange();
}
return (new NumberAxisRange(new Double
(getMinimumAxisValue()),new Double(getMaximumAxisValue
())));
}
In my case I was trying to draw to charts side by side with a scale from 0% to 100% and the upper scale was always set based upon the data until I made the above change.
Matt
Combined Charts: auto range problem and fix
Re: Combined Charts: auto range problem and fix
Hi Matt,
Thanks for the report. There's some pretty complex code in there, and I don't understand it all myself yet, but I'll take a look at your fix and see if I can incorporate it into the next version.
Regards,
DG.
Thanks for the report. There's some pretty complex code in there, and I don't understand it all myself yet, but I'll take a look at your fix and see if I can incorporate it into the next version.
Regards,
DG.