- 浏览: 46317 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
elf8848:
引用
readonly
不可编辑,可以获得焦点,背景颜色默认 ...
Input的readonly 属性与disabled属性
该资源均来自网络,稍作了整理,以便查询
开发环境:
eclipse Java EE IDE luna
struts2.3.20
maven3.2.5
pom.xml文件依赖配置
web.xml配置
struts.xml配置
相关类:
jsp页面
开发环境:
eclipse Java EE IDE luna
struts2.3.20
maven3.2.5
pom.xml文件依赖配置
<properties> <struts.version>2.3.20</struts.version> </properties> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>${struts.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-jfreechart-plugin</artifactId> <version>${struts.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.7</version> <scope>test</scope> </dependency> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> <version>1.0.13</version> </dependency>
web.xml配置
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="i5ss" version="2.5"> <display-name>Archetype Created Web Application</display-name> <filter> <filter-name>struts-prepare</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> </filter> <filter> <filter-name>struts-execute</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts-prepare</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts-execute</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
struts.xml配置
<package name="jfreechar" namespace="/jfreechart" extends="jfreechart-default"> <action name="pieChart3DAction" class="com.ouanui.PieChart3DAction"> <result type="chart"> <param name="width">700</param> <param name="height">400</param> </result> </action> <action name="lineChartAction" class="com.ouanui.LineChartAction"> <result type="chart"> <param name="width">700</param> <param name="height">400</param> </result> </action> <action name="barChart3DAction" class="com.ouanui.BarChart3DAction"> <result type="chart"> <param name="width">700</param> <param name="height">400</param> </result> </action> </package>
相关类:
package com.ouanui; import java.awt.Font; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryLabelPositions; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.title.LegendTitle; import org.jfree.chart.title.TextTitle; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import com.opensymphony.xwork2.ActionSupport; public class BarChart3DAction extends ActionSupport { private static final long serialVersionUID = -493282687582801540L; private JFreeChart chart; public JFreeChart getChart() { chart = ChartFactory.createBarChart3D("学生成绩分析", "成绩", "人数", getDataset(), PlotOrientation.VERTICAL, true, false, false); chart.setTitle(new TextTitle("学生成绩分析", new Font("黑体", Font.ITALIC, 22))); LegendTitle legend = chart.getLegend(); // 修改图例的字体 legend.setItemFont(new Font("宋体", Font.ITALIC, 14)); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // 取得横轴 CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setLabelFont(new Font("宋体", Font.BOLD, 22)); // 分类标签以45度角倾斜 categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); categoryAxis.setTickLabelFont(new Font("宋体", Font.BOLD, 22)); // 取得纵轴 NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); numberAxis.setLabelFont(new Font("宋体", Font.BOLD, 22)); return chart; } /** * * @return */ private CategoryDataset getDataset() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(2, "1班", "不及格"); dataset.addValue(4, "2班", "不及格"); dataset.addValue(5, "3班", "不及格"); dataset.addValue(8, "1班", "及格"); dataset.addValue(5, "2班", "及格"); dataset.addValue(10, "3班", "及格"); dataset.addValue(15, "1班", "中等"); dataset.addValue(10, "2班", "中等"); dataset.addValue(10, "3班", "中等"); dataset.addValue(15, "1班", "良好"); dataset.addValue(15, "2班", "良好"); dataset.addValue(15, "3班", "良好"); dataset.addValue(5, "1班", "优秀"); dataset.addValue(5, "2班", "优秀"); dataset.addValue(5, "3班", "优秀"); return dataset; } public void setChart(JFreeChart chart) { this.chart = chart; } }
package com.ouanui; import java.awt.Font; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.title.LegendTitle; import org.jfree.chart.title.TextTitle; import org.jfree.data.time.Month; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.xy.XYDataset; import com.opensymphony.xwork2.ActionSupport; public class LineChartAction extends ActionSupport { private static final long serialVersionUID = 1L; private JFreeChart chart; public JFreeChart getChart() { // title: // timeAxisLabel: // valueAxisLabel // dataset // legend:如果设置为 false,则在jsp页面不展示 // tooltips // urls chart = ChartFactory.createTimeSeriesChart("水果销量统计图", "水果", "销量", getDataSet(), true, false, false); // 重新设置图标标题,改变字体 chart.setTitle(new TextTitle("水果销量统计图", new Font("黑体", Font.ITALIC, 22))); // 取得统计图标的第一个图例 LegendTitle legend = chart.getLegend(0); // 修改图例的字体 legend.setItemFont(new Font("宋体", Font.BOLD, 14)); XYPlot plot = (XYPlot) chart.getPlot(); // 取得横轴 ValueAxis categoryAxis = plot.getDomainAxis(); // 设置横轴显示标签的字体 categoryAxis.setLabelFont(new Font("宋体", Font.BOLD, 22)); // x轴坐标样式 categoryAxis.setTickLabelFont(new Font("宋体", Font.BOLD, 10)); // 取得纵轴 NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); // 设置纵轴显示标签的字体 numberAxis.setLabelFont(new Font("宋体", Font.BOLD, 22)); // // 显示y轴0值 // numberAxis.setAutoRangeIncludesZero(true); // 设置y轴取值范围 numberAxis.setRange(0, 5000); return chart; } public void setChart(JFreeChart chart) { this.chart = chart; } // 返回一个CategoryDataset实例 private static XYDataset getDataSet() { TimeSeries apple = new TimeSeries("苹果", null, null); apple.add(new Month(10, 2007), 3900); apple.add(new Month(11, 2007), 900); apple.add(new Month(12, 2007), 2500); apple.add(new Month(1, 2008), 3900); apple.add(new Month(2, 2008), 2000); apple.add(new Month(3, 2008), 3300); TimeSeries orange = new TimeSeries("桔子", null, null); orange.add(new Month(10, 2007), 3300); orange.add(new Month(11, 2007), 2680); orange.add(new Month(12, 2007), 2000); orange.add(new Month(1, 2008), 1900); orange.add(new Month(2, 2008), 2000); orange.add(new Month(3, 2008), 2300); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(apple); dataset.addSeries(orange); return dataset; } }
package com.ouanui; import java.awt.Font; import java.text.DecimalFormat; import java.text.NumberFormat; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.labels.StandardPieSectionLabelGenerator; import org.jfree.chart.plot.PiePlot3D; import org.jfree.chart.title.LegendTitle; import org.jfree.chart.title.TextTitle; import org.jfree.data.general.DefaultPieDataset; import com.opensymphony.xwork2.ActionSupport; public class PieChart3DAction extends ActionSupport { private static final long serialVersionUID = 2375583709245146510L; private JFreeChart chart; public JFreeChart getChart() { chart = ChartFactory.createPieChart3D("学生成绩分析", getDataset(), true, false, false); chart.setTitle(new TextTitle("学生成绩分析", new Font("黑体", Font.ITALIC, 22))); LegendTitle legend = chart.getLegend(); legend.setItemFont(new Font("宋体", Font.ITALIC, 14)); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelFont(new Font("隶书", Font.ITALIC, 18)); // 设定背景透明度(0-1.0之间) plot.setBackgroundAlpha(0.9f); // 设定前景透明度(0-1.0之间) plot.setForegroundAlpha(0.50f); String unitStyle = "{0}={1}({2})"; // 设置图例显示样式 plot.setLabelGenerator(new StandardPieSectionLabelGenerator(unitStyle, NumberFormat.getNumberInstance(), new DecimalFormat("0.00%"))); // 设置引用标签显示样式 plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(unitStyle, NumberFormat .getNumberInstance(), new DecimalFormat("0.00%"))); return chart; } public void setChart(JFreeChart chart) { this.chart = chart; } private DefaultPieDataset getDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("不及格", 2); dataset.setValue("及格", 8); dataset.setValue("中等", 15); dataset.setValue("良好", 15); dataset.setValue("优秀", 5); dataset.setValue("优秀1", 5); return dataset; } }
jsp页面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!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> <img alt="" src="jfreechart/pieChart3DAction" style="margin: auto;"> <br /> <img alt="" src="jfreechart/lineChartAction" style="margin: auto;"> <br /> <img alt="" src="jfreechart/barChart3DAction" style="margin: auto;"> <br /> </body> </html>
发表评论
-
strusts2.0+servlet
2015-06-19 21:26 0在struts2.0中加入servlet -
JFreeChart 学习(1)-获取图片
2015-06-19 21:35 706jfreechart版本:1.0.13 maven依赖配置: ... -
js 计算特殊字符CRLF
2012-03-28 15:48 0js计算CRLF长度为1还是为2? -
linux 下 jboss7的安装
2011-12-31 09:22 0linux 下 jboss7的安装 环境: linux 2.6 ... -
maven 体验
2011-12-22 13:59 0使用maven管理web项目尝试 开发环境: win7, c ... -
eclise导入已存在工程报 Faceted Project Problem 错误
2011-11-01 17:42 4134现象: 向eclipse里面导入已存在工程时,报如下错误: ... -
eclipse3.6 在 tomcat6上部署web应用
2011-08-18 14:43 0本文做为一个简单练习总结,探索一个简单web工程从创建到部署的 ... -
eclipse 之 scrapbook
2011-08-06 08:37 1280eclipse 之 scrapbook 在日常的 ... -
eclipse添加findbugs plugin
2011-08-06 08:09 1019eclipse添加findbug plugin Eclips ... -
eclipse添加打开文件夹资源快捷方式
2011-08-05 08:59 1671eclipse添加打开文件夹资源快捷方式 在eclipse ... -
支持IE及FIRFOX 添加连接到收藏夹的简易操作
2011-07-21 09:55 1133支持IE及FIRFOX 添加连接到收藏夹的简易操作 ... -
使用jquery及javascript实现文本滚动效果
2011-07-15 17:22 1466使用jquery及javascript实现文本滚动效果 ... -
eclipse3.2.2 整合 weblogic81
2011-07-13 11:28 0eclipse3.2.2 整合 weblogic8.1 -
修改eclipse启动jdk版本
2011-07-13 10:49 0修改eclipse启动jdk版本 1.eclipse3.3 ... -
velocity中使用jquery出现的问题
2011-07-07 12:45 2290velocity中使用jquery: 代码: <!D ... -
Ajax学习笔记(一)
2010-08-05 01:21 818功能 1、使用ajax实现分页功能 一、概念 二、使用到的技 ... -
jquery学习笔记(一)
2010-07-12 15:46 0实现功能: 通过ajax、json从后台查询数 ... -
log4j学习笔记(二)
2010-07-12 12:47 848二、通过配置文件输出日志 1.配置log4j.xml & ... -
log4j学习笔记(一)
2010-07-08 15:07 771一、代码中实现,实现把日志输出到控制台和文件 packag ... -
Input的readonly 属性与disabled属性
2010-07-06 10:48 8654readonly 不可编辑,可以获得焦点,背景颜色默认灰色,值 ...
相关推荐
struts2-jfreechart-plugin-2.1.8.1.jar
struts2-jfreechart-plugin-2.0.11.jarstruts2-jfreechart-plugin-2.0.11.jarstruts2-jfreechart-plugin-2.0.11.jar
struts2-jfreechart-plugin-2.0.8.jar
struts2-jfreechart-plugin-2.1.6.jar
struts2-jfreechart-plugin-2.3.4.1.jar
这是一个获取用户信息的投票系统,包含需求及代码,可以了解投票系统的基本需求,如何分析和设计数据库、使用JSP +JavaBean+Struts2+JDBC+JFreeChart进行开发、学会MySQL数据库的基本使用、使用JFreeChart画柱状图、...
struts2-jfreechart-plugin-2.1.8.1
最新官方struts2-plugin jfreechart,分享于有需要的朋友
jcommon-1.0.13.jar+jfreechart-1.0.13.jar jcommon-1.0.13.jar+jfreechart-1.0.13.jar jcommon-1.0.13.jar+jfreechart-1.0.13.jar jcommon-1.0.13.jar+jfreechart-1.0.13.jar 用strust2做报表时画图
struts2 结合强大的图形报表开发包进行集成开发,能够降低系统的耦合和灵活的报表开发方式,展现不同的图形化报表,给企业带来更加精美的报表解决方案。
jfreechart-1.0.0-pre2-install.pdf
struts2整合jfreechart 的工具jar文件 struts2-jfreechart-plugin-2.3.15.3.jar
jfreechart-1.0.6-demo源码
jfreechart-1.0.14.zip中包含jfreechart-1.0.14-demo.jar所对应的源码。
jfreechart-1.0.14-swt.jar
demo.jar(java 环境下点击就可以查看) 包含jar包 jfreechart-1.0.19.jar,jfreechart-1.0.19-swt.jar,jcommon-1.0.23.jar,junit-4.11等,具体项目中需要哪些jar 包 https://mvnrepository.com/ 可在maven 仓库...
jfreechart-1.0.19-demo.src 示例中源码
jfreechart-1.0.19压缩包中有一个jfreechart-1.0.19-demo.jar,里面演示了各种图表的制作案例,包括BarChart、LineChart、PieChart、TimeSeriesChart、XYSeries等等,共309个例子,现开放源码,请各位下载,欢迎交流...
jfreechart-0.9.21的jar包和jfreechart-0.9.21-demo
图形 jfreechart-1.0.13-swt.jar