JFreeChart折线图上的动画图 [英] Animate plot on JFreeChart line graph

查看:38
本文介绍了JFreeChart折线图上的动画图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在一个项目中,该项目使用JFreeChart库将实时数据绘制为折线图.它的工作效果很好,但我想通过以平滑的动画方式绘制数据而不是分立步骤进行绘制,以使其更加优雅.我要寻找的效果的一个很好的例子可以在这里找到:.还要考虑 XYSplineRenderer ,在此处引用,并在http://www.highcharts.com/demo/line-basic

Notice how the lines are animated between plot points.

I'm currently using the inbuilt XYLineChart for my graphs.

Is there a simple (or existing) way to achieve this effect, or will I have to dig deep into the library to implement these changes manually?

解决方案

In this example, the process() implementation of a SwingWorker updates an XYSeries using values sent via the background thread's publish() method. The enclosing ChartPanel listens to the chart and updates itself in response.

If the calculation has no significant latency, use javax.swing.Timer, as shown here.

Addendum: What I'm looking for is a smooth animation of the line between each plot point.

There is no general substitute for the absence of data, but you can add points from a known function or interpolate based on existing data. Also consider XYSplineRenderer, cited here and seen here.

这篇关于JFreeChart折线图上的动画图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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