Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
473 views
in Technique[技术] by (71.8m points)

java - Dynamic tool tip generator - Jfreechart

I am generating a dynamic chart (XYLineChart) using jFreeChart and I have a field which is not included in the dataset. The field is generated dynamically. I want to include that in my tooltip. Is there any possibility I can do it ?

Here is the flow of the program:

Create Chart using an empty dataset.

Set chartPanel. (I guess here is the place where we define the TooltipGenerator).

Receive dynamic data from socket.

Add data to the dataset. ( Here is the only place where I have the data which I need to have in my tooltip text).

Refresh Chart.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The name to be displayed is not included anywhere in the dataset.

As shown here for a custom XYItemLabelGenerator, you can extend a suitable dataset, e.g. AbstractXYDataset, to include the required information and access it from your implementation of XYToolTipGenerator.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...