2016-12-30 19 views
0

我有一個Asp圖表control.I添加了一個數據源到我的圖表。現在我想刷新我的圖表系列每一個小時。我不想刷新整個圖表。我只想刷新圖表系列(動態圖表)。幫我解決我的問題。答案而不是評論是讚賞。Asp圖表系列刷新相對於時間

<asp:UpdatePanel ID="UpdatePanel3" runat="server"> 
    <ContentTemplate> 
     <asp:Timer ID="Timer1" runat="server"> 
     </asp:Timer> 
     <asp:Chart ID="Chart1" runat="server" onload="Chart1_Load" " BorderColor="#1A3B69"> 
      <Series> 
       <asp:Series Name="Series0" ChartType="Line" Color="#00ccff" XValueMember="Time" YValueMembers="Inuse" ChartArea="ChartArea1" Legend="Legend1"></asp:Series> 
      </Series> 
      <ChartAreas> 
       <asp:ChartArea Name="ChartArea1" BackGradientStyle="TopBottom"> 
        <AxisY Interval="3" Maximum="30" Minimum="0" Title="No of Bikes"> 
        </AxisY> 
        <AxisX Title="Time"> 
         <MajorGrid LineWidth="0" /> 
        </AxisX> 
       </asp:ChartArea> 
      </ChartAreas> 
      <Legends> 
       <asp:Legend Name="Legend1"></asp:Legend> 
      </Legends> 
     </asp:Chart> 
    </ContentTemplate> 
</asp:UpdatePanel> 

C#: 
private void chartload() 
{ 
Chart1.DataSource = dv; 
Chart1.DataBind(); 
} 

回答

0

創建計時器滴答事件,並設置間隔(毫秒)

<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="3600000"></asp:Timer> 

和C#

protected void Timer1_Tick(object sender, EventArgs e) 
    { 
     //call chartload method 
     chartload(); 
    } 
+0

在方法整個圖表將刷新。我想刷新單獨系列。@ Amit Mishra – monica