Problem with scaling and blur.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Phillip Baird

Problem with scaling and blur.

Post by Phillip Baird » Tue Jun 18, 2002 4:48 am

As this is my first post here I'd like start off by congratulating David and the others who have contributed to making JFreeChart such a great tool.

The problem I have to report is I've just upgraded an application from 0.71 to the latest 0.91 release and the charts that are being displayed now look blurred.

The application is using a ChartPanel to display vertical bar charts. The panel is in a resizeable window so can be maximised to full screen. The ChartPanel is resizing with the Window.

What appears to be happening is the chart image looks like it is being scaled up in size. This makes it look blocky. The anti-aliasing that has been introduced helps to smooth the text but the text is also looking blurred. The outlines of the bars look very blurred.

To try and resolve this I've turned off anti-aliasing using setAntiAlias(false). This improves the bars but leaves the text looking really blocky.

The scaling and anti-aliasing look to be of value when the window size is made smaller, however the scaling up in size that is occuring has the complete opposite effect.

I think this problem could be solved by preventing the chart from being scaled above it's rendered size. Is there any way to do this?

Can anyone suggest any other ways I could get these charts looking as sharp as they did with 0.71?

thanks

/PhillipB

Phillip Baird

Re: Problem with scaling and blur.

Post by Phillip Baird » Tue Jun 18, 2002 5:08 am

Looks like I've found the answer to my own problem.

The maximumDrawWidth and maximumDrawHeight of ChartPanel appear to control if scaling will be used. By bumping these values up I've avoided the scaling which has improved the look of things no end.

/PhillipB

David Gilbert

Re: Problem with scaling and blur.

Post by David Gilbert » Tue Jun 18, 2002 4:50 pm

Hi Philip,

I've just committed changes to CVS to add get/set methods for these attributes. I like the new behaviour (except that it seems a little slower - I don't have hard stats on that though), but if no one else does then I'll set the default values in ChartPanel to something higher.

Regards,

DG.

Ashwin Baskaran

Re: Problem with scaling and blur.

Post by Ashwin Baskaran » Tue Jun 18, 2002 5:09 pm

I might be missing something here but it seems like you could acheive essentially the same thing, i.e., preventing a ChartPanel from being sized beyond its rendered size, with something like:

chartPanel.setMaximumSize(chartPanel.getPreferredSize());


Ashwin

David Gilbert

Re: Problem with scaling and blur.

Post by David Gilbert » Tue Jun 18, 2002 5:19 pm

I don't mind how big the panel gets...I just wanted to have the *option* of scaling a smaller chart into the bigger space, because on full screen charts sometimes the title font and the lines look a little small/thin. With scaling this isn't such a problem. But you can set the max width and height to large values and just leave JFreeChart to do it's own layout as it did in previous versions.

Regards,

DG

Locked