UltraChart做图
Code
1B/S
2
3using System;
4
5using System.Collections;
6
7using System.ComponentModel;
8
9using System.Data;
10
11using System.Drawing;
12
13using System.Web;
14
15using System.Web.SessionState;
16
17using System.Web.UI;
18
19using System.Web.UI.WebControls;
20
21using System.Web.UI.HtmlControls;
22
23using HSCSManager.DataCS;
24
25using Infragistics.UltraChart.Resources.Appearance;
26
27namespace HSCSManager.HSManage
28
29{
30
31 /**//**//**//// <summary>
32
33 /// Chart 的摘要说明。
34
35 /// </summary>
36
37 public class Chart : System.Web.UI.Page
38
39 {
40
41 protected Infragistics.WebUI.UltraWebChart.UltraChart c1;
42
43 protected System.Web.UI.WebControls.Button btnValue;
44
45 protected System.Web.UI.WebControls.Button btnRatio;
46
47 protected Infragistics.WebUI.UltraWebChart.UltraChart c2;
48
49 protected Infragistics.WebUI.UltraWebTab.UltraWebTab uwtb1;
50
51 自定义函数自定义函数#region 自定义函数
52
53 public void GetDs(string SqlStr)
54
55 {
56
57 DataSet ds=TSqlDB.SetDataSource(SqlStr);
58
59 c1.TitleTop.Text=string.Empty;
60
61 c1.TitleBottom.Text=string.Empty;
62
63 c1.TitleLeft.Text=string.Empty;
64
65 c1.TitleRight.Text=string.Empty;
66
67 c1.Data.ZeroAligned=true;
68
69 c1.Legend.Visible=true;
70
71 c1.TitleTop.HorizontalAlign=StringAlignment.Center;
72
73 c1.TitleTop.Text=Request.QueryString["vTitle"];
74
75 c1.Axis.X.Labels.Visible=false;
76
77 c1.Axis.Y.Labels.Visible=false;
78
79 c1.DataSource=ds.Tables[0];
80
81 for(int i=0;i<=ds.Tables[0].Rows.Count-1;i++)
82
83 {
84
85 ChartTextAppearance cta=new ChartTextAppearance();
86
87 cta.Visible=true;
88
89 cta.VerticalAlign=StringAlignment.Far;
90
91 cta.Row=i;
92
93 cta.Column=0;
94
95 c1.ColumnChart.ChartText.Add(cta);
96
97 }
98
99 c1.DataBind();
100
101 c2.PieChart.ColumnIndex=-1;
102
103 c2.TitleTop.Text=string.Empty;
104
105 c2.TitleBottom.Text=string.Empty;
106
107 c2.TitleLeft.Text=string.Empty;
108
109 c2.TitleRight.Text=string.Empty;
110
111 c2.DataSource=ds.Tables[0];
112
113 c2.DataBind();
114
115 }
116
117 #endregion
118
119
120
121 private void Page_Load(object sender, System.EventArgs e)
122
123 {
124
125 if(Session["UserID"]==null)
126
127 {
128
129 Response.Redirect("Login.aspx");
130
131 }
132
133 Infragistics.UltraChart.Resources.Util.DemoSetup(c1);
134
135 GetDs(Session["vSqlStr"].ToString());
136
137 }
138
139 Web 窗体设计器生成的代码Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
140
141 override protected void OnInit(EventArgs e)
142
143 {
144
145 //
146
147 // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
148
149 //
150
151 InitializeComponent();
152
153 base.OnInit(e);
154
155 }
156
157
158
159 /**//**//**//// <summary>
160
161 /// 设计器支持所需的方法 - 不要使用代码编辑器修改
162
163 /// 此方法的内容。
164
165 /// </summary>
166
167 private void InitializeComponent()
168
169 {
170
171 this.Load += new System.EventHandler(this.Page_Load);
172
173 }
174
175 #endregion
176
177 }
178
179}
180
181
1B/S
2
3using System;
4
5using System.Collections;
6
7using System.ComponentModel;
8
9using System.Data;
10
11using System.Drawing;
12
13using System.Web;
14
15using System.Web.SessionState;
16
17using System.Web.UI;
18
19using System.Web.UI.WebControls;
20
21using System.Web.UI.HtmlControls;
22
23using HSCSManager.DataCS;
24
25using Infragistics.UltraChart.Resources.Appearance;
26
27namespace HSCSManager.HSManage
28
29{
30
31 /**//**//**//// <summary>
32
33 /// Chart 的摘要说明。
34
35 /// </summary>
36
37 public class Chart : System.Web.UI.Page
38
39 {
40
41 protected Infragistics.WebUI.UltraWebChart.UltraChart c1;
42
43 protected System.Web.UI.WebControls.Button btnValue;
44
45 protected System.Web.UI.WebControls.Button btnRatio;
46
47 protected Infragistics.WebUI.UltraWebChart.UltraChart c2;
48
49 protected Infragistics.WebUI.UltraWebTab.UltraWebTab uwtb1;
50
51 自定义函数自定义函数#region 自定义函数
52
53 public void GetDs(string SqlStr)
54
55 {
56
57 DataSet ds=TSqlDB.SetDataSource(SqlStr);
58
59 c1.TitleTop.Text=string.Empty;
60
61 c1.TitleBottom.Text=string.Empty;
62
63 c1.TitleLeft.Text=string.Empty;
64
65 c1.TitleRight.Text=string.Empty;
66
67 c1.Data.ZeroAligned=true;
68
69 c1.Legend.Visible=true;
70
71 c1.TitleTop.HorizontalAlign=StringAlignment.Center;
72
73 c1.TitleTop.Text=Request.QueryString["vTitle"];
74
75 c1.Axis.X.Labels.Visible=false;
76
77 c1.Axis.Y.Labels.Visible=false;
78
79 c1.DataSource=ds.Tables[0];
80
81 for(int i=0;i<=ds.Tables[0].Rows.Count-1;i++)
82
83 {
84
85 ChartTextAppearance cta=new ChartTextAppearance();
86
87 cta.Visible=true;
88
89 cta.VerticalAlign=StringAlignment.Far;
90
91 cta.Row=i;
92
93 cta.Column=0;
94
95 c1.ColumnChart.ChartText.Add(cta);
96
97 }
98
99 c1.DataBind();
100
101 c2.PieChart.ColumnIndex=-1;
102
103 c2.TitleTop.Text=string.Empty;
104
105 c2.TitleBottom.Text=string.Empty;
106
107 c2.TitleLeft.Text=string.Empty;
108
109 c2.TitleRight.Text=string.Empty;
110
111 c2.DataSource=ds.Tables[0];
112
113 c2.DataBind();
114
115 }
116
117 #endregion
118
119
120
121 private void Page_Load(object sender, System.EventArgs e)
122
123 {
124
125 if(Session["UserID"]==null)
126
127 {
128
129 Response.Redirect("Login.aspx");
130
131 }
132
133 Infragistics.UltraChart.Resources.Util.DemoSetup(c1);
134
135 GetDs(Session["vSqlStr"].ToString());
136
137 }
138
139 Web 窗体设计器生成的代码Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
140
141 override protected void OnInit(EventArgs e)
142
143 {
144
145 //
146
147 // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
148
149 //
150
151 InitializeComponent();
152
153 base.OnInit(e);
154
155 }
156
157
158
159 /**//**//**//// <summary>
160
161 /// 设计器支持所需的方法 - 不要使用代码编辑器修改
162
163 /// 此方法的内容。
164
165 /// </summary>
166
167 private void InitializeComponent()
168
169 {
170
171 this.Load += new System.EventHandler(this.Page_Load);
172
173 }
174
175 #endregion
176
177 }
178
179}
180
181