Well from what i know Update panel just updates asp panel according to a timer tick. Then data is populated using the getData() function. As I said before I used Bortosky's Libs for using google chart in asp.net. So these libs convert my ASP type data table to google type data table as seen in Page_Load()
On Monday, 12 November 2012 19:33:26 UTC+1, asgallant wrote: > > What does an ASP update panel do? How is "fundata" getting populated? > > On Monday, November 12, 2012 1:10:26 PM UTC-5, Jishnu U wrote: >> >> Hi >> I'm using Bortosky Google Visualisation Library >> http://code.google.com/p/bortosky-google-visualization/ >> to plot a line chart on my web page. I need to update the chart when I >> new data is put into the data base, i tried using update panel. But it >> doesnt work. Im doing this for the first time, if Im totally wrong.If so >> How would I implement it.? >> >> Here is the code im working on: >> >> <asp:UpdatePanel ID="UpdatePanel3" runat="server" >> UpdateMode="Conditional"> >> <Triggers> >> <asp:AsyncPostBackTrigger ControlID="Timer1" /> >> </Triggers> >> <contenttemplate> >> >> >> <%@ Import Namespace = "WeatherLibrary" %> >> >> <script runat="server"> >> protected void Page_Load(object sender, EventArgs e) >> { >> >> Label1.Text = DateTime.Now.ToLongTimeString(); >> >> Label2.Text = DateTime.Now.ToLongDateString(); >> PullData(); >> >> >> var googleDataTable = new >> Bortosky.Google.Visualization.GoogleDataTable(getData(0)); >> >> Page.ClientScript.RegisterStartupScript( >> this.GetType(), "vis", string.Format("var fundata = {0};", >> googleDataTable.GetJson()), true); >> } >> >> >> >> System.Data.DataTable getData(int i) // a DataTable filled using a >> custom library >> { >> var dt = new System.Data.DataTable(); >> String[] sensorName = new String[] { "umtTemp1", "umtWindSpeed" }; >> dt.Columns.Add("Time", typeof(System.String)).Caption = "Time Stamp"; >> dt.Columns.Add("Value", typeof(System.Double)).Caption = "Measured >> Value"; >> WeatherData wLib = new WeatherData(); >> DateTime baseDate = DateTime.Today; >> var format = "yyyy-MM-dd HH:mm:ss"; >> >> var now = DateTime.Now.ToString(format); >> var frm = baseDate.AddHours(-1).ToString(format); >> >> >> >> var value = wLib.GetWeatherItemData(sensorName[i], frm, now).Value; >> var time = wLib.GetWeatherItemData(sensorName[i], frm,now).TimeStamp; >> var k=0; >> >> for ( k = 0; k < value.Length; k++) >> { >> dt.Rows.Add(new object[] { time[k], Math.Round(value[k],1) }); >> >> } >> >> return dt; >> } >> >> <script type="text/javascript" src="http://www.google.com/jsapi"></script> >> <script type="text/javascript"> >> google.load("visualization", "1", { "packages": ["corechart"] }); >> google.setOnLoadCallback(function () { >> var data = new google.visualization.DataTable(fundata, 0.5); >> var chart = new >> google.visualization.LineChart(document.getElementById("chart_div")); >> chart.draw(data, { title: "Chart1", hAxis: { title: "Time Stamp" }, >> vAxis: { title: "Measured Value"} }); >> });</script> >> </contenttemplate> >> </asp:UpdatePanel> >> >> <div id="chart_div" style="width:100%; height: 500px;"></div> >> >> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/_6vA0WR11MEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
