前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >FusionChartsFree用法简介

FusionChartsFree用法简介

作者头像
全栈程序员站长
发布2022-09-14 10:23:30
4730
发布2022-09-14 10:23:30
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是你们的朋友全栈君。

最近在公司做报表,学习了一些FusionChartsFree用法。具体FusionChartsFree是什么东东,自己到google里找答案。

首先来做一个柱型图:

/** * 统计一周内的销售金额,在action中构造显示图形的字符串 */ public String getDateList(String caption, String subCaption, String xAxisName, String yAxisName, int yAxisMinValue, int decimalPrecision, int formatNumberScale, int showNames, int showValues, int showAlternateHGridColor, String AlternateHGridColor, String divLineColor, int divLineAlpha, int alternateHGridAlpha) { IScmSellDeliveryManager sellDeliveryMagt = ServiceLocator.getInstance().lookup(IScmSellDeliveryManager.class); List<Date> dateList = new ArrayList<Date>(); for (int i = -6; i < 0; i++) { dateList.add(ComputeDateUtils.getDate(i)); } dateList.add(new Date());//获得X方向的数据

List<Double> amountList = sellDeliveryMagt.countWeekAmountByDate(new Date());//获得Y方向的数据

SimpleDateFormat sdf = new SimpleDateFormat(“yy-MM-dd”); StringBuffer head = new StringBuffer(); head .append(“<graph caption='” + caption + “‘ subCaption = ‘” + subCaption + “‘ xAxisName='” + xAxisName + “‘ yAxisMinValue=’0’ yAxisName='” + yAxisName + “‘ decimalPrecision=’0′ formatNumberScale=’0′ showNames=’1′ showValues=’0′ showAlternateHGridColor=’1′ AlternateHGridColor=’ff5904′ divLineAlpha=’5′ alternateHGridAlpha=’5’>”); for (int i = 0; i < dateList.size(); i++) { if (i < amountList.size() && amountList.size() > 0 && null != amountList && null != amountList.get(i)) { head.append(“<set name='” + sdf.format(dateList.get(i)) + “‘ value='” + amountList.get(i) + “‘ hoverText=’销售金额’/>”); } else { head.append(“<set name='” + sdf.format(dateList.get(i)) + “‘/>”); } } head.append(“</graph>”); return head.toString(); }

上面的方法主要是构造了一个很长的字符串,每一种图形的字符串的格式是不一样的。具体可以参看下面的FusionChartsFree包,它里面有各种各样的图形的xml格式说明,要想构造成它的图形构造出它的字符串就可以了,当然还有一种静态的图形,FusionChartsFree包有静态的例子F:\张明学\FusionChartsFree\FusionChartsFree\Code\MyFirstChart文本里面,先把数据写在xml中,在html中的js中构造一个FusionCharts对象并指定它的xml位置就可以了。这个方法自己去看FusionChartsFree包。

接着说上面的用法,在action中动态生成好相应的字符串之后,在而面访问它可以了。

<div style=”width:width:50%;overflow:auto;”> <object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase= http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0” width=”610″ height=”400″ id=”Column” > <param name=”movie” value=”{ctxPath}/FusionCharts/FCF_Column3D.swf” wmode=”opaque” flashVars=”&chartWidth=610&chartHeight=400&dataXML=

好了,这样flash就可以显示出来了。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/158527.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年7月1,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
腾讯云 BI
腾讯云 BI(Business Intelligence,BI)提供从数据源接入、数据建模到数据可视化分析全流程的BI能力,帮助经营者快速获取决策数据依据。系统采用敏捷自助式设计,使用者仅需通过简单拖拽即可完成原本复杂的报表开发过程,并支持报表的分享、推送等企业协作场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档