通过使用http://examples.ext.net/#/Chart/Column/Basic/中的示例,我将我的数据绑定到我的 sqldatasource 中的图表,但是,在这个示例中,有一个名为“ReloadData”的按钮刷新数据,
像这样,
<script runat="server">
protected void ReloadData(object sender, DirectEventArgs e)
{
Store store = this.Chart1.GetStore();
store.DataSource = Ext.Net.Examples.ChartData.GenerateData();
store.DataBind();
}
</script>
如何在 ReloadData 方法中再次绑定我的 sqldatasource。
我的简化代码在这里;
图表.aspx
<ext:Panel ID="Panel1"
runat="server"
Layout="FitLayout" Flex="1">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server" Flex="1">
<Items>
<ext:Button ID="Button1"
runat="server"
Text=""
Icon="ArrowRefresh"
OnDirectClick="ReloadData" />
......
......
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:Chart ID="Chart1" runat="server" Shadow="true" StyleSpec="background:#fff" Animate="true" ColumnWidth="0.5" Flex="1">
<HtmlBin>
<asp:SqlDataSource ID="datasource1"
runat="server" ConnectionString="<%$ ConnectionStrings:AProjeConnectionString %>"
SelectCommand="SELECT COUNT(*)
....
....
">
</asp:SqlDataSource>
</HtmlBin>
<Store>
<ext:Store ID="Store1"
runat="server"
DataSourceID="datasource1"
AutoDataBind="true">
<Model>
.....
.....
</Model>
</ext:Store>
</Store>
<Axes>
<ext:NumericAxis
Fields="O"
Grid="true"
Title="S"
Minimum="0">
<Label>
<Renderer Handler="return
Ext.util.Format.number(value, '0,0');" />
</Label>
</ext:NumericAxis>
<ext:CategoryAxis
Position="Bottom"
Fields="Ad"
Title=""
Width="75"
/>
</Axes>
<Series>
<ext:ColumnSeries
......
......
......
</ext:ColumnSeries>
</Series>
</ext:Chart>
......
......
谢谢你。