I need to create a website which present a number of charts (preferably line graphs) which will actively (in real time) display data as it is being read from a sensor. I have successfully created active live charts in Windows Forms Application, however they do not let display my data on an internet website.
Therefore I have attempted to create a simple graph in an ASP.NET Application using a Web Forms ASP.NET 4.5.2 template. The Default.aspx.cs code was simple and as I was trying to plot a point on a graph every 500 ms whenever button 1 is pressed. However when I opened the application in my browser pressing button 1 caused the timer to activate, but the graph remained blank (flickered on the screen). Please can somebody help me create a chart that can actively update to display new data as it is captured/generated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class _Default : Page
{
int i = 0;
protected void Page_Load(object sender, EventArgs e)
{
Timer1.Interval = 1000;
}
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
this.Chart1.Series["Series1"].Points.AddXY(i, i);
i++;
}
}
}