source: code/Website/dot-net-library/written-by-xiao-yifang/ofcWebTest/datafile/barsketch.aspx.cs

Last change on this file was 7849, checked in by dennisw, 15 years ago
File size: 1.5 KB
Line 
1using System;
2using System.Data;
3using System.Configuration;
4using System.Collections.Generic;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11using OpenFlashChart;
12
13public partial class barsketch : System.Web.UI.Page
14{
15 protected void Page_Load(object sender, EventArgs e)
16 {
17 OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
18 chart.Title = new Title("Sketch");
19
20 BarSketch bar = new OpenFlashChart.BarSketch("#045","#4f1",4);
21 Random random = new Random();
22 bar.Colour = "#345";
23
24 bar.FillAlpha = 0.4;
25 bar.Text = "Test";
26
27 bar.FontSize = 10;
28 List<double> values = new List<double>();
29 List<string> labels = new List<string>();
30 for (int i = 0; i < 12; i++)
31 {
32 values.Add(random.Next(i, i * 2));
33 labels.Add(i.ToString());
34 }
35 bar.Values = values;
36 chart.AddElement(bar);
37 chart.X_Axis.Steps = 4;
38 chart.X_Axis.Labels.Steps = 4;
39 chart.X_Axis.SetLabels( labels);
40 chart.X_Axis.Labels.Vertical = true;
41
42 chart.Y_Axis.Steps = 2;
43
44
45 Legend x = new Legend("x-axis legend");
46 chart.X_Legend = x;
47 string s = chart.ToString();
48 Response.Clear();
49 Response.CacheControl = "no-cache";
50 Response.Write(s);
51 Response.End();
52 }
53}
Note: See TracBrowser for help on using the repository browser.