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

Last change on this file since 7937 was 7849, checked in by dennisw, 15 years ago
File size: 3.0 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 datafile_Line : System.Web.UI.Page
14{
15 protected void Page_Load(object sender, EventArgs e)
16 {
17 OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
18 List<double> data1 = new List<double>();
19 List<double> data2 = new List<double>();
20 Random rand = new Random(DateTime.Now.Millisecond);
21 for(double i=0;i<12;i++)
22 {
23 data1.Add(rand.Next(30));
24 data2.Add(rand.Next(50));
25 }
26
27 OpenFlashChart.Line line1 = new Line();
28 line1.Values = data1;
29 line1.HaloSize = 0;
30 line1.Width = 2;
31 line1.DotSize = 5;
32 line1.DotStyleType.Tip = "#x_label#<br>#val#";
33 //line1.DotStyleType.Type = DotType.ANCHOR;
34 //line1.DotStyleType.Type = DotType.BOW;
35 line1.DotStyleType.Colour = "#467533";
36 line1.Tooltip = "#x_label#<br>提示:#val#";
37
38 OpenFlashChart.Line line2 = new Line();
39 line2.Values = data2;
40 line2.HaloSize = 1;
41 line2.Width = 3;
42 line2.DotSize = 4;
43 line2.DotStyleType.Tip = "#x_label#<br>#val#";
44 line1.DotStyleType.Type = DotType.ANCHOR;
45 //line1.DotStyleType.Type = DotType.BOW;
46 line2.DotStyleType.Colour = "#fe4567";
47 line2.Tooltip = "提示:#val#";
48 line2.AttachToRightAxis(true);
49
50 chart.AddElement(line1);
51 chart.AddElement(line2);
52 chart.Y_Legend=new Legend("中文test");
53 chart.Title = new Title("line演示");
54 chart.Y_Axis.SetRange(0,35,5);
55 chart.X_Axis.Labels.Color = "#e43456";
56 chart.X_Axis.Labels.VisibleSteps = 3;
57 chart.Y_Axis.Labels.FormatString = "$#val#";
58 chart.X_Axis.SetLabels(new string[]{"test1","test2"});
59 //chart.Y_Axis.SetLabels(new string[] { "test1", "test2", "test1", "test2", "test1", "test2" });
60 chart.X_Axis.Steps = 4;
61 chart.Y_Axis.Steps = 3;
62 chart.Y_Axis.Colour = "#ef6745";
63 chart.Y_Axis.Labels.Color = "#ef6745";
64 chart.Y_Axis.Offset = true;
65 chart.Y_RightLegend = new Legend("test y legend right");
66 chart.Y_Axis_Right = new YAxis();
67 chart.Y_Axis_Right.Steps = 8;
68 chart.Y_Axis_Right.TickLength = 4;
69 chart.Y_Axis.TickLength = 4;
70 chart.Y_Axis_Right.SetRange(0,60);
71
72 chart.Tooltip = new ToolTip("全局提示:#val#");
73 chart.Tooltip.Shadow = true;
74 chart.Tooltip.Colour = "#e43456";
75 chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
76 Response.Clear();
77 Response.CacheControl = "no-cache";
78 Response.Write(chart.ToPrettyString());
79 Response.End();
80 }
81}
Note: See TracBrowser for help on using the repository browser.