当前位置: 代码迷 >> Java Web开发 >> 哪位高手能用JFREECHART1.0.13画出一个简单的柱状,饼状图
  详细解决方案

哪位高手能用JFREECHART1.0.13画出一个简单的柱状,饼状图

热度:2371   发布时间:2013-02-25 21:09:35.0
谁能用JFREECHART1.0.13画出一个简单的柱状,饼状图
我在网上找了一段代码

<%@ page language="java" contentType="text/html; charset=utf-8"
  pageEncoding="utf-8"
import="org.jfree.chart.*"
import="org.jfree.chart.labels.*"
import="org.jfree.chart.plot.*"
import="org.jfree.chart.renderer.category.*"
import="org.jfree.data.category.*"
import="org.jfree.data.general.*"  
import="java.io.*"
import="org.jfree.chart.axis.*"
  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%
DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
String s = "First";
String s1 = "Second";
String s2 = "Third";
String s3 = "Category 1";
String s4 = "Category 2";
String s5 = "Category 3";
String s6 = "Category 4";
String s7 = "Category 5";
  defaultcategorydataset.addValue(1.0D, s, s3);
  defaultcategorydataset.addValue(4D, s, s4);
  defaultcategorydataset.addValue(3D, s, s5);
  defaultcategorydataset.addValue(5D, s, s6);
  defaultcategorydataset.addValue(5D, s, s7);
  defaultcategorydataset.addValue(5D, s1, s3);
  defaultcategorydataset.addValue(7D, s1, s4);
  defaultcategorydataset.addValue(6D, s1, s5);
  defaultcategorydataset.addValue(8D, s1, s6);
  defaultcategorydataset.addValue(4D, s1, s7);
  defaultcategorydataset.addValue(4D, s2, s3);
  defaultcategorydataset.addValue(3D, s2, s4);
  defaultcategorydataset.addValue(2D, s2, s5);
  defaultcategorydataset.addValue(3D, s2, s6);
  defaultcategorydataset.addValue(6D, s2, s7);
   
  JFreeChart jfreechart = ChartFactory.createBarChart("Bar Chart Demo 8", "Category", "Value", defaultcategorydataset, PlotOrientation.VERTICAL, false, true, false);
  CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
  NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis();
  numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  numberaxis.setUpperMargin(0.14999999999999999D);
  CategoryItemRenderer categoryitemrenderer = categoryplot.getRenderer();
  categoryitemrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
  categoryitemrenderer.setSeriesItemLabelsVisible(0, Boolean.TRUE);
  CategoryAxis categoryaxis = categoryplot.getDomainAxis();
  categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
   
OutputStream os = response.getOutputStream();
ChartUtilities.writeChartAsPNG(os,jfreechart, 600, 500, true, 10);

os.flush();
os.close();
os=null;
response.flushBuffer();
out.clear();
out = pageContext.pushBody();
%>
</body>
</html>


Tomcat编译后显示3个错误:


1. variable PlotOrientation cannot resolve symbol

2.class CategoryPlot cannot resolve symbol

3.也是找不到CategoryPlot

怎么都找不到呢?


我就是在官网下了一个jfreechart-1.0.13压缩包,有什么没下载吗



------解决方案--------------------------------------------------------
导包有问题
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Sun Dec 16 07:29:55 CST 2018
  • 最近登录:Sun Dec 16 07:29:55 CST 2018
  • 最近登录:Sun Dec 16 07:29:55 CST 2018
  • 最近登录:Sun Dec 16 07:29:55 CST 2018
  • 最近登录:Sun Dec 16 07:29:55 CST 2018