Category Data ImageMap URL

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

Category Data ImageMap URL

Post by Rick Stoyle » Thu Jan 30, 2003 8:14 pm

Was hoping for a hint in the right direction. I have created a Bar chart very similar to the one in the WebHit Servlet Demo (uses a CategoryDataset). The resulting chart is exactly what I want to see but I want to change the URLs in the Image Map while maintaining the section names displayed on the Category Axis. For instance, lets assume I create the chart exactly in the example (the first section name is called Catalog). The resultant URL mapped to the first bar is then:

... /xy_chart.jsp?series=0&section=Catalog

What is the best way to change this to:

... /xy_chart.jsp?series=0&section=Catalogue

and still keep the label "Catalog" on the charts axis.


Thanks,
Rick

Rick Stoyle

Re: Category Data ImageMap URL

Post by Rick Stoyle » Thu Jan 30, 2003 8:25 pm

Oops - looks like the ampersands in the urls didn't translate so good. I'll substitute a "+" instead. Should read:

.
.
.
... /xy_chart.jsp?series=0+section=Catalog

What is the best way to change this to:

... /xy_chart.jsp?series=0+section=Catalogue

.
.
.

Richard Atkinson

Re: Category Data ImageMap URL

Post by Richard Atkinson » Thu Jan 30, 2003 8:33 pm

Develop a class that implements the CategoryURLGenerator interface and does what you need and set it as a property of the VerticalBarRenderer. You might want to take a look at the StandardCategoryURLGenerator for ideas (package com.jrefinery.chart.urls).

http://cvs.sourceforge.net/cgi-bin/view ... cvs-markup

Hope that helps.

Regards,
Richard...

Rick Stoyle

Re: Category Data ImageMap URL

Post by Rick Stoyle » Thu Jan 30, 2003 8:49 pm

Thanks for the quick response Richard.

For the record, I was somewhat successful by intercepting the ChartRenderingInfo's entity collection after the chart was created and changing it just before writing the imagemap but my code faultered when I hit a "zero" value (ie. No iteration for that category) and nothing synced up after. Wasn't sure if I should pursue my current course of try another way. Your suggestion sounds like a cleaner way to do it so I'll give it a shot.

Many thanks!!!,
Rick

Locked