📄 linechartstreaming.java
字号:
package cn.com.fcsoft.chart.examples;
import cn.com.fcsoft.chart.*;
import java.awt.*;
import java.awt.event.*;
/**
* This example shows how to use streaming data with the linechart.
* @author meiqi.
*/
public class LineChartStreaming {
public static void main(String[] argv) {
// create the chart
LineChart chart = new LineChart();
chart.setSampleCount(50);
// display the chart
NonFlickerPanel p = new NonFlickerPanel(new BorderLayout());
p.add("Center", chart);
Frame f = new Frame();
f.add("Center", p);
f.setSize(400,200);
f.show();
// continously add data
while (true) {
try {
Thread.sleep(100);
double value = Math.random()*100;
chart.appendSampleValue(0, value, false);
} catch (InterruptedException e) {
// do nothing
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -