[7849] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using OpenFlashChart;
|
---|
| 4 |
|
---|
| 5 | public partial class Pie : System.Web.UI.Page
|
---|
| 6 | {
|
---|
| 7 | protected void Page_Load(object sender, EventArgs e)
|
---|
| 8 | {
|
---|
| 9 | OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
|
---|
| 10 | chart.Title = new Title("Pie Chart");
|
---|
| 11 |
|
---|
| 12 | OpenFlashChart.Pie pie = new OpenFlashChart.Pie();
|
---|
| 13 | Random random = new Random();
|
---|
| 14 |
|
---|
| 15 | List<PieValue> values = new List<PieValue>();
|
---|
| 16 | List<string> labels = new List<string>();
|
---|
| 17 | for (int i = 0; i < 12; i++)
|
---|
| 18 | {
|
---|
| 19 | values.Add(new PieValue(random.NextDouble(),"Pie"+i));
|
---|
| 20 | labels.Add(i.ToString());
|
---|
| 21 | }
|
---|
| 22 | //values.Add(0.2);
|
---|
| 23 | PieValue pieValue = new PieValue(10);
|
---|
| 24 | pieValue.Click = "http://xiao-yifang.blogspot.com";
|
---|
| 25 | values.Add(pieValue);
|
---|
| 26 | pie.Values = values;
|
---|
| 27 | pie.FontSize = 20;
|
---|
| 28 | pie.Alpha = .5;
|
---|
| 29 | PieAnimationSeries pieAnimationSeries = new PieAnimationSeries();
|
---|
| 30 | pieAnimationSeries.Add(new PieAnimation("bounce", 5));
|
---|
| 31 | pie.Animate = pieAnimationSeries;
|
---|
| 32 | //pie.GradientFillMode = false;
|
---|
| 33 |
|
---|
| 34 | //pie.FillAlpha = 10;
|
---|
| 35 |
|
---|
| 36 | //pie.Colour = "#fff";
|
---|
| 37 | pie.Colours = new string[]{"#04f","#1ff","#6ef","#f30"};
|
---|
| 38 | pie.Tooltip="#label#,#val# of #total##percent# of 100%";
|
---|
| 39 | chart.AddElement(pie);
|
---|
| 40 | chart.Bgcolor = "#202020";
|
---|
| 41 | string s = chart.ToPrettyString();
|
---|
| 42 | Response.Clear();
|
---|
| 43 | Response.CacheControl = "no-cache";
|
---|
| 44 | Response.Write(s);
|
---|
| 45 | Response.End();
|
---|
| 46 | }
|
---|
| 47 | }
|
---|