Jfree图表xy线的实现 [英] Jfree chart xy line implementation

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

问题描述

我想在一个数据集中绘制4行,但我不能。任何一个可以告诉我jfree中需要什么libs,以及我如何在1个图表中实现这些库

I want to plot 4 lines in one dataset but I cannot. Could any1 tell me what libs in need in jfree and how I can implement them in 1 chart

 public void visualise(){
 //visualise data
  XYSeries series = new XYSeries("Membrane mVolt");
XYSeries series2 = new XYSeries("potassium_channel_n_gate_n");
XYSeries series3 = new XYSeries("sodium_channel_h_gate_h");
XYSeries series4 = new XYSeries("sodium_channel_m_gate_m");
//add data to charts
for(int l=0;l<301;l++){
series.add(tData[l], YData[0][l]);
series2.add(tData[l], YData[1][l]);
series3.add(tData[l], YData[2][l]);
series4.add(tData[l], YData[3][l]);
}
//create lines
XYDataset xyDataset = new XYSeriesCollection(series);
XYDataset xyDataset2 = new XYSeriesCollection(series2);
XYDataset xyDataset3 = new XYSeriesCollection(series3);
XYDataset xyDataset4 = new XYSeriesCollection(series4);

//visualize
JFreeChart chart = ChartFactory.createXYLineChart("Membrane", "time","data",xyDataset,       PlotOrientation.VERTICAL, true, true, false);
 JFreeChart chart2 = ChartFactory.createXYLineChart("Potassium Channel n", "time""data",xyDataset2,PlotOrientation.VERTICAL, true, true, false);
 JFreeChart chart3 = ChartFactory.createXYLineChart("Sodium Channel h", "time","data",xyDataset3, PlotOrientation.VERTICAL, true, true, false);
 JFreeChart chart4 = ChartFactory.createXYLineChart("Sodium Channel m", "time", "data",xyDataset4,   
    PlotOrientation.VERTICAL, true, true, false);
//open window
ChartFrame frame1=new ChartFrame(" ",chart);
ChartFrame frame2=new ChartFrame(" ",chart2);
ChartFrame frame3=new ChartFrame(" ",chart3);
ChartFrame frame4=new ChartFrame(" ",chart4);

//make window
frame1.setVisible(true);
frame1.setSize(900,900);
frame2.setVisible(true);
frame2.setSize(900,900);
frame3.setVisible(true);
frame3.setSize(900,900);
frame4.setVisible(true);
frame4.setSize(900,900);
 }


推荐答案

示例显示了如何将多个系列添加到 DefaultXYDataset

This example shows how to add multiple series to a DefaultXYDataset.

这篇关于Jfree图表xy线的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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