Devexpress 12.2.8.0 部分学习笔记1 WebChartControl
本随笔大部分摘自《http://documentation.devexpress.com》devexpress官方文档和demo
主要学的是ASP.net 控件和MVC扩展
里的asp.net wenForm 控件
【Chart Control】WebChartControl控件
1.支持的浏览器有
谷歌Chrome(版本1.0和更高版本)
IE浏览器(6.0以上版本)
网景公司(版本7.2 +和更高)
Mozilla的火狐(1.5和更高版本)
歌剧院(第8版和更高版本)
2.添加一个Web图表
直接在工具栏中拖一个WebChartControl控件到页面,然后可以run wazrid运行向导,改变图表的外观什么的
3.如何一个WebChartControl可以被添加到ASPxCallbackPanel在其回调。
添加一个webchartcontrol控件 | |
然后,点击按钮的智能标签。在调用的行动清单,禁用的AutoPostBack属性,然后单击客户端事件...链接。 在调用对话框中,从客户端的点击事件处理程序,调用PerformCallback的()回调面板的。 |
|
|
|
using System; using DevExpress.XtraCharts; using DevExpress.XtraCharts.Web; using DevExpress.Web.ASPxClasses; using DevExpress.Web.ASPxCallbackPanel; // ... protected void ASPxCallbackPanel1_Callback(object sender, CallbackEventArgsBase e) { WebChartControl wbc = new WebChartControl(); wbc.Series.Add(new Series("Series", ViewType.Line)); wbc.Series[0].ArgumentScaleType = ScaleType.DateTime; wbc.Series[0].ValueScaleType = ScaleType.Numerical; Random r = new Random(); for (int i = 0; i < 5; i++) { wbc.Series[0].Points.Add(new SeriesPoint(DateTime.Today.AddDays(i), ((int)((r.NextDouble() * 100) * 10)) / 10.0)); } wbc.Width = ((ASPxCallbackPanel)sender).Width; ((ASPxCallbackPanel)sender).Controls.Add(wbc); } |
|
5.绑定数据到图表
using System; using DevExpress.XtraCharts; // ... namespace WebChartDataBinding { public partial class _Default : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { WebChartControl1.DataSourceID = "AccessDataSource1"; WebChartControl1.SeriesDataMember = "Year"; WebChartControl1.SeriesTemplate.ArgumentDataMember = "Region"; WebChartControl1.SeriesTemplate.ValueDataMembers.AddRange(new string[] {"GSP"}); WebChartControl1.SeriesTemplate.View = new SideBySideBarSeriesView(); WebChartControl1.DataBind(); } } }
6.绑定数据到pivotgridview
Now, the pivot grid has been successfully bound to data, and it's only left to create a Web chart bound to this grid. This is explained in the next section of this tutorial.
The WebChartControl has now successfully bound to the ASPxPivotGrid. Run the application, and view the result. |