Hello everybody,
I use the LogarithmicAxis in my chart, and I don't want ot display values below zero when i zoom out.
Is it possible?
Thanks
[SOLVED] LogarithmicAxis zoom
[SOLVED] LogarithmicAxis zoom
Last edited by Alex4924 on Wed Dec 07, 2011 11:08 am, edited 1 time in total.
Re: LogarithmicAxis zoom
I think that you can try to override zoomOutBoth method from ChartPanel.
-
- Posts: 31
- Joined: Thu May 27, 2010 4:23 pm
- antibot: No, of course not.
Re: LogarithmicAxis zoom
Or you might do something like (tweak to your needs):
Cheers,
- m.
Code: Select all
private static LogarithmicAxis newZeroBasedLogAxis() {
LogarithmicAxis axis = new LogarithmicAxis(null /* maybe title */) {
@Override
public Range getRange() {
Range sRange = super.getRange();
// ensure lowerBound < upperBound to prevent exception
return new Range(
Math.max(0, sRange.getLowerBound()),
Math.max(1e-8, sRange.getUpperBound()));
}
};
axis.setAllowNegativesFlag(true);
// ... init as you wish ...
return axis;
}
private void aMethod() {
.....
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainAxis(newZeroBasedLogAxis());
plot.setRangeAxis(newZeroBasedLogAxis());
.....
}
- m.
Re: LogarithmicAxis zoom
Thank a lot,
my problem is almost solved, Do you know how to add tick marks, for example 1000 -> 1KBq?
my problem is almost solved, Do you know how to add tick marks, for example 1000 -> 1KBq?
[SOLVED] LogarithmicAxis zoom
My probleme is solved, Thank you mkrauskopf!!
Re: LogarithmicAxis zoom
How did you solve this?Alex4924 wrote:Thank a lot,
my problem is almost solved, Do you know how to add tick marks, for example 1000 -> 1KBq?
Re: [SOLVED] LogarithmicAxis zoom
I use the méthods and in the class LogarithmicAxis
Code: Select all
protected List refreshTicksHorizontal(Graphics2D g2,Rectangle2D dataArea,RectangleEdge edge)
Code: Select all
protected List refreshTicksVertical(Graphics2D g2,Rectangle2D dataArea,RectangleEdge edge)