/*
* Created on Oct 25, 2006
*
*/
package com.infosoftglobal.fusioncharts;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
/**
* Contains methods to add no cache string to a url,getting colors for the charts.<br>
* This class can be used to create chart xml given the swf filename and other<br>
* parameters.<br>
* In order to use this class in your jsps,import this class and<br>
* call the appropriate method directly as follows:<br>
* FusionChartsHelper.addCacheToDataURL(...);<br>
* In order to use this class for colors call the method as shown:<br>
* FusionChartsHelper helper = new FusionChartsHelper();<BR>
* String color = helper.getFCColor();<BR>
* @author InfoSoft Global (P) Ltd.
*/
public class FusionChartsHelper {
/*This page contains an array of colors to be used as default set of colors for FusionCharts
'arr_FCColors is the array that would contain the hex code of colors
'ALL COLORS HEX CODES TO BE USED WITHOUT #*/
//We also initiate a counter variable to help us cyclically rotate through
//the array of colors.
int FC_ColorCounter=0;
String[] arr_FCColors = new String[]{
"1941A5",
"AFD8F8",
"F6BD0F",
"8BBA00",
"A66EDD",
"F984A1",
"CCCC00",
"999999",
"0099CC",
"FF0000",
"006F00",
"0099FF",
"FF66CC",
"669966",
"7C7CB4",
"FF9933",
"9900FF",
"99FFCC",
"CCCCFF",
"669900",
};
/*
"1941A5"; //Dark Blue
"CCCC00"; //Chrome Yellow+Green
"999999"; //Grey
"0099CC"; //Blue Shade
"FF0000"; //Bright Red
"006F00"; //Dark Green
"0099FF"; //Blue (Light)
"FF66CC"; //Dark Pink
"669966"; //Dirty green
"7C7CB4"; //Violet shade of blue
"FF9933"; //Orange
"9900FF"; //Violet
"99FFCC";//Blue+Green Light
"CCCCFF"; //Light violet
"669900"; //Shade of green
*/
//getFCColor method helps return a color from arr_FCColors array. It uses
//cyclic iteration to return a color from a given index. The index value is
//maintained in FC_ColorCounter
public String getFCColor() {
//Update index
FC_ColorCounter += 1;
//Return color
return arr_FCColors[FC_ColorCounter % arr_FCColors.length];
}
/**
* Adds additional string to the url to and encodes the parameters,<br>
* so as to disable caching of data.<br>
* @param strDataURL -
* dataURL to be fed to chart
* @return cachedURL - URL with the additional string added
*/
public static String addCacheToDataURL(String strDataURL) {
String cachedURL = strDataURL;
// Add the no-cache string if required
// We add ?FCCurrTime=xxyyzz
// If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz
// We replace : with _, as FusionCharts cannot handle : in URLs
Calendar nowCal = Calendar.getInstance();
Date now = nowCal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH_mm_ss a");
String strNow = sdf.format(now);
try {
if (strDataURL.indexOf("?") > 0) {
cachedURL = strDataURL + "&FCCurrTime="
+ URLEncoder.encode(strNow, "UTF-8");
} else {
cachedURL = strDataURL + "?FCCurrTime="
+ URLEncoder.encode(strNow, "UTF-8");
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
cachedURL = strDataURL + "?FCCurrTime=" + strNow;
}
return cachedURL;
}
/**
* Encodes the dataURL before it's served to FusionCharts.
* If you have parameters in your dataURL, you necessarily need to encode it.
* @param strDataURL - dataURL to be fed to chart
* @param addNoCacheStr - Whether to add additional string to URL to disable caching of data
* @return String - the encoded URL
*/
public String encodeDataURL(String strDataURL, String addNoCacheStr,
HttpServletResponse response) {
String encodedURL = strDataURL;
//Add the no-cache string if required
if (addNoCacheStr.equals("true")) {
/*We add ?FCCurrTime=xxyyzz
If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz
We send the date separated with '_', instead of the usual ':' as FusionCharts cannot handle : in URLs
*/
java.util.Calendar nowCal = java.util.Calendar.getInstance();
java.util.Date now = nowCal.getTime();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"MM/dd/yyyy HH_mm_ss a");
String strNow = sdf.format(now);
if (strDataURL.indexOf("?") > 0) {
encodedURL = strDataURL + "&FCCurrTime=" + strNow;
} else {
strDataURL = strDataURL + "?FCCurrTime=" + strNow;
}
encodedURL = response.encodeURL(strDataURL);
}
return encodedURL;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
fusionchartfree 教程
共933个文件
html:314个
jpg:98个
gif:93个
需积分: 0 6 下载量 69 浏览量
2009-07-16
10:47:41
上传
评论
收藏 4.71MB RAR 举报
温馨提示
fusionchartfree 教程 flash展示,效果不错
资源详情
资源评论
资源推荐
收起资源包目录
fusionchartfree 教程 (933个子文件)
about 96B
Default.asp 8KB
FusionCharts.asp 5KB
MultiSeries.asp 4KB
Combination.asp 4KB
Stacked.asp 4KB
dataXML.asp 3KB
Default.asp 3KB
Detailed.asp 3KB
SingleSeries.asp 3KB
Chart.asp 3KB
BasicDBExample.asp 3KB
BasicDataXML.asp 3KB
Default.asp 3KB
MultiChart.asp 2KB
Default.asp 2KB
SimpleChart.asp 2KB
PieData.asp 2KB
FC_Colors.asp 1KB
BasicChart.asp 1KB
DBConn.asp 569B
Stacked.aspx 5KB
Default.aspx 4KB
Stacked.aspx 4KB
Default.aspx 4KB
Default.aspx 4KB
Default.aspx 4KB
Default.aspx 3KB
Default.aspx 3KB
Default.aspx 3KB
Default.aspx 3KB
MultiChart.aspx 2KB
SimpleChart.aspx 2KB
SimpleChart.aspx 2KB
MultiChart.aspx 2KB
dataXML.aspx 2KB
dataXML.aspx 2KB
BasicChart.aspx 2KB
Detailed.aspx 2KB
Detailed.aspx 1KB
Chart.aspx 1KB
Chart.aspx 1KB
SingleSeries.aspx 1KB
BasicDataXML.aspx 1KB
SingleSeries.aspx 1KB
MultiSeries.aspx 1KB
MultiSeries.aspx 1KB
Default.aspx 1KB
BasicDBExample.aspx 1KB
Combination.aspx 1KB
Default.aspx 1KB
BasicDBExample.aspx 1KB
Combination.aspx 1KB
BasicDataXML.aspx 1KB
BasicChart.aspx 1005B
PieData.aspx 122B
PieData.aspx 108B
benchmarker 117B
combination_data.builder 1KB
ms_array_data.builder 1KB
stacked_data.builder 1KB
sampledata.builder 966B
pie_data.builder 772B
factories_quantity.builder 752B
factory_details.builder 721B
form_based_data.builder 705B
default_factories_quantity.builder 677B
basic_factories_quantity.builder 587B
ss_array_data.builder 521B
dispatch.cgi 476B
FusionChartsHelper.class 3KB
FusionChartsHelper.class 3KB
DBConnection.class 1KB
DBConnection.class 1KB
web.config 2KB
Web.config 2KB
console 98B
Default.aspx.cs 6KB
MultiSeries.aspx.cs 4KB
Combination.aspx.cs 3KB
Default.aspx.cs 2KB
SingleSeries.aspx.cs 2KB
Util.cs 2KB
Detailed.aspx.cs 2KB
DbConn.cs 2KB
BasicDataXML.aspx.cs 2KB
dataXML.aspx.cs 2KB
Chart.aspx.cs 2KB
PieData.aspx.cs 2KB
BasicDBExample.aspx.cs 2KB
MultiChart.aspx.cs 1KB
BasicChart.aspx.cs 1KB
rdoc-style.css 4KB
Style.css 2KB
typoset.css 2KB
Style.css 1KB
stylesheet.css 1KB
scaffold.css 1KB
dtree.css 535B
prettify.css 453B
共 933 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
jddjd
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0