- 浏览: 930715 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (423)
- mysql (37)
- hibernate (3)
- struts (9)
- spring (33)
- dom4j (2)
- junit (0)
- exception (1)
- 随笔杂谈 (12)
- google app engine (1)
- XMPP (1)
- OAuth安全授权 (1)
- 版本控制 (8)
- 心情感悟 (0)
- core java (19)
- log4j (7)
- jquery (12)
- javascript (10)
- 网站性能优化及工具 (11)
- 服务器架设配置等 (38)
- EXT (4)
- 正则表达式 (5)
- 日志统计分析 (2)
- htmlparse (4)
- httpclient (5)
- java随笔 (5)
- dhtmlxtree (1)
- freemarke (5)
- memcached (6)
- javamail (5)
- Linux命令 (10)
- 应用监控cpu web jdbc等 (4)
- jmagick (9)
- 第三方缓存策略 (9)
- ORM (2)
- hadoop (2)
- 大数据量处理 (8)
- 经典 (1)
- 权限设计 (1)
- andriod (1)
- mybatis (12)
- redis (24)
- 数据结构_算法 (5)
- 分布式系统 (1)
- php (1)
- 网络编程 (3)
- 服务器部署 (3)
- ios (2)
- IM (23)
- mina (1)
- 视讯和语音 (1)
- 代码生成 (1)
- 架构 (4)
- 建模工具 (1)
- oracle (4)
- solr (10)
- 构建工具 (7)
- html5 (1)
- nginx (5)
- css (1)
- 大数据-分布式 (2)
- 设计模式 (2)
- mq (2)
- jvm调优 (8)
- 并发编程 (2)
- 搜索引擎 (1)
- UML (2)
最新评论
-
天使建站:
jquery获取网页里多选框checkbox选中项的值的方法及 ...
JS jQuery分别获取选中的复选框值 -
abao1:
发现一个小问题 sortAndSave方法中的for循环 第二 ...
完整java实现外部排序 -
西巴拉古呀那:
Kafka分布式消息系统实战(与JavaScalaHadoop ...
消息系统kafka介绍 -
kafodaote:
Kafka分布式消息系统实战(与JavaScalaHadoop ...
消息系统kafka介绍 -
成大大的:
Kafka分布式消息系统实 ...
消息系统kafka介绍
open flash chart with struts2 pie
connext-graphs是struts2的标签,是其可以应用ofc。通过controller控制数据来源,从而显示
open flash chart with struts2 pie 收藏
官网为:http://teethgrinder.co.uk/open-flash-chart/
在 http://www.connext.co.za/下载connext-graphs-0.6.jar (现在是最新版,源代码在https://connext-graphs.dev.java.net/source/browse/connext-graphs/ 用svn 下,不过你要先注册先,它会要求你输入注册名和密码的)
参照struts2-pluign
http://cwiki.apache.org/S2PLUGINS/connext-graph-plugin.html里的做法,把刚才下载的connext-graphs-0.6.jar 放到你的/WEB-INF/lib下,然后就是写action jsp (据说可以用在freemarker了,不过我没有试过)
我的action:
public class GraphAction extends ActionSupport {
private static final long serialVersionUID = -7553677081007831357L;
private String value;
@SuppressWarnings("unchecked")
@Override
public String execute() throws Exception {
OFCGraphController controller = new OFCGraphController();
controller.getTitle().setText("Example 01");
controller.getTitle().setSize(12);
PieLabels pieLabels = new PieLabels();
List<String> colours = new ArrayList<String>();
colours.add("#d01f3c");
colours.add("#356aa0");
colours.add("#C79810");
pieLabels.setColours(colours);
controller.setLabels(pieLabels);
controller.getLabels().setLabels(Arrays.asList(labels));
controller.getYLegend().setText("No. of tasks");
controller.getYLegend().setColor("#8b0000");
controller.getYLegend().setSize(12);
controller.getXLegend().setText("Months");
controller.getXLegend().setColor("#8b0000");
controller.getXLegend().setSize(12);
controller.getColor().getBgColor().setColor("#FFFFFF");
controller.getColor().getXAxisColor().setColor("#e3e3e3");
controller.getColor().getYAxisColor().setColor("#e3e3e3");
controller.getColor().getXGridColor().setColor("#e3e3e3");
controller.getColor().getYGridColor().setColor("#e3e3e3");
DefaultOFCGraphDataModel model = new DefaultOFCGraphDataModel();
model.setData(Arrays.asList(data01));
model.setFormat(new DecimalFormat("###0.000"));
// model.setSeriesType(new OFCLineAreaSeriesType(10,"#8b0000", "Test 2"
// ));
model.setSeriesType(new PieChart(60, "#505050",
"{font-size: 12px; color: #8b0000}"));
controller.add(model);
// model = new DefaultOFCGraphDataModel();
// model.setData(Arrays.asList(data02));
// model.setFormat(new DecimalFormat("###0.000"));
// model.setSeriesType(new OFCLineDotSeriesType(3, "#8b0000", "Test 2",
// 10, 6));
// controller.add(model);
// model = new DefaultOFCGraphDataModel();
// model.setData(Arrays.asList(data03));
// model.setFormat(new DecimalFormat("###0.000"));
// model.setSeriesType(new OFCLineSeriesType(2, "#8b0000", "Example",
// 4));
// controller.add(model);
//
// model = new DefaultOFCGraphDataModel();
// model.setData(Arrays.asList(data04));
// model.setFormat(new DecimalFormat("###0.000"));
// model.setSeriesType(new OFCFilledBarSeriesType(50, "#8b0000",
// "#8b0000", "Filled Bar"));
// controller.add(model);
value = controller.render();
return SUCCESS;
}
private static Double[] data01 = new Double[] { new Double(1.4),
new Double(6.3), new Double(7.2), new Double(4.1), new Double(5.4),
new Double(3.8), new Double(1.5), new Double(4.4), new Double(8.9),
new Double(8.6), new Double(8.7), new Double(2.4), new Double(3.5), };
private static Double[] data02 = new Double[] { new Double(3.5),
new Double(1.4), new Double(2.3), new Double(8.4), new Double(9.6),
new Double(4.4), new Double(3.8), new Double(1.5), new Double(2.8),
new Double(8.3), new Double(5.4), new Double(8.7), new Double(1.4) };
private static Double[] data03 = new Double[] { new Double(13.5),
new Double(11.4), new Double(12.3), new Double(18.4),
new Double(19.6), new Double(14.4), new Double(13.8),
new Double(11.5), new Double(12.8), new Double(18.3),
new Double(15.4), new Double(18.7), new Double(11.4) };
private static Double[] data04 = new Double[] { new Double(13.5),
new Double(11.4), new Double(12.3), new Double(18.4),
new Double(19.6), new Double(14.4), new Double(13.8),
new Double(11.5), new Double(12.8), new Double(18.3),
new Double(15.4), new Double(18.7), new Double(11.4) };
private static String[] labels = new String[] { "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan" };
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
注意蓝色字体:connext-graphs-0.6.jar 这个版本已经实现很多的图形显示
OFCBar3DSeriesType
OFCBarSeriesType
OFCBarSketchSeriesType
OFCFilledBarSeriesType
。。。。。。。。
我就是多说了,自己慢慢试下就知道了。
不过connext-graphs-0.6.jar 还没有实现pie(饼状图),但我要用,所以我自己临时写了个实现Pie的PieChart:
public class PieChart implements OFCSeriesType {
//SET CHART STYPE PIE
public static final String SERIES_TYPE_PIE = "pie";
private int index;
private String type;
private int alpha;
private String line_colour;
//SET DISPLAY STYLE
private String style;
@Override
public int getIndex() {
return index;
}
@Override
public String getType() {
return type = SERIES_TYPE_PIE;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public PieChart(int alpha, String line_colour, String style) {
this.alpha = alpha;
this.line_colour = line_colour;
this.style = style;
}
@Override
public String render() {
String value = "&" + getType();
value = value + "=" + getAlpha() + "," + getLine_colour() + ","
+ getStyle();
value = value + "&\r\n";
return value;
}
public int getAlpha() {
return alpha;
}
public void setAlpha(int alpha) {
this.alpha = alpha;
}
public String getLine_colour() {
return line_colour;
}
public void setLine_colour(String line_colour) {
this.line_colour = line_colour;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
}
还有就是 PieLabels
public class PieLabels extends OFCGraphLabels {
//set display type pie
public static final String myPieGraphLabels = "pie_labels";
//set display colours
public static final String myPieColours = "colours";
//TODO SET LIST
private List<String> colours;
private List labels = new ArrayList();
public void setLabels(List labels) {
this.labels = labels;
}
public void clear() {
this.labels.clear();
}
public void add(String label) {
this.labels.add(label);
}
/**
* @see za.co.connext.web.components.OFCRenderer#render()
*/
public String render() {
String value = "&" + myPieGraphLabels + "=";
for (int i = 0; i < this.labels.size(); i++) {
if (i > 0)
value = value + ",";
Object x = this.labels.get(i);
if (x != null) {
value = value + x.toString();
}
}
value = value + "&\r\n";
// set colours
value = value + "&" + myPieColours + "=";
for (String str : getColours()) {
value = value+str + ",";
}
value = value + "&\r\n";
return value;
}
public List<String> getColours() {
return colours;
}
public void setColours(List<String> colours) {
this.colours = colours;
}
}
写两个jsp页面:in.jsp result.jsp
in.jsp
<%@ taglib prefix="m" uri="/connext"%>
<m:graph id="graph" width="800" height="300" align="middle"
bgcolor="#FFFFFF" url="/Graph_example.action" />
result.jsp
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
response.addHeader("Pragma", "No-cache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 0);
%>
<s:property value="value" escape="false" />
在struts.xml中配置下:
<action name="Graph_example" class="你的action">
<result>/result.jsp</result>
</action>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/bluelzx/archive/2008/01/30/2073160.aspx
发表评论
-
使用YahooService实现天气预报
2010-03-03 14:50 1369天气预报是非常有用的服务,如果能在网站上集成天气预报,能极大地 ... -
转义问题集
2010-01-16 15:26 1177struts2中设置过滤,把可能输入的危险字符,转换后存入数据 ... -
StringEscapeUtils
2010-01-16 15:14 5956org.apache.commons.lang.StringE ... -
Jprofiler启动Eclipse3.4以测试自己的plugin
2010-01-13 11:18 3214如大家所知,JProfiler是一个著名的用于java系统监 ... -
java.lang.OutOfMemoryError: Java heap space解决方法
2010-01-12 17:36 2145//首先检查程序有没有 ... -
PO、VO、DAO、BO、POJO分别是什么?
2010-01-09 12:12 1366PO:persistant object持久对 ... -
struts2插件
2009-09-22 09:50 1669今天无意查看了Struts2的插件时,发现已经林林总总有40个 ... -
性能测试工具
2009-06-17 16:41 1427性能测试工具 免费工 ... -
关于异常
2009-04-27 16:44 1211一、整体规范 按照错误类型,通常的处理方式如下: ... -
开源roller blog中的加解密
2009-04-15 17:45 1235/** * Encode a string ... -
eclipse 3.x中热部署WEB程序TOMCAT配置
2009-04-14 22:47 8611Eclipse3.x中热部署项目,启动错误问题: 20 ...
相关推荐
open flash chart 2 的swc文件包 可以在flex里面调用了. [Bindable] private var chart:String='{ "elements": [ { "type": "bar","alpha":0.8,"colour":"#663366", "values": [ 0 ] } ], "title": { "text": "...
Pie & Donut图 解压后看例子,注册码文件需要另外下载,本人上传资源里有,欢迎下载。
前端项目-pie-chart,Awesome pie charts for AngularJS
Open Flash Chart - Open Flash Chart 是一个 Flash 图表组件,很容易安装,提供以下语言的API: PHP, Perl, Python, Java, Ruby on Rails, and .Net 来控制图表。 ? AmCharts - AmCharts 是一个动画交互Flash图表...
http://blog.csdn.net/wild46cat/article/details/61415218
{{ easy-pie-chart dataPercent = 70 percentText = 70 barColor = " #000 " trackColor = " #fff " ... }} 检查上的选项部分以获取完整选项。 运行测试 git clone git@github....
绘制Pie chart,可以直接用。推荐。2D 3D
Open Flash Chart - Open Flash Chart 是一个 Flash 图表组件,很容易安装,提供以下语言的API: PHP, Perl, Python, Java, Ruby on Rails, and .Net 来控制图表。 • AmCharts - AmCharts 是一个动画交互Flash...
Pie chart 绘制三位的饼型,可以修改颜色,修改厚度和百分比,.net 编写
Version 4.0 now fully supports Flash, opening up a whole new dimension to what you can do with Dundas Chart for .NET. Renko Chart Type (Enterprise Edition only) - Renko charts isolate the underlying...
Bar Chart , Pie Chart , Torus Chart , Graph Chart , Bubble Chart and Radar Chart. All can be either 2D or 3D. All can be customized completly with your own colors, materials and prefabs. Integates ...
用于饼状图js技术所使用的,可以顺利生成图片,已经测试过了
good pie chart control for C#
float piefloat pie float pie float pie float pie
Chart.js v2.6: Add arrows to pie chart output values
使用VB.NET写的CHART控件使用例程,简单易懂.
import 'package:pie_chart/pie_chart.dart' ; 用法很简单。 饼图是一个小部件,它仅需要Map 作为其数据输入。 Map < String> dataMap = { "Flutter" : 5 , "React" : 3 , "Xamarin" : 2 , "Ionic" : 2 , }; ...
All the above supported chart types can contain multiple series can be displayed with the X axis horizontally default or vertically and support many other custom features The charts can be built as a ...
微软最近发布了一个很酷的新ASP.NET服务器控件,可以免费用在ASP.NET 3.5中,促成基于浏览器的丰富图表场景支持各种丰富的图表选项,包括pie(饼图), area(区域), range(范围), point(点), circular(圆形), ...
Data representation in pie/donut chart with variable slice configuration possibilities and optional legend Data representation in pie/donut chart with variable slice configuration possibilities and ...