/// <summary> /// This function is to be called after you have pushed new magnitude(s) /// to the graph's lines and want the control re-rendered to take the /// changes into account. /// </summary> public void UpdateGraph() { if (this.InvokeRequired) { UpdateGraphCallback d = new UpdateGraphCallback(UpdateGraph); this.Invoke(d, new object[] { }); } else { int greatestMCount = 0; foreach (Line line in m_Lines) { if (greatestMCount < line.m_MagnitudeList.Count) { greatestMCount = line.m_MagnitudeList.Count; } } if (greatestMCount >= m_MaxCoords) { m_MoveOffset = (m_MoveOffset - (((greatestMCount - m_MaxCoords) + 1) * m_LineInterval)) % m_GridSize; } this.Refresh(); } }
public void UpdateGraph(float displacement, float voltage) { if (this.forceDisplacementChart.InvokeRequired) { UpdateGraphCallback d = new UpdateGraphCallback(UpdateGraph); this.Invoke(d, new object[] {displacement, voltage}); } else { float force = -0.69f * voltage + .09f; //*********************************** FORCE EQUATION ******************************************\\ forceDisplacementChart.Series[0].Points.AddXY(displacement, force); forceLabel.Text = "Force: " + force.ToString("n4") + " (mg)"; voltageLabel.Text = "Voltage: " + voltage.ToString("n4") + " (v)"; } }
//Updates the graph. private void UpdateGraph(string as_series, double ad_fitness) { try { if (this.cha_line_ga.InvokeRequired) { UpdateGraphCallback lo_cb = new UpdateGraphCallback(UpdateGraph); this.Invoke(lo_cb, new Object[] { as_series, ad_fitness }); } else { cha_line_ga.Series[as_series].Points.AddY(ad_fitness); } } catch (Exception e) { } }