Chart Antialiasing question

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
ralphscheuer
Posts: 4
Joined: Wed Mar 10, 2004 3:37 pm

Chart Antialiasing question

Post by ralphscheuer » Tue Mar 23, 2004 1:22 pm

Hello everybody,

first of all, a big thank you to David Gilbert and the other developers for this useful and flexible package.

I have a question regarding antialiasing: The online demos such as the ParetoChart demo shown on the jfree webpage under http://www.jfree.org/jfreechart/images/ ... rtDemo.png show correct antialiasing: zooming in, I noticed that the percentage line is antialiased while the bars aren't (there is also no need to). The source code of the demo does not set any special parameter in this regard.

However, on my machine, I have tested various antialiasing parameters (via RenderingHints) to no avail: I could not find a way to get this antialiasing behaviour on Apple's JDK 1.4.1 running Mac OS X. I did not have a chance to test my code on another platform, but I can either disable antialiasing as a whole, enable it for fonts only or antialias everything (where everything means that straight lines such as the border lines of bars will also have antialiasing for no real reason).

Is there anything I can do about that?

Thanks in advance for any hints, your help is greatly appreciated.

Ralph[/url]

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

Post by david.gilbert » Tue Mar 23, 2004 5:49 pm

The anti-aliasing is "all-or-nothing" as far as I know. A number of people have requested the ability to turn off antialiasing just for text, so I will investigate that at some point.

The demo image you linked to is generated on Linux, so maybe that is why the vertical and horizontal lines aren't antialiased.

I know there is a RenderingHints.KEY_TEXT_ANTIALIASING hint - I haven't tried it yet, so I don't know which platforms support it.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

ralphscheuer
Posts: 4
Joined: Wed Mar 10, 2004 3:37 pm

Post by ralphscheuer » Tue Mar 23, 2004 6:06 pm

David,

thanks for your answer. The following code snippet works on Mac OS X, so I am definitely able to influence the antialiasing behaviour:

Code: Select all

chart.setRenderingHints(new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON));
This turns antialiasing off for everything but the fonts. I use that whenever I create a bar chart. However, when I create something like the Pareto chart from your site or a price-volume chart, I would really like to turn antialiasing on. My problem is that the borders of chart bars exhibit some really strange blurring if I turn on full antialiasing which looks very strange.

However, I guess if you did not encounter this problem on Linux, this must be a rendering bug in Apple's AWT implementation. Apple's JDK 1.4.1 and 1.4.2 seem to have this problem. I will try to test my code on another platform - if this is not a known issue with JFreeChart, it has to be some kind of platform-specific issue. I will consider submitting a bug report to Apple. [/code]

malvers
Posts: 1
Joined: Wed Dec 05, 2018 8:13 pm
antibot: No, of course not.

Re: Chart Antialiasing question

Post by malvers » Thu Dec 06, 2018 9:23 am

Hi, "on my machine" this was not enough. This

Code: Select all

chart.setRenderingHints(
				new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR));
brought the desired result: smooth lines!

Post Reply