How to get the width and height from one chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Chaniat
Posts: 3
Joined: Thu Mar 19, 2009 9:48 am

How to get the width and height from one chart

Post by Chaniat » Tue Mar 31, 2009 7:07 am

Hello

I am using JfreeChart 1.0.11

I have created one chart like this
JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", dataset, true, true, false);

Then, I have saved it into one JPG file
ChartUtilities.saveChartAsJPEG(new File("Test1.jpg"), chart, 300,300);

But, I would like replace 300, 300 with the width and height from the original chart to keep the good ratio.

How can I do it

Thank in advance.

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

Re: How to get the width and height from one chart

Post by david.gilbert » Tue Mar 31, 2009 7:56 am

In JFreeChart, a chart doesn't have a width or a height. YOU give JFreeChart the dimensions, and then it tries to draw a nice looking chart within those constraints.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked