- 浏览: 11116 次
- 性别:
- 来自: 南京
文章分类
最新评论
jreechart - (5)TimeSeriesChart时序图
生成时序图:
Java代码 收藏代码
1. JFreeChart chart = ChartFactory.createTimeSeriesChart(
2. String title, // 图标题
3. String timeAxisLabel, //x 轴标题
4. String valueAxisLabel, //y 轴标题
5. XYDataset dataset, // 数据源
6. boolean legend, // 是否显示图例
7. boolean tooltips, // 是否显示 tooltip
8. boolean urls); // 是否指定 url
JFreeChart chart = ChartFactory.createTimeSeriesChart(
String title, // 图标题
String timeAxisLabel, //x 轴标题
String valueAxisLabel, //y 轴标题
XYDataset dataset, // 数据源
boolean legend, // 是否显示图例
boolean tooltips, // 是否显示 tooltip
boolean urls); // 是否指定 url
时序图的 Plot 对象是 XYPlot 类型。 XYPlot 对象的 x 轴是 DateAxis 对象, y 轴是 NumberAxis 对象,绘制单元是 XYLineAndShapeRenderer 对象,数据源是 XYDataset 对象。
Java代码 收藏代码
1. //Plot 对象的获取操作:
2. XYPlot plot = (XYPlot) chart.getPlot();
3. //X 轴对象的获取操作:
4. DateAxis xAxis = (DateAxis) plot.getDomainAxis();
5. //Y 轴对象的获取操作:
6. NumberAxis yAxis =(NumberAxis) plot.getRangeAxis();
7. //Renderer 对象的获取操作:
8. XYItemRenderer renderer= plot.getRenderer();
//Plot 对象的获取操作:
XYPlot plot = (XYPlot) chart.getPlot();
//X 轴对象的获取操作:
DateAxis xAxis = (DateAxis) plot.getDomainAxis();
//Y 轴对象的获取操作:
NumberAxis yAxis =(NumberAxis) plot.getRangeAxis();
//Renderer 对象的获取操作:
XYItemRenderer renderer= plot.getRenderer();
时序图可以接受一切 XYDataset 类型的数据源,下面讲解一下常用的 XYDataset 类型 TimeSeriesCollection 的使用方式。
Java代码 收藏代码
1. //实例化:
2. TimeSeriesCollection dataset=new TimeSeriesCollection();
3. //添加数据操作:
4. dataset. addSeries(TimeSeries); // 后面讲解 TimeSeries 对象
5. //删除数据操作:
6. dataset. removeSeries(int index);
7. //查询数据操作 :
8. dataset. getSeries(int series);
//实例化:
TimeSeriesCollection dataset=new TimeSeriesCollection();
//添加数据操作:
dataset. addSeries(TimeSeries); // 后面讲解 TimeSeries 对象
//删除数据操作:
dataset. removeSeries(int index);
//查询数据操作 :
dataset. getSeries(int series);
TimeSeries 对象操作
Java代码 收藏代码
1. //实例化:
2. TimeSeries ts=TimeSeries(String name, Class timePeriodClass);
3. //增加数据操作:
4. ts. add(RegularTimePeriod period, double value);
5. //删除数据操作:
6. ts. delete(RegularTimePeriod period);
7. //修改数据操作:
8. ts. update(RegularTimePeriod period, Number value);
9. //查询数据操作:
10. ts. getValue(RegularTimePeriod period);
//实例化:
TimeSeries ts=TimeSeries(String name, Class timePeriodClass);
//增加数据操作:
ts. add(RegularTimePeriod period, double value);
//删除数据操作:
ts. delete(RegularTimePeriod period);
//修改数据操作:
ts. update(RegularTimePeriod period, Number value);
//查询数据操作:
ts. getValue(RegularTimePeriod period);
类 RegularTimePeriod 是 JFreeChart 提供的时间模板类,它有很多具体的时间类,比如: Minute 、 Second 、 Hour 、 Day…… 等,不再详述
Java代码 收藏代码
1. package com.px1987.jfreechart;
2.
3. import java.awt.Color;
4. import org.jfree.chart.ChartFactory;
5. import org.jfree.chart.ChartFrame;
6. import org.jfree.chart.JFreeChart;
7. import org.jfree.chart.plot.XYPlot;
8. import org.jfree.chart.renderer.xy.XYItemRenderer;
9. import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
10. import org.jfree.data.time.Day;
11. import org.jfree.data.time.Hour;
12. import org.jfree.data.time.Minute;
13. import org.jfree.data.time.TimeSeries;
14. import org.jfree.data.time.TimeSeriesCollection;
15. import org.jfree.data.xy.XYDataset;
16. import org.jfree.ui.RectangleInsets;
17.
18. public class TestTimeSeriesChart {
19.
20. private static XYDataset createDataset() {
21. TimeSeriesCollection dataset = new TimeSeriesCollection();
22. Day day = new Day(21, 9, 2008);
23. Hour hour22 = new Hour(22, day);
24. Hour hour23 = new Hour(23, day);
25.
26. TimeSeries timeSeries1 = new TimeSeries("篮球火", Minute.class);
27. timeSeries1.add(new Minute(25, hour23), 2.80);
28. timeSeries1.add(new Minute(22, hour23), 2.59);
29. timeSeries1.add(new Minute(32, hour22), 2.38);
30. timeSeries1.add(new Minute(14, hour22), 2.35);
31. timeSeries1.add(new Minute(18, hour23), 2.34);
32. timeSeries1.add(new Minute(57, hour23), 2.31);
33. timeSeries1.add(new Minute(14, hour23), 2.28);
34. timeSeries1.add(new Minute(23, hour22), 2.25);
35. timeSeries1.add(new Minute(46, hour22), 2.16);
36. timeSeries1.add(new Minute(40, hour22), 2.16);
37. timeSeries1.add(new Minute(6, hour22), 1.95);
38. timeSeries1.add(new Minute(51, hour22), 1.93);
39. timeSeries1.add(new Minute(2, hour23), 1.86);
40. timeSeries1.add(new Minute(6, hour23), 1.84);
41. timeSeries1.add(new Minute(9, hour23), 1.79);
42. timeSeries1.add(new Minute(29, hour23), 1.72);
43.
44. TimeSeries timeSeries2 = new TimeSeries("无敌珊宝妹", Minute.class);
45. timeSeries2.add(new Minute(36, hour22), 3.63);
46. timeSeries2.add(new Minute(55, hour22), 3.63);
47. timeSeries2.add(new Minute(21, hour23), 3.36);
48. timeSeries2.add(new Minute(30, hour22), 3.28);
49. timeSeries2.add(new Minute(33, hour23), 3.18);
50. timeSeries2.add(new Minute(6, hour23), 3.13);
51. timeSeries2.add(new Minute(13, hour22), 3.05);
52. timeSeries2.add(new Minute(0, hour23), 2.98);
53. timeSeries2.add(new Minute(40, hour22), 2.98);
54. timeSeries2.add(new Minute(48, hour22), 2.91);
55. timeSeries2.add(new Minute(14, hour23), 2.73);
56. timeSeries2.add(new Minute(27, hour23), 2.59);
57. timeSeries2.add(new Minute(38, hour23), 2.37);
58.
59. TimeSeries timeSeries3 = new TimeSeries("不良笑花", Minute.class);
60. timeSeries3.add(new Minute(8, hour23), 2.84);
61. timeSeries3.add(new Minute(29, hour22), 2.51);
62. timeSeries3.add(new Minute(56, hour22), 2.23);
63. timeSeries3.add(new Minute(5, hour23), 2.17);
64. timeSeries3.add(new Minute(47, hour22), 2.10);
65. timeSeries3.add(new Minute(17, hour22), 1.86);
66. timeSeries3.add(new Minute(24, hour23), 1.84);
67. timeSeries3.add(new Minute(5, hour22), 1.84);
68. timeSeries3.add(new Minute(15, hour23), 1.73);
69. timeSeries3.add(new Minute(36, hour22), 1.46);
70.
71. dataset.addSeries(timeSeries1);
72. dataset.addSeries(timeSeries2);
73. dataset.addSeries(timeSeries3);
74. return dataset;
75. }
76.
77. public static void createTimeSeriesChart() {
78. JFreeChart timeSeriesChart = ChartFactory.createTimeSeriesChart(
79. "台湾偶像剧收视率(2008-9-21)", "播放时间", "收视率百分点", createDataset(), true,
80. true, false);
81. timeSeriesChart.setBackgroundPaint(Color.YELLOW);
82. XYPlot plot = timeSeriesChart.getXYPlot();
83. setXYPolt(plot);
84.
85. ChartFrame frame = new ChartFrame("TestPieChart", timeSeriesChart);
86. frame.pack();
87. frame.setVisible(true);
88. }
89.
90. public static void setXYPolt(XYPlot plot) {
91. plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
92. plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
93. // plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
94. XYItemRenderer r = plot.getRenderer();
95. if (r instanceof XYLineAndShapeRenderer) {
96. XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
97. renderer.setBaseShapesVisible(true);
98. renderer.setBaseShapesFilled(false);
99. }
100. }
101.
102. public static void main(String[] args) {
103. createTimeSeriesChart();
104. }
105.
106. }
package com.px1987.jfreechart;
import java.awt.Color;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.time.Day;
import org.jfree.data.time.Hour;
import org.jfree.data.time.Minute;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.RectangleInsets;
public class TestTimeSeriesChart {
private static XYDataset createDataset() {
TimeSeriesCollection dataset = new TimeSeriesCollection();
Day day = new Day(21, 9, 2008);
Hour hour22 = new Hour(22, day);
Hour hour23 = new Hour(23, day);
TimeSeries timeSeries1 = new TimeSeries("篮球火", Minute.class);
timeSeries1.add(new Minute(25, hour23), 2.80);
timeSeries1.add(new Minute(22, hour23), 2.59);
timeSeries1.add(new Minute(32, hour22), 2.38);
timeSeries1.add(new Minute(14, hour22), 2.35);
timeSeries1.add(new Minute(18, hour23), 2.34);
timeSeries1.add(new Minute(57, hour23), 2.31);
timeSeries1.add(new Minute(14, hour23), 2.28);
timeSeries1.add(new Minute(23, hour22), 2.25);
timeSeries1.add(new Minute(46, hour22), 2.16);
timeSeries1.add(new Minute(40, hour22), 2.16);
timeSeries1.add(new Minute(6, hour22), 1.95);
timeSeries1.add(new Minute(51, hour22), 1.93);
timeSeries1.add(new Minute(2, hour23), 1.86);
timeSeries1.add(new Minute(6, hour23), 1.84);
timeSeries1.add(new Minute(9, hour23), 1.79);
timeSeries1.add(new Minute(29, hour23), 1.72);
TimeSeries timeSeries2 = new TimeSeries("无敌珊宝妹", Minute.class);
timeSeries2.add(new Minute(36, hour22), 3.63);
timeSeries2.add(new Minute(55, hour22), 3.63);
timeSeries2.add(new Minute(21, hour23), 3.36);
timeSeries2.add(new Minute(30, hour22), 3.28);
timeSeries2.add(new Minute(33, hour23), 3.18);
timeSeries2.add(new Minute(6, hour23), 3.13);
timeSeries2.add(new Minute(13, hour22), 3.05);
timeSeries2.add(new Minute(0, hour23), 2.98);
timeSeries2.add(new Minute(40, hour22), 2.98);
timeSeries2.add(new Minute(48, hour22), 2.91);
timeSeries2.add(new Minute(14, hour23), 2.73);
timeSeries2.add(new Minute(27, hour23), 2.59);
timeSeries2.add(new Minute(38, hour23), 2.37);
TimeSeries timeSeries3 = new TimeSeries("不良笑花", Minute.class);
timeSeries3.add(new Minute(8, hour23), 2.84);
timeSeries3.add(new Minute(29, hour22), 2.51);
timeSeries3.add(new Minute(56, hour22), 2.23);
timeSeries3.add(new Minute(5, hour23), 2.17);
timeSeries3.add(new Minute(47, hour22), 2.10);
timeSeries3.add(new Minute(17, hour22), 1.86);
timeSeries3.add(new Minute(24, hour23), 1.84);
timeSeries3.add(new Minute(5, hour22), 1.84);
timeSeries3.add(new Minute(15, hour23), 1.73);
timeSeries3.add(new Minute(36, hour22), 1.46);
dataset.addSeries(timeSeries1);
dataset.addSeries(timeSeries2);
dataset.addSeries(timeSeries3);
return dataset;
}
public static void createTimeSeriesChart() {
JFreeChart timeSeriesChart = ChartFactory.createTimeSeriesChart(
"台湾偶像剧收视率(2008-9-21)", "播放时间", "收视率百分点", createDataset(), true,
true, false);
timeSeriesChart.setBackgroundPaint(Color.YELLOW);
XYPlot plot = timeSeriesChart.getXYPlot();
setXYPolt(plot);
ChartFrame frame = new ChartFrame("TestPieChart", timeSeriesChart);
frame.pack();
frame.setVisible(true);
}
public static void setXYPolt(XYPlot plot) {
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
// plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
renderer.setBaseShapesVisible(true);
renderer.setBaseShapesFilled(false);
}
}
public static void main(String[] args) {
createTimeSeriesChart();
}
}
效果图
文章来源:
http://sktoo.iteye.com/blog/249123
Java代码 收藏代码
1. JFreeChart chart = ChartFactory.createTimeSeriesChart(
2. String title, // 图标题
3. String timeAxisLabel, //x 轴标题
4. String valueAxisLabel, //y 轴标题
5. XYDataset dataset, // 数据源
6. boolean legend, // 是否显示图例
7. boolean tooltips, // 是否显示 tooltip
8. boolean urls); // 是否指定 url
JFreeChart chart = ChartFactory.createTimeSeriesChart(
String title, // 图标题
String timeAxisLabel, //x 轴标题
String valueAxisLabel, //y 轴标题
XYDataset dataset, // 数据源
boolean legend, // 是否显示图例
boolean tooltips, // 是否显示 tooltip
boolean urls); // 是否指定 url
时序图的 Plot 对象是 XYPlot 类型。 XYPlot 对象的 x 轴是 DateAxis 对象, y 轴是 NumberAxis 对象,绘制单元是 XYLineAndShapeRenderer 对象,数据源是 XYDataset 对象。
Java代码 收藏代码
1. //Plot 对象的获取操作:
2. XYPlot plot = (XYPlot) chart.getPlot();
3. //X 轴对象的获取操作:
4. DateAxis xAxis = (DateAxis) plot.getDomainAxis();
5. //Y 轴对象的获取操作:
6. NumberAxis yAxis =(NumberAxis) plot.getRangeAxis();
7. //Renderer 对象的获取操作:
8. XYItemRenderer renderer= plot.getRenderer();
//Plot 对象的获取操作:
XYPlot plot = (XYPlot) chart.getPlot();
//X 轴对象的获取操作:
DateAxis xAxis = (DateAxis) plot.getDomainAxis();
//Y 轴对象的获取操作:
NumberAxis yAxis =(NumberAxis) plot.getRangeAxis();
//Renderer 对象的获取操作:
XYItemRenderer renderer= plot.getRenderer();
时序图可以接受一切 XYDataset 类型的数据源,下面讲解一下常用的 XYDataset 类型 TimeSeriesCollection 的使用方式。
Java代码 收藏代码
1. //实例化:
2. TimeSeriesCollection dataset=new TimeSeriesCollection();
3. //添加数据操作:
4. dataset. addSeries(TimeSeries); // 后面讲解 TimeSeries 对象
5. //删除数据操作:
6. dataset. removeSeries(int index);
7. //查询数据操作 :
8. dataset. getSeries(int series);
//实例化:
TimeSeriesCollection dataset=new TimeSeriesCollection();
//添加数据操作:
dataset. addSeries(TimeSeries); // 后面讲解 TimeSeries 对象
//删除数据操作:
dataset. removeSeries(int index);
//查询数据操作 :
dataset. getSeries(int series);
TimeSeries 对象操作
Java代码 收藏代码
1. //实例化:
2. TimeSeries ts=TimeSeries(String name, Class timePeriodClass);
3. //增加数据操作:
4. ts. add(RegularTimePeriod period, double value);
5. //删除数据操作:
6. ts. delete(RegularTimePeriod period);
7. //修改数据操作:
8. ts. update(RegularTimePeriod period, Number value);
9. //查询数据操作:
10. ts. getValue(RegularTimePeriod period);
//实例化:
TimeSeries ts=TimeSeries(String name, Class timePeriodClass);
//增加数据操作:
ts. add(RegularTimePeriod period, double value);
//删除数据操作:
ts. delete(RegularTimePeriod period);
//修改数据操作:
ts. update(RegularTimePeriod period, Number value);
//查询数据操作:
ts. getValue(RegularTimePeriod period);
类 RegularTimePeriod 是 JFreeChart 提供的时间模板类,它有很多具体的时间类,比如: Minute 、 Second 、 Hour 、 Day…… 等,不再详述
Java代码 收藏代码
1. package com.px1987.jfreechart;
2.
3. import java.awt.Color;
4. import org.jfree.chart.ChartFactory;
5. import org.jfree.chart.ChartFrame;
6. import org.jfree.chart.JFreeChart;
7. import org.jfree.chart.plot.XYPlot;
8. import org.jfree.chart.renderer.xy.XYItemRenderer;
9. import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
10. import org.jfree.data.time.Day;
11. import org.jfree.data.time.Hour;
12. import org.jfree.data.time.Minute;
13. import org.jfree.data.time.TimeSeries;
14. import org.jfree.data.time.TimeSeriesCollection;
15. import org.jfree.data.xy.XYDataset;
16. import org.jfree.ui.RectangleInsets;
17.
18. public class TestTimeSeriesChart {
19.
20. private static XYDataset createDataset() {
21. TimeSeriesCollection dataset = new TimeSeriesCollection();
22. Day day = new Day(21, 9, 2008);
23. Hour hour22 = new Hour(22, day);
24. Hour hour23 = new Hour(23, day);
25.
26. TimeSeries timeSeries1 = new TimeSeries("篮球火", Minute.class);
27. timeSeries1.add(new Minute(25, hour23), 2.80);
28. timeSeries1.add(new Minute(22, hour23), 2.59);
29. timeSeries1.add(new Minute(32, hour22), 2.38);
30. timeSeries1.add(new Minute(14, hour22), 2.35);
31. timeSeries1.add(new Minute(18, hour23), 2.34);
32. timeSeries1.add(new Minute(57, hour23), 2.31);
33. timeSeries1.add(new Minute(14, hour23), 2.28);
34. timeSeries1.add(new Minute(23, hour22), 2.25);
35. timeSeries1.add(new Minute(46, hour22), 2.16);
36. timeSeries1.add(new Minute(40, hour22), 2.16);
37. timeSeries1.add(new Minute(6, hour22), 1.95);
38. timeSeries1.add(new Minute(51, hour22), 1.93);
39. timeSeries1.add(new Minute(2, hour23), 1.86);
40. timeSeries1.add(new Minute(6, hour23), 1.84);
41. timeSeries1.add(new Minute(9, hour23), 1.79);
42. timeSeries1.add(new Minute(29, hour23), 1.72);
43.
44. TimeSeries timeSeries2 = new TimeSeries("无敌珊宝妹", Minute.class);
45. timeSeries2.add(new Minute(36, hour22), 3.63);
46. timeSeries2.add(new Minute(55, hour22), 3.63);
47. timeSeries2.add(new Minute(21, hour23), 3.36);
48. timeSeries2.add(new Minute(30, hour22), 3.28);
49. timeSeries2.add(new Minute(33, hour23), 3.18);
50. timeSeries2.add(new Minute(6, hour23), 3.13);
51. timeSeries2.add(new Minute(13, hour22), 3.05);
52. timeSeries2.add(new Minute(0, hour23), 2.98);
53. timeSeries2.add(new Minute(40, hour22), 2.98);
54. timeSeries2.add(new Minute(48, hour22), 2.91);
55. timeSeries2.add(new Minute(14, hour23), 2.73);
56. timeSeries2.add(new Minute(27, hour23), 2.59);
57. timeSeries2.add(new Minute(38, hour23), 2.37);
58.
59. TimeSeries timeSeries3 = new TimeSeries("不良笑花", Minute.class);
60. timeSeries3.add(new Minute(8, hour23), 2.84);
61. timeSeries3.add(new Minute(29, hour22), 2.51);
62. timeSeries3.add(new Minute(56, hour22), 2.23);
63. timeSeries3.add(new Minute(5, hour23), 2.17);
64. timeSeries3.add(new Minute(47, hour22), 2.10);
65. timeSeries3.add(new Minute(17, hour22), 1.86);
66. timeSeries3.add(new Minute(24, hour23), 1.84);
67. timeSeries3.add(new Minute(5, hour22), 1.84);
68. timeSeries3.add(new Minute(15, hour23), 1.73);
69. timeSeries3.add(new Minute(36, hour22), 1.46);
70.
71. dataset.addSeries(timeSeries1);
72. dataset.addSeries(timeSeries2);
73. dataset.addSeries(timeSeries3);
74. return dataset;
75. }
76.
77. public static void createTimeSeriesChart() {
78. JFreeChart timeSeriesChart = ChartFactory.createTimeSeriesChart(
79. "台湾偶像剧收视率(2008-9-21)", "播放时间", "收视率百分点", createDataset(), true,
80. true, false);
81. timeSeriesChart.setBackgroundPaint(Color.YELLOW);
82. XYPlot plot = timeSeriesChart.getXYPlot();
83. setXYPolt(plot);
84.
85. ChartFrame frame = new ChartFrame("TestPieChart", timeSeriesChart);
86. frame.pack();
87. frame.setVisible(true);
88. }
89.
90. public static void setXYPolt(XYPlot plot) {
91. plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
92. plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
93. // plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
94. XYItemRenderer r = plot.getRenderer();
95. if (r instanceof XYLineAndShapeRenderer) {
96. XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
97. renderer.setBaseShapesVisible(true);
98. renderer.setBaseShapesFilled(false);
99. }
100. }
101.
102. public static void main(String[] args) {
103. createTimeSeriesChart();
104. }
105.
106. }
package com.px1987.jfreechart;
import java.awt.Color;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.time.Day;
import org.jfree.data.time.Hour;
import org.jfree.data.time.Minute;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.RectangleInsets;
public class TestTimeSeriesChart {
private static XYDataset createDataset() {
TimeSeriesCollection dataset = new TimeSeriesCollection();
Day day = new Day(21, 9, 2008);
Hour hour22 = new Hour(22, day);
Hour hour23 = new Hour(23, day);
TimeSeries timeSeries1 = new TimeSeries("篮球火", Minute.class);
timeSeries1.add(new Minute(25, hour23), 2.80);
timeSeries1.add(new Minute(22, hour23), 2.59);
timeSeries1.add(new Minute(32, hour22), 2.38);
timeSeries1.add(new Minute(14, hour22), 2.35);
timeSeries1.add(new Minute(18, hour23), 2.34);
timeSeries1.add(new Minute(57, hour23), 2.31);
timeSeries1.add(new Minute(14, hour23), 2.28);
timeSeries1.add(new Minute(23, hour22), 2.25);
timeSeries1.add(new Minute(46, hour22), 2.16);
timeSeries1.add(new Minute(40, hour22), 2.16);
timeSeries1.add(new Minute(6, hour22), 1.95);
timeSeries1.add(new Minute(51, hour22), 1.93);
timeSeries1.add(new Minute(2, hour23), 1.86);
timeSeries1.add(new Minute(6, hour23), 1.84);
timeSeries1.add(new Minute(9, hour23), 1.79);
timeSeries1.add(new Minute(29, hour23), 1.72);
TimeSeries timeSeries2 = new TimeSeries("无敌珊宝妹", Minute.class);
timeSeries2.add(new Minute(36, hour22), 3.63);
timeSeries2.add(new Minute(55, hour22), 3.63);
timeSeries2.add(new Minute(21, hour23), 3.36);
timeSeries2.add(new Minute(30, hour22), 3.28);
timeSeries2.add(new Minute(33, hour23), 3.18);
timeSeries2.add(new Minute(6, hour23), 3.13);
timeSeries2.add(new Minute(13, hour22), 3.05);
timeSeries2.add(new Minute(0, hour23), 2.98);
timeSeries2.add(new Minute(40, hour22), 2.98);
timeSeries2.add(new Minute(48, hour22), 2.91);
timeSeries2.add(new Minute(14, hour23), 2.73);
timeSeries2.add(new Minute(27, hour23), 2.59);
timeSeries2.add(new Minute(38, hour23), 2.37);
TimeSeries timeSeries3 = new TimeSeries("不良笑花", Minute.class);
timeSeries3.add(new Minute(8, hour23), 2.84);
timeSeries3.add(new Minute(29, hour22), 2.51);
timeSeries3.add(new Minute(56, hour22), 2.23);
timeSeries3.add(new Minute(5, hour23), 2.17);
timeSeries3.add(new Minute(47, hour22), 2.10);
timeSeries3.add(new Minute(17, hour22), 1.86);
timeSeries3.add(new Minute(24, hour23), 1.84);
timeSeries3.add(new Minute(5, hour22), 1.84);
timeSeries3.add(new Minute(15, hour23), 1.73);
timeSeries3.add(new Minute(36, hour22), 1.46);
dataset.addSeries(timeSeries1);
dataset.addSeries(timeSeries2);
dataset.addSeries(timeSeries3);
return dataset;
}
public static void createTimeSeriesChart() {
JFreeChart timeSeriesChart = ChartFactory.createTimeSeriesChart(
"台湾偶像剧收视率(2008-9-21)", "播放时间", "收视率百分点", createDataset(), true,
true, false);
timeSeriesChart.setBackgroundPaint(Color.YELLOW);
XYPlot plot = timeSeriesChart.getXYPlot();
setXYPolt(plot);
ChartFrame frame = new ChartFrame("TestPieChart", timeSeriesChart);
frame.pack();
frame.setVisible(true);
}
public static void setXYPolt(XYPlot plot) {
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
// plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
renderer.setBaseShapesVisible(true);
renderer.setBaseShapesFilled(false);
}
}
public static void main(String[] args) {
createTimeSeriesChart();
}
}
效果图
文章来源:
http://sktoo.iteye.com/blog/249123
相关推荐
时序图数据集email-Eu-core-temporal。 时序图数据集email-Eu-core-temporal。时序图数据集email-Eu-core-temporal。 时序图数据集email-Eu-core-temporal。时序图数据集email-Eu-core-temporal。时序图数据集email-...
V-by-one信号时序测试是在电视屏幕参匹配性测试中的一项重要环节,特别是在未来电视发展的趋势UDTV(Ultra-Definition Television,超高清电视)中,其信号传输采用了V-by-one数字接口标准。V-by-one技术是一种专门...
Activiti工作流样例-流程执行-动态表单时序图
Activiti工作流样例-流程执行-动态表单时序图
Activiti工作流样例-流程执行-外部表单时序图
主板技嘉M78GM-S2H时序图,手工绘制,相信很多不懂的人都可以通过这个图片做到入门时序
网上购物系统详细精炼版(UML-类图-时序图-数据流图).pdf
《AndyTiming:轻松绘制时序图的利器》 在信息技术领域,时序图是一种重要的建模工具,它用于描述系统中各个对象之间的交互行为,特别是在面向对象设计中扮演着关键角色。时序图展示了对象之间如何按时间顺序进行...
提供了较新的jar包,关于java使用JFreeChart可生成饼图(pie charts)、柱状图(bar charts)、散点图(scatter plots)、时序图(time series)、甘特图(Gantt charts)等等多种图表,并且可以产生PNG和JPEG格式的...
### FPGA中的TimeQuest静态时序分析详解 #### 第一章:TimeQuest静态时序分析模型 **1.1 模型的基础单位** 在本章节中,作者首先介绍了TimeQuest静态时序分析的基本单位。TimeQuest是一款由Cadence公司提供的高级...
本课程【IT十八掌徐培成】专注于Java基础的第18天,主要讲解了使用Rose工具进行UML建模,涉及到了四种关键的UML图表:用例图、类图、时序图和状态图。让我们深入探讨这些概念。 首先,用例图(Use Case Diagram)是...
时序图是软件工程中UML(统一建模语言)的一部分,主要用来描述系统中对象间的交互和消息传递顺序。在电子工程和嵌入式系统设计中,时序图尤其适用于展现单片机(如STM32-F0、F1、F2系列)与其他硬件或软件组件之间...
微机原理与接口技术-82C55时序微机原理与接口技术-82C55时序微机原理与接口技术-82C55时序微机原理与接口技术-82C55时序微机原理与接口技术-82C55时序
5. **自适应刷新率**:根据数据的更新频率,时序图可以调整其刷新率,确保流畅的用户体验而不至于过于繁忙。 6. **多种图表类型**:除了基本的线图,HighCharts还支持柱状图、面积图等多种图表类型,可以根据数据...
登录时序图.png 是一个展示登录过程的时序图。时序图是一种UML(统一建模语言)图,用于说明对象之间的时序和交互。 在这张时序图中,展示了用户登录系统的过程。首先,用户向系统发送登录请求。系统接收到请求后,...
1 MIPS指令译码器设计 2 定长指令周期---时序发生器FSM设计 3 定长指令周期---时序发生器...5 定长指令周期---硬布线控制器设计 6 定长指令周期---单总线CPU设计 全通关(放入logisim可查看电路,改成txt可上传代码)
UML统一建模语言,使用这套工具对系统建模很有帮助。这里着重介绍交互图时序图。
头歌教学实践平台计算机组成原理单总线CPU设计(定长指令周期3级时序)(HUST),第1关—第6关。源代码txt格式。...第5关 定长指令周期---硬布线控制器设计.txt 第6关 定长指令周期---单总线CPU设计.txt
头歌educoder教学实践平台计算机组成原理单总线CPU设计(定长指令周期3级时序)(HUST)。第1关—第6关,源代码txt格式。...第5关 定长指令周期---硬布线控制器设计 第6关 定长指令周期---单总线CPU设计
### UML时序图知识点详解 #### 一、UML时序图概述 **时序图**(Sequence Diagram)是UML(Unified Modeling Language,统一建模语言)中的一种交互图,主要用于展示系统中对象之间的交互关系及其发生的顺序。通过...