I have a function A
that loops every second up till 120 seconds and calls a plotting function B
that generates chart using XPlot.Plotly
and returns the html string
of that chart. The function A
gets the html
and gives input to the webBrowser element that displays the chart in the form.
However, every second when it loops the browser blanks out and shows the new html chart. This is a bit annoying. Is there a way where I can seamlessly update the html in the web browser element. I am trying to achieve a live-plot scenario. The code is given below,
private async void simpleButton3_Click(object sender, EventArgs e)
{
LiveEnvelopeChartGenerator liveEnvelopeChartGenerator = new LiveEnvelopeChartGenerator(23476, 7);
string lastCycleTimestamp = liveEnvelopeChartGenerator.GetLastCycleEndTime();
for (int i = 0; i < 121; i++)
{
var currentAttrData = liveEnvelopeChartGenerator.GetLatestAttributeValuesFromLastCycleEndTime(lastCycleTimestamp, i);
string html = liveEnvelopeChartGenerator.PlotTraces_(currentAttrData); // gets the html string
await Task.Run(() => this.webBrowserLiveEnvelope1.DocumentText = html);
//System.Threading.Thread.Sleep(1);
}
}