JFreechart 系列固定 x 轴运动 [英] JFreechart series movement with fixed x-axis

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

问题描述

这里是第一个问题.我正在用 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 显示时间序列中的最近变化,以及:JFreeChart:周期为 n 毫秒的 DynamicTimeSeries

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(),如此处所示.另请参阅实时图表绘制开始时间以及关于使用 SwingWorker with JFreeChart.

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.

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

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