在 JFreeChart TimeSeries 图表上标记点

发布于 2024-12-24 16:35:29 字数 564 浏览 2 评论 0原文

我有一个包含 2 个数据项的 JFreeChart TimeSeries 图表。
我需要在其中标记点。
例如,我需要它在特定时间显示该线的值是什么(虽然实际上没有任何值并且 JFreeChart 创建了线)。
示例:

TimeSeries t=new TimeSeries("Test",Second.class);
Dataset.addSeries(t);

Calendar C=Calendar.getInstance();
t.add(new Second(C.getTime()), 100);

C.setTimeInMillis(C.setTimeInMillis+10*60*60*1000);
t.add(new Second(C.getTime()),200);


// Now I want Something like this psudo code
C.setTimeInMillis(C.setTimeInMillis-5*60*60*1000);
t.mark(new Second(C.getTime()));

如何通过域值标记系列上的点(因此应自动计算范围值)?

谢谢

I have a JFreeChart TimeSeries chart that has 2 data item.
I need to mark points in it.
For example I need it show at a specific time what is the line's value (while there is not actually any value and JFreeChart created line).
Example:

TimeSeries t=new TimeSeries("Test",Second.class);
Dataset.addSeries(t);

Calendar C=Calendar.getInstance();
t.add(new Second(C.getTime()), 100);

C.setTimeInMillis(C.setTimeInMillis+10*60*60*1000);
t.add(new Second(C.getTime()),200);


// Now I want Something like this psudo code
C.setTimeInMillis(C.setTimeInMillis-5*60*60*1000);
t.mark(new Second(C.getTime()));

How Can I mark points on a series by their domain value (So the range value should be calculated automatically)?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤蝉 2024-12-31 16:35:29

显示插值的一种便捷方法是启用轴跟踪功能,如本示例所示。

chartPanel.setHorizontalAxisTrace(true);
chartPanel.setVerticalAxisTrace(true);

附录:另一种方法是将插值值添加到数据集中并抑制其显示形状,如此处所示。然后,(未标记的)值将可用于工具提示生成器、标签生成器、图表鼠标侦听器等。

One convenient way to show interpolated values is to enable the axis trace feature, as shown in this example.

chartPanel.setHorizontalAxisTrace(true);
chartPanel.setVerticalAxisTrace(true);

Addendum: An alternative is to add the interpolated values to the data set and suppress the display of their Shape, as shown here. The (unmarked) value will then be available to a tool tip generator, label generator, chart mouse listener, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文