JFreechart 实时组合图 - 如果未收到数据点,则渲染步骤子图的前一个值

发布于 2024-07-27 12:51:23 字数 483 浏览 2 评论 0原文

我在 JFreechart 中有一个组合图,由 4 个具有公共时域轴的时间序列图表组成。

子图的数据以不同的速率到达。 例如,我可能每几毫秒收到一次价格变化事件,每分钟收到一次仓位变化。 我目前正在使用 XYStepRenderer 渲染这些系列以生成步骤图。

我希望能够做这样的事情:

  • 在时间 T 收到价格点并将其绘制在图表上
  • 在时间 T 没有收到持仓图表的数据,因此我们假设该值没有改变,并且呈现先前的仓位值 - 即水平延伸阶梯线
  • 在时间 T+1 接收并绘制位置点 更改阶梯图
  • 在时间 T+1 没有接收到价格点,因此绘制了先前的价格

是否有任何价格 点在 JFreechart 中执行此操作的简单方法? 目前我有一个有效的实现,但这不能处理呈现假设值。

我最初的想法是更改数据模型,以便我可以快速找到以前的值,并更改调用以告诉每个子图在收到任何图的事件时进行绘制。

I have a combined plot in JFreechart consisting of 4 timeseries charts with a common time domain axis.

The data for the subplots arrives at different rates. For example I may receive a price change event every couple of miliseconds and a position change every minute. I'm currently rendering these series with the XYStepRenderer to produce a step charts.

I'd like to be able to do something like this:

  • A Price point is received at time T and is plotted on chart
  • No data has been received at time T for the position chart and so we assume that the value has not changed and the previous position value is rendered - i.e. extending the step line horizontally
  • At time T+1 a position point is received and is plotted changing the step chart
  • At time T+1 no price point has been received and so the previous price is plotted

Is there any easy way to do this in JFreechart? Currently I have a working implementation but this does not handle rendering the assumed values.

My initial thoughts have been around changing the data model so that I can quickly find the previous value and to change the calls to tell each subplot to draw when an event is received for any plot.

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

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

发布评论

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

评论(1

尬尬 2024-08-03 12:51:24

我认为您需要缓冲传入的更改并应用规则集将更改转发到 JFreeChart(顺便说一句,对于实时工作并不真正建议这样做,但我发现对于低频更新来说它效果很好)。

我猜您有价格数据集和持仓数据集。 您的仓位和价格更新是否带有时间戳? 如果没有,您将遇到按顺序接收这些数据并尝试将它们联系起来的问题(也许在某个时间窗口内到达的更新映射到同一时刻?)。 如果它们确实有时间戳,那么您可以在价格出现时派生一个新头寸(与旧头寸相同),然后在需要时替换它。

无论发生什么情况,我都会将图表更新与头寸/价格更新分离,以防万一您被头寸/价格变化淹没。 您不希望将其转化为必须立即丢弃的多个图表更新。

I think you'll need to buffer the incoming changes and apply a ruleset for forwarding changes onto JFreeChart (which is not really recommended for real-time work btw., but I've found that for low frequency updates it works well).

I'm guessing you have a dataset for the prices and a dataset for the positions. Do your position and price updates come in with a timestamp ? If not, you'll have the problem of receiving these sequentially and trying to tie them up (perhaps updates arriving within a certain timewindow map to the same time instant?). If they do have timestamps, then you can derive a new position (same as the old position) when the price comes in, and then replace that if need be.

I would decouple the chart updating from the position/price updates whatever happens, just in case you get swamped with position/price changes. You don't want that to translate into multiple chart updates that you're going to have to throw away immediately.

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