Image map generation problem

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
its_vippy
Posts: 12
Joined: Thu Nov 18, 2004 9:55 am
Contact:

Image map generation problem

Post by its_vippy » Mon Oct 03, 2005 3:35 pm

Hi All,
@ 2 places in my application I am trying to generate image-maps for the charts which i later use in my html pages.

the code is almost similar but surprisingly @ one place it works while @ other place it gives me <Empty> map while chart contains the data.

SuccessFul case:

Code: Select all

File image1=new File(ftpRetrievalThread.xmlFile,file1);
File image2=new File(ftpRetrievalThread.xmlFile,file2);

ChartRenderingInfo cri1 = new ChartRenderingInfo();
ChartRenderingInfo cri2 = new ChartRenderingInfo();

ChartUtilities.saveChartAsJPEG(image1,charts[0],800,400,cri1);
ChartUtilities.saveChartAsJPEG(image2,charts[1],800,400,cri2);

String map1=ChartUtilities.getImageMap("graph1",cri1);
String map2=ChartUtilities.getImageMap("graph2",cri2);
and the code where i get Empty map string.

Code: Select all

File image1=new File(localDir,chart1ImgName);
File image2=new File(localDir,chart2ImgName);

ChartRenderingInfo cri1 = new ChartRenderingInfo();
ChartRenderingInfo cri2 = new ChartRenderingInfo();

ChartUtilities.saveChartAsJPEG(image1,mipChart1,chartWidth,chartHeight,cri1);
ChartUtilities.saveChartAsJPEG(image2,mipChart2,chartWidth,chartHeight,cri2);

String map1=ChartUtilities.getImageMap("graph1",cri1);
String map2=ChartUtilities.getImageMap("graph2",cri2);
but in this later case what I get is

Code: Select all

<MAP NAME="graph1"> </MAP>
while the graph is having data (Can see it).

Both blocks are under try-catch(Exception e).

Any help is appreciated.
-Vippy

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

Post by david.gilbert » Mon Oct 03, 2005 4:46 pm

There are some renderers that don't (yet) have code to generate entities - perhaps that is the difference between your two charts?
David Gilbert
JFreeChart Project Leader

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

its_vippy
Posts: 12
Joined: Thu Nov 18, 2004 9:55 am
Contact:

Same Renderer

Post by its_vippy » Tue Oct 04, 2005 8:59 am

Both are TimeSeriesChart and use XYItemRenderer.

Anyone with a clue ?

Vippy

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Tue Oct 04, 2005 2:06 pm

Are chartWidth and chartHeight initialized with reasonable values?

its_vippy
Posts: 12
Joined: Thu Nov 18, 2004 9:55 am
Contact:

Yes they are.

Post by its_vippy » Tue Oct 04, 2005 2:09 pm

Yes,
chartWidth=400;
chartHeight=150;

I dont think it should make a difference but i tried by increasing the size to 700,300 but to no avail. :-(

Vippy

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

Post by david.gilbert » Tue Oct 04, 2005 5:05 pm

I'd start a debugging session and inspect the content of the cri1 and cri2 objects, to see if they are being populated as they should.
David Gilbert
JFreeChart Project Leader

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

its_vippy
Posts: 12
Joined: Thu Nov 18, 2004 9:55 am
Contact:

Post by its_vippy » Thu Oct 06, 2005 10:54 am

Hi Dave
Is there anything you got.
I forgot to mention that i am using 0.9.18

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

Post by david.gilbert » Thu Oct 06, 2005 3:53 pm

Something very strange is happening if both your charts are using the same setup...I can't tell what it is. As I said before, you need to start a debugging session and inspect the contents of cri1 and cri2.
David Gilbert
JFreeChart Project Leader

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

Locked