openflashchart使用
来源:互联网 发布:杨辉三角的c语言程序 编辑:程序博客网 时间:2024/06/09 23:26
1、jsp页面
swfobject.embedSWF(
"js/open-flash-chart.swf",
"my_chart", //需要显示地方的id
"100%",
"900",
"9.0.0",
"expressInstall.swf",
{"data-file":"tmp_showHisNode.action?parmValue="+parm},
{wmode:"transparent"}
);
2、action
LineChart lineChart = new LineChart();
// lineChart.setTooltip("#x_label#<br>#val#"); //设置无效
XAxis labels = new XAxis();
List<String >labelsValue=new ArrayList<String>();
for(Temperature tmperature:tmp){
labelsValue.add(tmperature.getCreateTime()+""+tmperature.getCreateTime());
double tmpValue=0;
switch (layer){
case 1:
tmpValue=tmperature.getTemperature1();
break;
case 2:
tmpValue=tmperature.getTemperature2();
break;
case 3:
tmpValue=tmperature.getTemperature3();
break;
case 4:
tmpValue=tmperature.getTemperature4();
break;
default:
tmpValue=0;
}
if(tmperature.getTemperature4()>xMaxValue){
xMaxValue=tmperature.getTemperature4();
}
if(tmperature.getTemperature4()<xMinValue){
xMinValue=tmperature.getTemperature4();
}
LineChart.Dot dot = new LineChart.Dot(tmpValue);//按照顺序设置各个点的值
//lineChart.addValues(tmpValue);
dot.setTooltip(tmpValue+"<br>"+tmperature.getCreateDate()+" "+tmperature.getCreateTime()); //可以生效
dot.setColour("#467533");
lineChart.addDots(dot);
}
//x.setColour("0x000000");
Chart flashChart = new Chart( ); // 整个图的标题
flashChart.setTitle(new Text("温度(c) "+houseId+"粮仓; "+layer+"层; "+nodeId+"号节点", Text.createStyle(12, "#ff0000", Text.TEXT_ALIGN_LEFT)));
YAxis y = new YAxis(); //y 轴
int step=(int)(xMaxValue-xMinValue)/40;
y.setRange(xMinValue, xMaxValue, step);
flashChart.setYAxis(y);
//x轴
labels.setSteps(1);
labels.setLabels(labelsValue);
labels.getLabels().setSteps(1);
labels.setOffset(true);
labels.getLabels().setVisible(false);
if(tmp.size()==1){
labels.setRange(0,2);
}else{
labels.setRange(0,tmp.size()-1);
}
flashChart.setXAxis(labels);
flashChart.addElements(lineChart); // 把折线图加入到图表
String json = flashChart.toDebugString();// 转成 json 格式
通过Ajax将json传递至页面。
3、所需要的lib。java的 包叫jofc,其他的叫ofc
jofc2-1.0-0.jar
json2.js
open-flash-chart.swf
swfobject.js
xstream-1.3.1.jar
4、参照网站
http://hi.baidu.com/javagril/blog/item/5906010e13e907e1ab6457ad.html
- openflashchart使用
- openflashchart使用
- OpenFlashChart的参数使用
- javaweb中使用 openflashchart
- OpenFlashChart
- openflashchart使用时的须注意的几个小地方
- OpenFlashChart初学
- openflashchart中的tool_tip属性
- openFlashChart参数说明
- chart-OpenFlashChart简明手册
- OpenFlashChart简明手册
- openflashchart属性配置API
- openflashchart终于测试成功了
- openflashchart保存图片(For JAVA)
- OpenFlashChart通过URL传值问题
- OpenFlashChart将FLASH导出成图片
- [转]Struts2整合之动态图表OpenFlashChart
- 使用
- 43
- 『yizia』SD2的思考--“技术服从商务”对与错
- linux时间读取等等
- linux---單用戶模式
- 如何把Crystal Reports报表转换为ActiveReports报表
- openflashchart使用
- 递归TreeView 目录树
- 用qmake快速生成makefile
- set,map 容器特性小结
- linux mount挂载设备(u盘,光盘,iso等 )使用说明
- 求教应用MSP430如何实现数据存储
- 工作忙,闲暇时间将致力于学习SOA SPRING HERNATE IBATIS 搜索引擎 ORACLE性能
- asp.net 传值问题
- xlst,xml与xpath