A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
ge0ffrey
- Posts: 20
- Joined: Sat Feb 27, 2010 6:44 pm
- antibot: No, of course not.
Post
by ge0ffrey » Mon Jul 07, 2014 10:45 am
This doesn't look pretty (JFreeChart 1.0.14):
Is there any way make this look pretty? Is there any support for BigDecimal YXDatasets ?
Used code for the axis:
Code: Select all
private XYPlot createPlot(BenchmarkReport benchmarkReport, int scoreLevelIndex) {
Locale locale = benchmarkReport.getLocale();
NumberAxis xAxis = new NumberAxis("Time spent");
xAxis.setNumberFormatOverride(new MillisecondsSpentNumberFormat(locale));
NumberAxis yAxis = new NumberAxis("Best score level " + scoreLevelIndex);
yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale));
yAxis.setAutoRangeIncludesZero(false);
XYPlot plot = new XYPlot(null, xAxis, yAxis, null);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
Full code:
https://github.com/droolsjbpm/optaplann ... .java#L131
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Tue Jul 08, 2014 6:03 am
In the JFreeChart 1.0.18 release, I added this class as the default TickUnitSource - it will solve this problem (you could copy the class and use it with an earlier version of JFreeChart, just call the setStandardTickUnits() method on the axis):
http://www.jfree.org/jfreechart/api/jav ... ource.html
There isn't support for BigDecimal - even though the datasets accept Number objects, all of them are converted to double values for calculation within the chart rendering framework.
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Tue Jul 08, 2014 6:06 am
The other solution for you is to look in the NumberAxis method createStandardTickUnits(), and either modify it to include some larger units, or copy the method elsewhere and modify the TickUnitSource that it creates…then call the setStandardTickTickUnits() method on the axis to change the default TickUnitSource.
-
ge0ffrey
- Posts: 20
- Joined: Sat Feb 27, 2010 6:44 pm
- antibot: No, of course not.
Post
by ge0ffrey » Tue Jul 08, 2014 1:19 pm
Thanks.
I'll start with updating to 1.0.18 and work my way from there.
JFreeChart is wonderful

-
ge0ffrey
- Posts: 20
- Joined: Sat Feb 27, 2010 6:44 pm
- antibot: No, of course not.
Post
by ge0ffrey » Wed Aug 06, 2014 12:58 pm
Solved by upgrading to 1.0.19
