open-flash-chart(2)
因为昨天用的是1.9.7版本的,发现不能用百分号(%),只有一使用,“%”后面的内容就全部消失了。于是换用2.0版本的。
不仅不用自己计算总各,而且还很方便的有加上链接,这些都是我正需要的。
OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
chart.Title = new Title("按成本中心汇总图");
OpenFlashChart.Pie pie = new OpenFlashChart.Pie();
//Random random = new Random();
List values = new List();
List labels = new List();
//for (int i = 0; i < 12; i++)
//{
// values.Add(new PieValue(random.NextDouble(), "Pie" + i));
// labels.Add(i.ToString());
//}
//values.Add(0.2);
values.Add(new PieValue(20, "运行一处"));
values.Add(new PieValue(30, "信息设备科"));
values.Add(new PieValue(40, "秘书处"));
values.Add(new PieValue(10, "岭奥核电"));
PieValue pieValue = new PieValue(10);
pieValue.Click = "http://xiao-yifang.blogspot.com";
values.Add(pieValue);
pie.Values = values;
pie.FontSize = 20;
pie.Alpha = .5;
PieAnimationSeries pieAnimationSeries = new PieAnimationSeries();
pieAnimationSeries.Add(new PieAnimation("bounce", 5));
pie.Animate = pieAnimationSeries;
//pie.GradientFillMode = false;
//pie.FillAlpha = 10;
//pie.Colour = "#fff";
pie.Colours = new string[] { "#9933CC", "#0000CC", "#AAAAFF", "#202020" };
pie.Tooltip = "#label#,#val# 占总量 #total#的#percent#";
chart.AddElement(pie);
chart.Bgcolor = "#FFFFFF";
string s = chart.ToPrettyString();
Response.Clear();
Response.CacheControl = "no-cache";
Response.Write(s);
Response.End();