/**
*
*/
package com.struts2.jfreechart;import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;/**
* @author 谌纪超
*
*/
public class JFreeChartDemo { /**
* @param args
*/
public static void main(String[] args) { // 生成饼图的数据集对象
DefaultPieDataset dpd = new DefaultPieDataset(); // 向数据集中添加数据
dpd.setValue("计算机网络", 36);
dpd.setValue("计算机应用", 43);
dpd.setValue("计算机多媒体", 60);
dpd.setValue("计算机智能", 27); // 创建饼图
JFreeChart chart = ChartFactory.createPieChart("某学校信息工程系各个专业的人数比例",
dpd, true, true, false); // 创建一个Swing框架
ChartFrame frame = new ChartFrame("清华大学", chart); // 设置框架的自适应大小
frame.pack(); // 设置可见
frame.setVisible(true); }}
*
*/
package com.struts2.jfreechart;import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;/**
* @author 谌纪超
*
*/
public class JFreeChartDemo { /**
* @param args
*/
public static void main(String[] args) { // 生成饼图的数据集对象
DefaultPieDataset dpd = new DefaultPieDataset(); // 向数据集中添加数据
dpd.setValue("计算机网络", 36);
dpd.setValue("计算机应用", 43);
dpd.setValue("计算机多媒体", 60);
dpd.setValue("计算机智能", 27); // 创建饼图
JFreeChart chart = ChartFactory.createPieChart("某学校信息工程系各个专业的人数比例",
dpd, true, true, false); // 创建一个Swing框架
ChartFrame frame = new ChartFrame("清华大学", chart); // 设置框架的自适应大小
frame.pack(); // 设置可见
frame.setVisible(true); }}
解决方案 »
- 求解,jtable使用问题。
- 单核有线程同步吗 多核肯定有线程同步吧 详细一点 谢谢
- 求一段文件处理代码
- 急求助!
- 字符串替换的简单问题
- 有两个Dialog,Dialog1和Dialog2,在Dialog1中我写了这样一句话Dialog2 dialog2 = new Dialog2(this,"",true),后来发现不对,因为this代表D
- 100分相求一个JTable使用的例子(详细一点),我做的JTable怎么不能显示呢?谢谢!!!
- 内部内不可拥有static数据或static 内部内!!!!!!!!!
- 各位学java的都用什么数据库啊?给点建议,来者有分:)
- 需要VisualAge for Java的企业版?
- Java放大图片
- javax.mail.MessagingException: Connection dropped by server?;错误怎么解决
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.chart.plot.PiePlot;
import java.awt.Font;/**
* @author 谌纪超
*
*/
public class JFreeChartDemo { /**
* @param args
*/
public static void main(String[] args) { // 生成饼图的数据集对象
DefaultPieDataset dpd = new DefaultPieDataset(); // 向数据集中添加数据
dpd.setValue("计算机网络", 36);
dpd.setValue("计算机应用", 43);
dpd.setValue("计算机多媒体", 60);
dpd.setValue("计算机智能", 27); // 创建饼图
JFreeChart chart = ChartFactory.createPieChart("某学校信息工程系各个专业的人数比例",
dpd, true, true, false);
Font font = new Font("SimSun", 10, 20);
chart.getTitle().setFont(font);
chart.getLegend().setItemFont(font);
((PiePlot)chart.getPlot()).setLabelFont(font); // 创建一个Swing框架
ChartFrame frame = new ChartFrame("清华大学", chart); // 设置框架的自适应大小
frame.pack(); // 设置可见
frame.setVisible(true); }}
是他应用JFREECHART时候出现的乱码
肯定在他的饼图显示的时候有~~
JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, // chart
// title
dataset,// data
true,// include legend
true, false);
//设置上标题
chart.getTitle().setFont(new Font("黑体", Font.PLAIN, 20));
//设置下标题
chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));