实时 Java 图形/图表库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/555804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Real-time Java graph / chart library?
提问by Joonas Pulakka
There was an earlier thread on Java graph or chart library, where JFreeChart was found to be quite good, but, as stated in its FAQ, it's not meant for real-time rendering.
在Java 图形或图表库上有一个较早的线程,发现 JFreeChart 非常好,但是,正如其常见问题解答中所述,它并不用于实时渲染。
Can anyone recommend a comparable library that supports real-time rendering? Just some basic xy-rendering - for instance, getting a voltage signal from data acquisition system and plotting it as it comes (time on x-axis, voltage on y-axis).
谁能推荐一个支持实时渲染的类似库?只是一些基本的 xy 渲染 - 例如,从数据采集系统获取电压信号并在它出现时绘制它(x 轴上的时间,y 轴上的电压)。
采纳答案by kgiannakakis
What the FAQ actually says is that JFreeChart doesn't support hard real-time charting, meaning that the chart isn't updated when new data arrives or at deterministic interval after it. However I have found that JFreeChart can be used for the kind of applications you are describing. You can achieve 1 update per second, which is fine. I don't think a human eye can follow something quicker than this.
FAQ 实际上说的是 JFreeChart 不支持硬实时图表,这意味着图表不会在新数据到达时或之后的确定性时间间隔内更新。但是我发现 JFreeChart 可用于您所描述的应用程序类型。您可以实现每秒 1 次更新,这很好。我不认为人眼可以比这更快地跟踪事物。
If you want something more than this, I doubt you will find anything in Java (or even in another language). Operating Systems that we use aren't designed to be real time. You can't have a guaranty that they will respond in a minimum interval after an event. A tight integration with the hardware driver will be needed to show more than 1-10 frames per second.
如果你想要更多的东西,我怀疑你会在 Java(甚至是另一种语言)中找到任何东西。我们使用的操作系统不是实时设计的。您无法保证他们会在事件发生后的最短时间间隔内做出响应。需要与硬件驱动程序紧密集成才能每秒显示 1-10 帧以上。
However, if you design your application correctly, the OS will do respond quickly and your application can easily display a "real-time" graph (meaning a graph that updates once a second). Just don't use your application to shut down a valve in an emergency situation!
但是,如果您正确设计了应用程序,操作系统会快速响应并且您的应用程序可以轻松显示“实时”图形(即每秒更新一次的图形)。只是不要在紧急情况下使用您的应用程序关闭阀门!
回答by Rahel Lüthy
have a look at processing-- it's an open-source, java-based environment designed for all sorts of animated visualizations.
看看处理——它是一个开源的、基于 Java 的环境,专为各种动画可视化而设计。
回答by TofuBeer
You could dig around the source for NetBeans. The profiler does real time graphing of various things such as memory usage.
您可以挖掘 NetBeans 的源代码。分析器实时绘制各种事物的图形,例如内存使用情况。
回答by Jacek ?awrynowicz
回答by Adeel Ansari
Well, if it has to be Java, then you might want to look into these.
好吧,如果它必须是 Java,那么您可能需要研究这些。
- Java Real-Time Systems(includes demo both real-time and non-real-timem, and JavaFX version of the charting application)
- Real-time Java application development using multicore systems
- Expedited Real-Time Task Graphs(This technology runs on Linux, but development can be done on any platform that supports Java 5.0 and Eclipse.)
- JavaFX - A Pie Chart Demo
- Java 实时系统(包括实时和非实时演示,以及图表应用程序的 JavaFX 版本)
- 使用多核系统进行实时 Java 应用程序开发
- 加速实时任务图(该技术在 Linux 上运行,但可以在支持 Java 5.0 和 Eclipse 的任何平台上进行开发。)
- JavaFX - 饼图演示
回答by the.duckman
Fast enough for real time is swtchart, at least in my experience. Even with lotsof data. Don't be scared away by the version number, yes it is a rather new API, but I use it successfully without problems.
足够快的实时是swtchart,至少根据我的经验。即使有大量数据。不要被版本号吓跑,是的,它是一个相当新的 API,但我成功地使用它没有问题。
As the name implies, it is based on SWT, which uses native OS drawing. Also it does some clever optimizations for drawing fast, like not drawing all points in the dataset (see Large Series Example Snippet).
顾名思义,它基于SWT,它使用原生操作系统绘图。此外,它还对快速绘制进行了一些巧妙的优化,例如不绘制数据集中的所有点(请参阅大系列示例片段)。
回答by Alasdair Scott
You probably have already found a good solution, but if not, I have recently done some work on a framework for producing 2D charts allowing for live updates at a rate of over 50 changes per second.
您可能已经找到了一个很好的解决方案,但如果没有,我最近在用于生成 2D 图表的框架上做了一些工作,允许以每秒 50 多次更改的速度进行实时更新。
The original intention was to mimic the appearance of a chart recorder in a scrolling region of a web page, but I believe the approach has wider application.
最初的目的是在网页的滚动区域模仿图表记录器的外观,但我相信这种方法有更广泛的应用。
A demo can be found at Chart Recorder Demoif anyone is interested.
如果有人感兴趣,可以在Chart Recorder Demo 中找到演示。
The appearance is defined by a template (www.journeylog.co.uk/chart/templates/chartRecorder.xml). One feature is the ability to specify drawing either on the server or in the browser using ExplorerCanvas.
外观由模板 (www.journeylog.co.uk/chart/templates/chartRecorder.xml) 定义。一项功能是能够使用 ExplorerCanvas 在服务器或浏览器中指定绘图。
If anyone is interested I could start an open source project for it.
如果有人感兴趣,我可以为它启动一个开源项目。
回答by weberste
Just stumbled upon a description on how to use the visualvm charting library. Looks very nice!
刚刚偶然发现了关于如何使用visualvm 图表库的描述。看起来很不错!
回答by jobobo
this seems like a good candidate.
这似乎是一个不错的候选人。
http://jchart2d.sourceforge.net/
http://jchart2d.sourceforge.net/
demo:
演示:
回答by xihui
SWT XYGraphcan plot data with your own data provider, so you can create a real time data provider providing live data. With SWTChart and JFreeChart, you have to prepare the whole array for it.
SWT XYGraph可以使用您自己的数据提供者绘制数据,因此您可以创建一个提供实时数据的实时数据提供者。使用 SWTChart 和 JFreeChart,您必须为它准备整个数组。