How to disable scaling in JFreeChart?
Posted
by Alex Arnon
on Stack Overflow
See other posts from Stack Overflow
or by Alex Arnon
Published on 2010-05-25T13:06:44Z
Indexed on
2010/05/25
13:11 UTC
Read the original article
Hit count: 259
Hi All,
We're using JFreeChart to build an engine to display graphs. This is a web service that runs on Tomcat + Java 1.5.0, and renders charts to PNGs and JPEGs (using ChartUtilities.writeChartAs{PNG,JPEG}() ).
We've run into a problem where JFreeChart seems to scale everything inside the Plot area, but only by a few pixels. The result is that the graph looks inconsistent, e.g.:
- Minor ticks are sometimes stretched horizontally, so that they seem to be two pixels wide instead of one.
- We use a small image in the top-right of the plot area as a watermark. This is stretched by one pixel horizontally and vertically somewhere near (but not exactly) its middle.
- Background grid lines seem to appear on sub-pixel boundaries. I have not found a way to create an accurately dotted grid line.
We have tried both 1.0.9 and 1.0.13, with exactly the same results (except for the minor ticks, which were not available in the older version). Also, rendering the image to a Frame instead of JPEG/PNG produced an identical result.
Help is greatly appreciated, in advance :)
© Stack Overflow or respective owner