2016-12-30 20 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