Hi,
how can I change the space in a plot, before the chartline begins and after the chartline ends. The spaces are actually to broad.
I didn't found a method in the javadoc and no comments in the docs.
Thanks
Joachim Schuler
spaces in the plot
Re: spaces in the plot
Place this code in your createLineChart or createBarChart method and you should be fine. To increase or decrease the spaces just change the value inside the perenthesis.
plot.setIntroGapPercent(0.01);
plot.setTrailGapPercent(0.01);
Good luck
Sean
plot.setIntroGapPercent(0.01);
plot.setTrailGapPercent(0.01);
Good luck
Sean
Re: spaces in the plot
Hi,
sorry, I forgot to mention, that I have a TimeSeriesChart.
Can I change the start- and end-spaces in a TimeSeriesChart ?
Thanks,
Joachim Schuler
sorry, I forgot to mention, that I have a TimeSeriesChart.
Can I change the start- and end-spaces in a TimeSeriesChart ?
Thanks,
Joachim Schuler
Re: spaces in the plot
Those lines will work for any chart besides Pie. So you should be good to go.
Sean
Sean
Re: spaces in the plot
Hi Joachim,
In the NumberAxis class, there are two methods:
setLowerMargin(double);
setUpperMargin(double);
When the axis range is being calculated automatically, JFreeChart works out the smallest and largest values in the dataset. Then a margin (a percentage of the overall range) is added to each end of the axis. The default is 5%. You probably want to set it to something closer to zero.
The methods that Sean mentions are used for spacing items in a CategoryPlot along the category axis.
Regards,
DG.
In the NumberAxis class, there are two methods:
setLowerMargin(double);
setUpperMargin(double);
When the axis range is being calculated automatically, JFreeChart works out the smallest and largest values in the dataset. Then a margin (a percentage of the overall range) is added to each end of the axis. The default is 5%. You probably want to set it to something closer to zero.
The methods that Sean mentions are used for spacing items in a CategoryPlot along the category axis.
Regards,
DG.
Re: spaces in the plot
Thanks to all,
who answers to my questions.
But the problem is, that I have a HorizontalDateAxis and I couldn't change the margins with the mentioned methods.
Has anybody a solution ?
Thanks,
Joachim
who answers to my questions.
But the problem is, that I have a HorizontalDateAxis and I couldn't change the margins with the mentioned methods.
Has anybody a solution ?
Thanks,
Joachim
Re: spaces in the plot
You've uncovered another inconsistency! If you look in the autoAdjustRange() method in the HorizontalDateAxis class, you'll see two lines that increase the range of the axis by 5 percent (hard-coded) at each end as follows:
upper = upper+(range/20);
lower = lower-(range/20);
That should get changed to use the lowerMargin and upperMargin attributes (which will need to be moved from NumberAxis to ValueAxis to allow this). I'll add that to my to-do list.
Regards,
DG.
upper = upper+(range/20);
lower = lower-(range/20);
That should get changed to use the lowerMargin and upperMargin attributes (which will need to be moved from NumberAxis to ValueAxis to allow this). I'll add that to my to-do list.
Regards,
DG.