0

I am using JFreeChart, and I am rendering the chart as an image using a servlet via JSP. I saw the tooltips while using a chart frame. How can I display tooltips on the JFreeChart image. Please help me; it's important.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Vijayalakshmi
  • 189
  • 1
  • 3
  • 11

1 Answers1

2

In a servlet/JSP environment, the dynamic features of a chart are unavailable. For tooltips, you can achieve a similar effect using a label generator, shown here. Of course you can supply any desired request parameters to the servlet, at the expense of re-generating the chart with each new request.

For an improved user experience, consider deploying your chart using Java Web Start, in addition to offering the static image via JSP. This related example may suggest the basic possibilities.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Thanks. I am using lable generator for pie charts, for bar charts also displaying values inside the bars, the problem is if the width or height of the bar is small, values are not visible on the graphs, this problem is mainly with bar and stacked bar graphs i am using. I thght if i am able to show the tooltips on mouse hover over the bars without value displayed inside, user can see wht is the value rep by the bar / stacked bar. Can anyone suggest me how can i solve this problem. tooltips are shown when i display the graph using chart frame, but mine is a web application. thanks in advance. – Vijayalakshmi Jan 25 '12 at 04:35
  • You can try adjusting `setMaximumBarWidth()`. I've never tried it, but `org.jfree.chart.imagemap` may let you display tool tips in an HTML image map. – trashgod Jan 25 '12 at 04:48