LogAxis - Redefinition of tick labels seems not to be showed

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
michela.montano
Posts: 4
Joined: Tue Sep 09, 2014 2:57 pm
antibot: No, of course not.

LogAxis - Redefinition of tick labels seems not to be showed

Post by michela.montano » Fri Sep 26, 2014 12:30 pm

Hi all,
I need to show some particular values on a logAxis domain (used in CategoryAxis plot).

I've overridden the RefreshTick method like that:
rangeAxisY = new LogAxis(labelYaxis){
@Override
public List refreshTicks(Graphics2D g2, AxisState state,
Rectangle2D dataArea, RectangleEdge edge) {

List myTicks = new ArrayList();
myTicks.add(new NumberTick(
TickType.MINOR,
0.0f,
"0",
TextAnchor.CENTER_RIGHT,
TextAnchor.CENTER_RIGHT,
0.0));
myTicks.add(new NumberTick(
TickType.MINOR,
25.0f,
"25",
TextAnchor.CENTER_RIGHT,
TextAnchor.CENTER_RIGHT,
0.0));
myTicks.add(new NumberTick(
TickType.MINOR,
25.0f,
"300",
TextAnchor.CENTER_RIGHT,
TextAnchor.CENTER_RIGHT,
0.0));

return myTicks;
}
};

and the range is

rangeAxisY.setDefaultAutoRange(new Range(0,1000));
rangeAxisY.setTickLabelsVisible(true);
rangeAxisY.setTickMarksVisible(true);

...but I still see only the "300" named line, nothing else
What's wrong?
thank you for support!
MM.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: LogAxis - Redefinition of tick labels seems not to be sh

Post by david.gilbert » Tue Sep 30, 2014 7:01 pm

There are two issues I think:

- zero never appears on the axis because log values are only defined for positive numbers - getSmallestValue() returns the smallest value that will be displayed on the axis;
- you have specified 25.0 as the value for both the other tick values, you should change the last one to 300.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked