固定X轴的JFreechart系列机芯 [英] JFreechart series movement with fixed x-axis

查看:113
本文介绍了固定X轴的JFreechart系列机芯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个问题在这里.我正在用Java和JFreeChart做一个Arduino串口绘图仪.借助DynamicTimeSeries数据集,一切都可以正常工作,因为我可以轻松地绘制数据.

First question here. I'm doing an Arduino serial port plotter with Java and JFreeChart. Everything's working fine with the DynamicTimeSeries dataset, as I'm able to plot data nice and softly.

我现在需要做的是:给定一个确定的时间段(例如60秒),我想在该时间段内在图表上绘制DynamicTimeSeries数据集,而无需移动轴.我的意思是,就像在固定图表上画一条线60秒钟.

What I need to do now is this: given an established period of time (let's say 60 seconds) I want to plot the DynamicTimeSeries dataset on the chart for that period without moving the axis; I mean, like drawing a line for 60 seconds on the fixed chart.

有没有办法做到这一点?我看过的每个示例都显示x轴(时间轴)与该系列一起开始运行.

Is there any way to do this? Every example I've watched shows the x-axis (time axis) start running along with the series.

如果我不太清楚,请告诉我.

If I'm not clear enough please let me know.

任何帮助将不胜感激!

谢谢!

PS:我的代码基于以下内容: JFreeChart:DynamicTimeSeries,周期为n毫秒

PS: my code is based on this: Using JFreeChart to display recent changes in a time series, and this: JFreeChart: DynamicTimeSeries with period of n milliseconds

推荐答案

对于60第二张图表,我希望域索引在0..59范围内.根据您的要求,

For a 60 second chart, I'd expect domain indexes in the range 0..59. Depending on your requirements,

  • 您可以将下一个值放在索引0

您可以调用advanceTime()并将下一个值放在索引59.

You can invoke advanceTime() and put the next value at index 59.

也可以考虑在域轴上调用setDateFormatOverride(),如此处所示.另请参见 实时图形绘制开始时间 ,以及有关

Also consider invoking setDateFormatOverride() on the domain axis, as shown here. See also Real time graph plotting starting time and this answer about Using SwingWorker with JFreeChart.

这篇关于固定X轴的JFreechart系列机芯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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