OpenFlashChart的使用(二)

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
		codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
		width="<%=width%>" height="<%=height%>" id="ie_chart"
		align="middle">
		<param name="allowScriptAccess" value="always" />
		<param name="movie"
			value="<%=url%>/open-flash-chart.swf?width=500&height=250&data=<%=url%>/chart-data-pie.jsp" />
		<param name="quality" value="high" />
		<param name="bgcolor" value="#FFFFFF" />
		<embed src="<%=url%>/open-flash-chart.swf?data=<%=url%>/chart-data-pie.jsp" quality="high"
			bgcolor="#FFFFFF" width="<%=width%>" height="<%=height%>"
			name="chart" align="middle" allowScriptAccess="always"
			type="application/x-shockwave-flash"
			pluginspage="http://www.macromedia.com/go/getflashplayer"
			id="chart" />
	</object>
 

一、LineChart Data

int max = 50;
List<String> data = new ArrayList<String>();
List<String> data2 = new ArrayList<String>();
List<String> links = new ArrayList<String>();

for(int i = 0; i < 12; i++) {
	data.add(Double.toString(Math.random() * max));
	data2.add(Double.toString(Math.random() * max / 2));
	links.add("javascript:alert('hello, i am no."+(i+1)+"')");
}

LineChart lineChart = new LineChart();
lineChart.setTitle("全市运营情况统计表");

lineChart.set_data(data);
lineChart.set_data(data2);

lineChart.line_hollow("2", "4", "#DC143C", "批售量", "12");
lineChart.line_hollow("2", "4", "#000080", "激活量", "12");

lineChart.set_links(links);

List<String> labels = new ArrayList<String>();
labels.add("一月");
labels.add("二月");
labels.add("三月");
labels.add("四月");
labels.add("五月");
labels.add("六月");
labels.add("七月");
labels.add("八月");
labels.add("九月");
labels.add("十月");
labels.add("十一月");
labels.add("十二月");

lineChart.set_x_labels(labels);
lineChart.setXLegend("月份");

lineChart.setYMax(60);
lineChart.setYLabelSteps(12);

lineChart.render();

 

二、PieChart Data

List<String> data = new ArrayList<String>();
List<String> labels = new ArrayList<String>();
List<String> links = new ArrayList<String>();

int max = 100;
for(int i = 0; i < 5; i++) {
	data.add(new DecimalFormat("#.00").format(Math.random() * max));
	labels.add("商品" + (i+1));
	links.add("chart3.jsp?id=" + i);
}

PieChart pieChart = new PieChart();
pieChart.setTitle("渠道分布占比\n\n");
pieChart.setToolTip("#val#元");

pieChart.pie_values(data, labels, links);
	
pieChart.render();
 

三、BarChart Data

Bar b1 = new Bar("50", "#9933CC");
b1.key("批售量", 12);

Bar b2 = new Bar("50", "#0000FF");
b2.key("激活量", 12);

int max = 100;
for(int i = 0; i < 12; i++) {
	b1.add(String.valueOf(Math.random() * max), "");
	b2.add(String.valueOf(Math.random() * max), "");
}

BarChart barChart = new BarChart();
barChart.setTitle("渠道运营情况统计图");
barChart.addBar(b1);
barChart.addBar(b2);

List<String> labels = new ArrayList<String>();
labels.add("一月");
labels.add("二月");
labels.add("三月");
labels.add("四月");
labels.add("五月");
labels.add("六月");
labels.add("七月");
labels.add("八月");
labels.add("九月");
labels.add("十月");
labels.add("十一月");
labels.add("十二月");

barChart.set_x_labels(labels);
barChart.setYMax(100);
barChart.setYLabelSteps(10);

barChart.render();
 

四、Bar3DChart Data

Bar b1 = new Bar("50", "#9933CC");
b1.setVar("bar_3d");
b1.key("批售量", 12);

Bar b2 = new Bar("50", "#0000FF");
b2.setVar("bar_3d");
b2.key("激活量", 12);

int max = 100;
for(int i = 0; i < 12; i++) {
	b1.add(String.valueOf(Math.random() * max), String.valueOf(i));
	b2.add(String.valueOf(Math.random() * max), String.valueOf(i));
}

Bar3DChart bar3DChart = new Bar3DChart();
bar3DChart.setTitle("渠道运营情况统计图");
bar3DChart.addBar(b1);
bar3DChart.addBar(b2);

List<String> labels = new ArrayList<String>();
labels.add("一月");
labels.add("二月");
labels.add("三月");
labels.add("四月");
labels.add("五月");
labels.add("六月");
labels.add("七月");
labels.add("八月");
labels.add("九月");
labels.add("十月");
labels.add("十一月");
labels.add("十二月");

bar3DChart.set_x_labels(labels);
bar3DChart.setYMax(110);
bar3DChart.setYLabelSteps(10);

bar3DChart.render();

 

你可能感兴趣的:(JavaScript,jsp,IE,Flash,Go)