[Solved] Change RangeAxis reference and orientation

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Nozalys
Posts: 7
Joined: Mon Nov 16, 2015 12:35 pm
antibot: No, of course not.

[Solved] Change RangeAxis reference and orientation

Post by Nozalys » Tue Nov 17, 2015 2:45 pm

Hello everybody,

I'm searching for changing the way the range axis is drawn, and every topics with keywords "change origin" or "change reference" don't fit to my issue.

What I want to do is the following :

Image

That is to say a bar chart, with the real origin of the bars coming form a value different of zero (-30 for example), but where the Y-range is ordered in increasing order, meaning that the -20 Y-value is upper than the -30 Y-value.

I'v tried to play with following methods without any success :
channelBarChart.getXYPlot().getRangeAxis().setAutoRange()
channelBarChart.getXYPlot().getRangeAxis().setLowerBound()
channelBarChart.getXYPlot().getRangeAxis().setLowerMargin()
channelBarChart.getXYPlot().getRangeAxis().setUpperBound()
channelBarChart.getXYPlot().getRangeAxis().setUpperMargin()
channelBarChart.getXYPlot().getRangeAxis().setInverted()

Is it possible to do what I want ? I guess yes, but didn't find any example... I have everytime the origin of the bars staying at the zero value.

Regards,
Maël
Last edited by Nozalys on Tue Nov 17, 2015 5:30 pm, edited 1 time in total.

Naxter
Posts: 45
Joined: Thu Jun 26, 2014 8:24 am
antibot: No, of course not.
Location: Germany, Aachen

Re: Change RangeAxis reference and orientation

Post by Naxter » Tue Nov 17, 2015 4:34 pm

hey,

actually you should have checked the XYBarRenderer. This Renderer has a method which is called "setBase". You can you use it this way.

Code: Select all

    barRenderer.setBase(-30.);
I hope this is what you were looking for.

Greetings

Nozalys
Posts: 7
Joined: Mon Nov 16, 2015 12:35 pm
antibot: No, of course not.

Re: Change RangeAxis reference and orientation

Post by Nozalys » Tue Nov 17, 2015 5:29 pm

Thanks a lot Naxter, you solved my headache of the few past days !!

This is exactly what I wanted for, but i did not think to look inside renderer options, only inside the axis options.

Maël

Locked