DevExpress XtraCharts常用示例四:网格数据更改时如何刷新图表
作者:mayz 来源:本站原创 浏览:Loading...次 发布时间:2013-02-06 评论:0条
本示例展示了 XtraCharts 的网格数据发生变更时如何实现图表刷新。
首先处理ASPxGridView.EndCallback客户端事件,然后用 ASPxClientWebChartControl.PerformCallback方法发送一个回调函数给服务器,并生成服务器端 WebChartControl.CustomCallback事件。之后,就可以在这个事件处理器中刷新图表了。详细代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ChartWithGrid._Default" %> <%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %> <%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %> <%@ Register Assembly="DevExpress.XtraCharts.v9.3.Web, Version=9.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dxchartsui" %> <%@ Register Assembly="DevExpress.XtraCharts.v9.3, Version=9.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb" DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = ?" InsertCommand="INSERT INTO [Products] ([ProductID], [ProductName], [CategoryID], [UnitPrice]) VALUES (?, ?, ?, ?)" SelectCommand="SELECT [ProductID], [ProductName], [CategoryID], [UnitPrice] FROM [Products] WHERE ([CategoryID] = ?)" UpdateCommand="UPDATE [Products] SET [ProductName] = ?, [CategoryID] = ?, [UnitPrice] = ? WHERE [ProductID] = ?"> <SelectParameters> <asp:Parameter DefaultValue="1" Name="?" /> </SelectParameters> </asp:AccessDataSource> </div> <dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" KeyFieldName="ProductID" Width="835px"> <ClientSideEvents EndCallback="function(s, e) { Chart.PerformCallback("GridChanged"); }" /> <Columns> <dxwgv:GridViewCommandColumn VisibleIndex="0"> <EditButton Visible="True"> </EditButton> <NewButton Visible="True"> </NewButton> <DeleteButton Visible="True"> </DeleteButton> </dxwgv:GridViewCommandColumn> <dxwgv:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" VisibleIndex="1"> <EditFormSettings Visible="False" /> </dxwgv:GridViewDataTextColumn> <dxwgv:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="2"> </dxwgv:GridViewDataTextColumn> <dxwgv:GridViewDataTextColumn FieldName="CategoryID" VisibleIndex="3"> </dxwgv:GridViewDataTextColumn> <dxwgv:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="4"> </dxwgv:GridViewDataTextColumn> </Columns> </dxwgv:ASPxGridView> <dxchartsui:WebChartControl ID="WebChartControl1" runat="server" ClientInstanceName="Chart" DataSourceID="AccessDataSource1" DiagramTypeName="SimpleDiagram3D" Height="348px" OnCustomCallback="WebChartControl1_CustomCallback" Width="833px"> <SeriesSerializable> <cc1:Series ArgumentDataMember="ProductID" LabelTypeName="Pie3DSeriesLabel" Name="Series 1" PointOptionsTypeName="PiePointOptions" SeriesViewTypeName="Pie3DSeriesView" ValueDataMembersSerializable="UnitPrice"> <view hiddenserializablestring="to be serialized"></view> <label hiddenserializablestring="to be serialized"> <fillstyle filloptionstypename="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </fillstyle> </label> <pointoptions hiddenserializablestring="to be serialized"></pointoptions> <legendpointoptions hiddenserializablestring="to be serialized"></legendpointoptions> </cc1:Series> </SeriesSerializable> <SeriesTemplate LabelTypeName="SideBySideBarSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBarSeriesView"> <View HiddenSerializableString="to be serialized"> </View> <Label HiddenSerializableString="to be serialized"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <Diagram RotationMatrixSerializable="1;0;0;0;0;0.5;-0.866025403784439;0;0;0.866025403784439;0.5;0;0;0;0;1"> </Diagram> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </dxchartsui:WebChartControl> </form> </body> </html>
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/Resources/CodeExamples-366.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/Resources/CodeExamples-366.html
关键字: XtraCharts常用示例
评论列表
暂无评论
请谈谈你的看法 请使用IE或者Firefox浏览器,暂不支持Chrome!
慧都控件网为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
电话:400-700-1020
023-66090381
邮箱:sales@evget.com
相关资源
- ASPxGridView控件常用示例八:显示列标题的上下文菜单
- 揭秘DevExpress的DXTREME创新之处
- ASPxGridView控件常用示例九:在PreviewRows中显示图像
- DevExpress Windows 8 XAML在线演示:Finance Tracker
- 在GridView中获得dropdownlist控件
- DevExpress VCL发布12.2
- Dev控件在VS2010中的分组突然消失
- 如何去掉RichEditControl的标尺
- 如何用工具箱修复DevExpress的显示
- 如何设置Devexpress新增节点后被选中
- Windows 8 XAML常用示例一:创建表单布局
- 绑定Devexpress Gridview的checkbox列中的数据源
- DXCharts应用教程一:创建2D饼图
- Windows 8 XAML常用示例二:从数据源中植入幻灯片视图
- DevExpress DXCharts应用教程二:创建2D面积图
- 触发barManager里的barItem点击事件
- DevExpress DXCharts应用教程三:创建2D气泡图
- DevExpress DXCharts应用教程四:创建2D烛台图表
- DevExpress DXCharts应用教程五:2D全堆叠图表
- DXCharts应用教程六:2D重叠范围条形图