ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  re: May I ask you a question regarding on how to generate a bar chart in jpeg/jpg format
Posted by Mike on Jul-23-2012 11:01
Good morning All,

I am using ChartDirector for creating the charts in my Java web application.  It is possible if i could get all the charts generated in jpeg/jpg format and may you please tell me what changes should I make in my java program?

Thank you very much,
Mike

  re: May I ask you a question regarding on how to generate a bar chart in jpeg/jpg format
Posted by Peter Kwan on Jul-23-2012 23:18
Hi Mike,

If you are using the JSP sample code included in ChartDirector for JSP/Java, the charts are output in memory to be sent to the browser. Most of the sample code outputs the chart image as PNG (which is the default). A few sample code, such as the "Surface Chart", output the chart image as JPEG, using code like:

// Output the chart
String chart1URL = c.makeSession(request, "chart1", Chart.JPG);

If you would like to output the chart as a JPEG image file on the hard disk, you may use BaseChart.makeChart. For example:

c.makeChart("c:/aaa/bbb/ccc.jpg");

For the above code to work, please make sure your application or web server has read/write access to the above directory

Hope this can help.

Regards
Peter Kwan