在JPanel中添加一个JFreeChart [英] Add a JFreeChart in to JPanel

查看:130
本文介绍了在JPanel中添加一个JFreeChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有我的Jpanel和我的JFreeChart.如何将此图表添加到JPanel中?

if i have a my Jpanel and a my JFreeChart. How can I add this Chart in to the JPanel?

XYSeries series = new XYSeries("XYGraph");
   series.add(1, 1);
   series.add(1, 2);
   series.add(2, 1);
   series.add(3, 9);
   series.add(4, 10);

// Add the series to your data set
   XYSeriesCollection dataset = new XYSeriesCollection();
   dataset.addSeries(series);

// Generate the graph
   JFreeChart chart = ChartFactory.createXYLineChart(
   "XY Chart", // Title
   "x-axis", // x-axis Label
   "y-axis", // y-axis Label
   dataset, // Dataset
   PlotOrientation.VERTICAL, // Plot Orientation
   true, // Show Legend
   true, // Use tooltips
   false // Configure chart to generate URLs?
);

现在,如何在JPanle中添加图表?

and now, how can i add chart in my JPanle?

推荐答案

来自旧的 查看全文

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