Ref: https://www.raefkobeissi.com/aa/index2.aspx
Hello,
I've been working on a dynamic chart using DATA MS Charts in ASP.Net + AJAX Controls (Time and an update panel) I managed to make it work but I have a flickering problem. everytime the timer ticks and the chart updates a new chart image is loaded and this is causing flickering. Does anyone have any solution to this flickering problem:
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %><%@ Page Language="VB" AutoEventWireup="true" %><script runat="server">
Shared i
Shared c = -1
Shared a
Shared mm(6, 99)
Shared dt = 0.01
Shared dx = 0.1
Shared AC(6)
Shared FC(6)
Shared d = 0
Shared J = 0
Shared AA(6)
Shared CO() = {1, 2, 3, 4, 5, 6, 7}
Protected Sub Timer1_Tick(sender As Object, e As EventArgs)
c = c + 1
While J < 7
AA(J) = mm(J, c)
J = J + 1
End While
J = 0
Chart1.Series(0).Points.DataBindXY(CO, AA)
Label1.Text = c
Chart1.Series(0).BorderWidth = 2
Chart1.ResetAutoValues()
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs)
i = 0
While i < 100
mm(0, i) = Val(TextBox1.Text)
i = i + 1
End While
mm(1, 0) = 1
mm(2, 0) = 1
mm(3, 0) = 2
mm(4, 0) = 2
mm(5, 0) = 1
mm(6, 0) = 1
i = 1
a = 1
While i < 100
While a < 7
mm(a, i) = mm(a, i - 1) - ((mm(a, i - 1) * dt / dx) * (mm(a, i - 1) - mm(a - 1, i - 1)))
a = a + 1
End While
i = i + 1
a = 1
End While
Timer1.Interval = 1500
Timer1.Enabled = True
End Sub</script><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true" ></asp:ScriptManager><asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick"></asp:Timer><asp:UpdatePanel ID="UpdatePanel1" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><div style="position: absolute; width: 622px; height: 365px; z-index: 1; left: 751px; top: 127px" id="layer1"><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -153px; top: 271px" id="layer6"> </div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 205px" id="layer5"> </div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 135px" id="layer4"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -155px; top: 72px" id="layer3"> <asp:TextBox ID="TextBox1" runat="server" Width="102px"></asp:TextBox></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -156px; top: 11px" id="layer2"> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div><p><asp:Chart ID="Chart1" runat="server" Height="329px" Width="611px"
ImageLocation="~/charts_0/"
ImageStorageMode="UseImageLocation"
ImageType="Png"> <series><asp:Series ChartType="Line" Name="Series1"></asp:Series></series><chartareas><asp:ChartArea Name="ChartArea1"></asp:ChartArea></chartareas></asp:Chart></ContentTemplate></asp:UpdatePanel></form></body></html>
Thank you