Hello,
First of all I would like to congratulate the JFree team for producing such an amazing toolkit. I was desesparetely looking for something similar in C++ (free and cross-platform), and never found! So now I am a Java addicted (and newbie).
I am still discovering the tools but I found a few glitches in the logarithmic axes, and I was wondering if anyone have some solutions or can suggests me in which direction I should look... I am also not sure if this is the correct place to post these emails. If not please correct me.
I have a XYPlot in ChartPanel with 2 logarithmic axes. I have the following problems:
o The tick labels on the Domain Axis are not displayed in the good format: I have 1e-3 altough I use setExpTickLabelsFlag(true). The problem is not present for the Range Axis;
o The tick label is a bit strange on the Domain Axis: I have for example (1e-3 2e-3 1e-2 2e-2,...). Again this problem is not present on the Range Axis
o The Zooming does apparently not take into account the fact that this is a logarithmic plot. If I have a range from 0.01 to 100 after zooming out I have -100 to 100 (or something similar, I can't really remember) where I would expect 1e-4 to 1e4....
If necessary I can provide a snapshot altough I am not to sure how to do this in this forum.
Any suggestion to where I should concentrate my search would be greatly appreciated.
Cheers
Nicolas
Logarithm axes problems
Denis
As far as I know, a Domain Axis isn't a sorted Axis. It's just a collection of items.
So that explains chy the items on your domain axis aren't sorted: they just appear in the order you have added them.
Only solution I have found so far is writing my own function to sort the dataset, using the built-in Java sorting functions (Collections.sort).
So that explains chy the items on your domain axis aren't sorted: they just appear in the order you have added them.
Only solution I have found so far is writing my own function to sort the dataset, using the built-in Java sorting functions (Collections.sort).
I am not sure what you mean by that. I used the terminology Domain Axis because it seems that this is the terminology used in JFreeChart for the X-Axis, but it was about the X-Axis an instance of Logarithmic Axis in a XYPlot I was refering. And everything is well ordered. So I don't think this is linked to what you are mentioning.As far as I know, a Domain Axis isn't a sorted Axis. It's just a collection of items.
Cheers
Nicolas
Logarithm axes problems
Hello,
I have looked a little bit on this problem by examing rapidly the code in JFreeChart latest version and I think the problem is that the Log Axes needs to subclasse a few more methods in LogarithmicAxis.java. For example, the method zoomRange is not defined in this class and the method from valueAxis is therefore used... Which only deal with linear plot. Using the following code solve the problem:
(Please note that the isInverted case is not tested)
Another minor problem, is the use of DEFAULT_LOWER_BOUND in autoAdjustRange. This lead to zero for the axis origin if there are no data on the plot. I think it would be nice to have a DEFAULT_LOG_LOWER_BOUND defined to something like 0.001 or similar.
There are some other few problems with log axes, but I don't have really the time to investigate. Is there any plan to improve this classe before the official release 1.0?
Cheers
Nicolas
[/quote]
I have looked a little bit on this problem by examing rapidly the code in JFreeChart latest version and I think the problem is that the Log Axes needs to subclasse a few more methods in LogarithmicAxis.java. For example, the method zoomRange is not defined in this class and the method from valueAxis is therefore used... Which only deal with linear plot. Using the following code solve the problem:
Code: Select all
public void zoomRange(double lowerPercent, double upperPercent) {
double start = Math.log10(getRange().getLowerBound());
double end = Math.log10(getRange().getUpperBound());
double length = end - start;
Range adjusted = null;
if (isInverted()) {
adjusted = new Range(Math.pow(10,start + (length * (1 - upperPercent))),
Math.pow(10,start + (length * (1 - lowerPercent))));
}
else {
adjusted = new Range(
Math.pow(10, start + length * lowerPercent),
Math.pow(10, start + length * upperPercent));
}
setRange(adjusted);
}
Another minor problem, is the use of DEFAULT_LOWER_BOUND in autoAdjustRange. This lead to zero for the axis origin if there are no data on the plot. I think it would be nice to have a DEFAULT_LOG_LOWER_BOUND defined to something like 0.001 or similar.
There are some other few problems with log axes, but I don't have really the time to investigate. Is there any plan to improve this classe before the official release 1.0?
Cheers
Nicolas
[/quote]
fix for zoom problem
I have posted a subclass that fixes the zoom problem for JFreeChart 1.0.1 at
http://sourceforge.net/tracker/index.ph ... tid=115494
http://sourceforge.net/tracker/index.ph ... tid=115494
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Thanks, I will try to have a look at this.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


class works but the over-ridden method doesn't
Dave,
Is there any way to just incorporate the LogarithmicAxisPatched code on the sourceforge web site into the "real" LogorithmicAxis so others don't have to go through this pain?
Kurt
Is there any way to just incorporate the LogarithmicAxisPatched code on the sourceforge web site into the "real" LogorithmicAxis so others don't have to go through this pain?
Kurt
Kurt