Problems with tooltips

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

Problems with tooltips

Post by Elio » Thu Aug 29, 2002 7:33 pm

Hi!!

I tried to make my own tooltip for my ScatterPlot, but there is some problems:

I don't know exactly what is happening, i have an array of strings with the aditional information of the points and i want to add each one to its respective position. Like: The string ofthe position 0,0 i want to append to the tooltip of my data of the same position, and so on.
The main problem is that when i take the value from the XYDataset it isn't the same of my initial value?!

my code is:

public String generateToolTip(XYDataset data, int series, int item) {
StringBuffer result = new StringBuffer().append(data.getSeriesName(series)).append(": ");
Number x = data.getXValue(series, item);


result.append("PI: ").append(xFormat.format(x));

Number y = data.getYValue(series, item);
if (y!=null) {
result.append(", HM: ").append(yFormat.format(y)).append("; ");
}
else {
result.append(", PI: null\n");
}
result.append(seqName[series][item]);

return (new String(result));
}

Elio

Re: Problems with tooltips

Post by Elio » Tue Sep 03, 2002 3:44 pm

How can i find the first position of my element in the dataset? (the index when i added to it)

David Gilbert

Re: Problems with tooltips

Post by David Gilbert » Tue Sep 03, 2002 3:55 pm

I don't understand...can you explain some more?

Regards,

DG

Elio

Re: Problems with tooltips

Post by Elio » Tue Sep 03, 2002 8:31 pm

Ok.

I want to put a tooltip for each point of the ScatterPlot chart. Then i create two arrays, one for my plot data and other for my tooltip. In the tooltip, i appended my tooltip of the first position of the array to the data on the first position of the XYDataset, but it (the data from XYDataset) isn't the same of that data which i've added to the XYSeries.

Thanks!!
Elio

David Gilbert

Re: Problems with tooltips

Post by David Gilbert » Tue Sep 03, 2002 11:15 pm

It might be that XYSeries sorts (x,y) pairs into ascending order of x values.

Regards,

DG.

Locked