如何在JFreeChart中更新图表? [英] How to update a chart in JFreeChart?

查看:152
本文介绍了如何在JFreeChart中更新图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个合并的XYPlot和一个下拉列表。我想根据下拉列表中的用户输入更新我的图表。这该怎么做?
我尝试了以下代码

I have a combinedXYPlot and a drop-down list. I want to update my chart based on user input from drop-down. How to do this? I tried the following code

frmJPanel.getContentPane().removeAll();

frmJPanel.setLayout(new BorderLayout());

initChart(option);

frmJPanel.repaint();

只有在我最小化/最大化窗口后才会反映这些变化。需要调用的函数是什么?有什么更好的方法呢?

The changes are reflected only after I minimize/ maximize the window. What is the function that needs to be called? What is the better way to do this ?

推荐答案

ChartPanel 向图表注册以接收更改通知到图表的任何组成部分。收到通知后,图表会自动重新绘制。有一些例子这里此处

这篇关于如何在JFreeChart中更新图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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