private void plotScatterGraphHelper(ScatterPlot plot, double[] x, double[] y) { lock (this) { plot.ClearData(); plot.PlotXY(x, y); } }
/** * Fills the given chart with data from the given sensor. * * @author Martin Turon * @version 2004/4/28 mturon Initial version */ public void ChartUpdate(uint chartNum) { double[] xData, yData; ScatterGraph chartThis = m_chart[chartNum]; string sensor = m_chartSensor[chartNum]; if (!chartThis.Visible) return; foreach (MoteInfo moteInfo in theMoteTable.Instance.Values) { if ((moteInfo.m_flags & MoteFlags.MF_PLOT) > 0) { int nodeid = moteInfo.m_nodeid; if ((moteInfo.m_plot[chartNum] != null) && (chartThis.Plots.Contains(moteInfo.m_plot[chartNum]))) continue; // FillRandom(out xData, out yData); if (FillNode(moteInfo, sensor, out xData, out yData) == 0) continue; // The colors red and blue are flipped in the VB6 activeX chart component... // This code provides a good example of how to convert Color objects // into unsigned integer and back in C#. See also MoteTable.m_colors. //Color color = moteInfo.m_color; //Color colorConvert = Color.FromArgb(color.B, color.G, color.R); //uint colorPlot = (uint)colorConvert.ToArgb(); ScatterPlot plot = new ScatterPlot(m_xAxes[chartNum], m_yAxes[chartNum]); plot.LineWidth = 2; plot.LineColor = moteInfo.m_color; plot.PointColor = moteInfo.m_color; plot.PointStyle = PointStyle.SolidCircle; plot.CanScaleXAxis = true; plot.CanScaleYAxis = true; plot.PlotXY(xData, yData); chartThis.Plots.Add(plot); moteInfo.m_plot[chartNum] = plot; } else { ScatterPlot plot = moteInfo.m_plot[chartNum]; if (plot != null) { chartThis.Plots.Remove(plot); moteInfo.m_plot[chartNum] = null; } } } }
private static void ScatterGraphPlotHelper(ScatterPlot plot, double[] x, double[] y) { plot.ClearData(); plot.PlotXY(x, y); }