Generate tooltip for a Time Series Chart using my own format

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cenicienta
Posts: 15
Joined: Mon Jun 26, 2006 8:31 pm
Location: Paris

Generate tooltip for a Time Series Chart using my own format

Post by cenicienta » Fri Jun 30, 2006 9:36 pm

Hi,

I try to generate tooltip for a Time Series Chart using my own format.

This is my code :

Code: Select all

XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)xyplot.getRenderer();
xylineandshaperenderer.setBaseShapesVisible(true);
xylineandshaperenderer.setToolTipGenerator(new StandardXYToolTipGenerator("CPU",new SimpleDateFormat("MMM-yyyy"),new DurationFormat()));
It doesn't work because only "CPU" appears in tooltip. :?

If i use this code :

Code: Select all

xylineandshaperenderer.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());
tooltip is generated but of course without my format. :oops:

Can you tell me whats' wrong in my code please ?

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

Post by skunk » Fri Jun 30, 2006 11:30 pm

What happens if you change your formatString to something like "CPU {0} {1} {2}"

cenicienta
Posts: 15
Joined: Mon Jun 26, 2006 8:31 pm
Location: Paris

Post by cenicienta » Sat Jul 01, 2006 8:04 am

Hi skunk,

You're right. It's work well !

The good code is :

Code: Select all

xylineandshaperenderer.setToolTipGenerator(new StandardXYToolTipGenerator("{0},{1},{2}",new SimpleDateFormat("MMM-yyyy"),new DurationFormat())); 
Thanks a lot. :wink:

Locked