动态刀尖生成器 - Jfreechart [英] Dynamic tool tip generator - Jfreechart

查看:134
本文介绍了动态刀尖生成器 - Jfreechart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jFreeChart生成动态图表(XYLineChart),并且我有一个未包含在数据集中的字段。该字段是动态生成的。我想在我的工具提示中包含它。我有可能做到吗?

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 ?

以下是该计划的流程:

使用空数据集创建图表。

Create Chart using an empty dataset.

设置chartPanel。 (我想这里是我们定义TooltipGenerator的地方)。

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).

刷新图表。

推荐答案


要显示的名称不包含在数据集的任何位置。

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

此处所示,自定义 XYItemLabelGenerator ,您可以扩展合适的数据集,例如 AbstractXYDataset ,包含所需信息并从 XYToolTipGenerator 的实现中访问它。

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.

这篇关于动态刀尖生成器 - Jfreechart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆