[7849] | 1 | using System;
|
---|
| 2 | using System.Data;
|
---|
| 3 | using System.Configuration;
|
---|
| 4 | using System.Collections.Generic;
|
---|
| 5 | using System.Web;
|
---|
| 6 | using System.Web.Security;
|
---|
| 7 | using System.Web.UI;
|
---|
| 8 | using System.Web.UI.WebControls;
|
---|
| 9 | using System.Web.UI.WebControls.WebParts;
|
---|
| 10 | using System.Web.UI.HtmlControls;
|
---|
| 11 | using OpenFlashChart;
|
---|
| 12 | using XAxis=OpenFlashChart.XAxis;
|
---|
| 13 | using YAxis=OpenFlashChart.YAxis;
|
---|
| 14 |
|
---|
| 15 | public partial class bar : System.Web.UI.Page
|
---|
| 16 | {
|
---|
| 17 | protected void Page_Load(object sender, EventArgs e)
|
---|
| 18 | {
|
---|
| 19 | OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
|
---|
| 20 | chart.Title = new Title("Bar Chart");
|
---|
| 21 |
|
---|
| 22 | Bar bar = new OpenFlashChart.Bar();
|
---|
| 23 | Random random = new Random();
|
---|
| 24 | bar.Colour = "#344565";
|
---|
| 25 |
|
---|
| 26 | bar.Alpha = 0.8;
|
---|
| 27 |
|
---|
| 28 | bar.Text = "Test";
|
---|
| 29 |
|
---|
| 30 | bar.FontSize = 10;
|
---|
| 31 | List<object> values = new List<object>();
|
---|
| 32 | for (int i = 0; i < 12; i++)
|
---|
| 33 | values.Add(random.Next(i, i * 2));
|
---|
| 34 | BarValue barValue = new BarValue(12);
|
---|
| 35 | barValue.OnClick = "http://xiao-yifang.blogspot.com";
|
---|
| 36 | values.Add(barValue);
|
---|
| 37 | bar.Values = values;
|
---|
| 38 | chart.AddElement(bar);
|
---|
| 39 | XAxis xaxis = new XAxis();
|
---|
| 40 | xaxis.Labels.SetLabels(new string[] { "text", "#ef0", "10", "vertical" });
|
---|
| 41 | //xaxis.Steps = 1;
|
---|
| 42 | //xaxis.Offset = true;
|
---|
| 43 | ////xaxis.SetRange(-2, 15);
|
---|
| 44 | chart.X_Axis = xaxis;
|
---|
| 45 | //YAxis yaxis = new YAxis();
|
---|
| 46 | //yaxis.Steps = 4;
|
---|
| 47 | //yaxis.SetRange(0, 20);
|
---|
| 48 | //chart.Y_Axis = yaxis;
|
---|
| 49 | chart.Y_Axis.SetRange(0,24,3);
|
---|
| 50 | bar.Tooltip = "提示:label:#x_label#<br>#top#<br>#bottom#<br>#val#";
|
---|
| 51 | string s = chart.ToPrettyString();
|
---|
| 52 |
|
---|
| 53 | Response.Clear();
|
---|
| 54 | Response.CacheControl = "no-cache";
|
---|
| 55 | Response.Write(s);
|
---|
| 56 | Response.End();
|
---|
| 57 | }
|
---|
| 58 | }
|
---|