public static void UpdatePlot(FormsPlot formsPlot, string title, int chamberNum , Dictionary <string, List <double> > chDataDic , CheckBox cBoxFAM, CheckBox cBoxROX, CheckBox cBoxHEX, CheckBox cBoxCYS, double Ct_FAM, double Ct_ROX, double Ct_HEX, double Ct_CY5) { labelTicks = new List <string>(); formsPlot.plt.Clear(); //formsPlot.Configure(enablePanning: false, enableZooming: false); //vLine = formsPlot1.plt.PlotVLine(0, color: Color.Red, lineStyle: LineStyle.Dash); //hLine = formsPlot1.plt.PlotHLine(0, color: Color.Red, lineStyle: LineStyle.Dash); var dataXList = new List <double>(); //for (int i = 0; i < 30; i++) for (int i = 0; i < chDataDic["FAM"].Count; i++) { dataXList.Add(i); } if (chDataDic["FAM"].Count > 0) { chFAMArray[chamberNum] = formsPlot.plt.PlotScatter(dataXList.ToArray(), chDataDic["FAM"].ToArray(), label: "FAM", lineWidth: 0); //ROX, HEX, CYS chFAMArray[chamberNum].visible = chFAMIsCheck[chamberNum]; } if (chDataDic["ROX"].Count > 0) { chROXArray[chamberNum] = formsPlot.plt.PlotScatter(dataXList.ToArray(), chDataDic["ROX"].ToArray(), label: "ROX", lineWidth: 0); //ROX, HEX, CYS chROXArray[chamberNum].visible = chROXIsCheck[chamberNum]; } if (chDataDic["HEX"].Count > 0) { chHEXArray[chamberNum] = formsPlot.plt.PlotScatter(dataXList.ToArray(), chDataDic["HEX"].ToArray(), label: "HEX", lineWidth: 0); //ROX, HEX, CYS chHEXArray[chamberNum].visible = chHEXIsCheck[chamberNum]; } if (chDataDic["CY5"].Count > 0) { chCY5Array[chamberNum] = formsPlot.plt.PlotScatter(dataXList.ToArray(), chDataDic["CY5"].ToArray(), label: "CY5", lineWidth: 0); //ROX, HEX, CYS chCY5Array[chamberNum].visible = chCY5IsCheck[chamberNum]; } if (chDataDic["FAM"].Count > 3) { var nsi = new ScottPlot.Statistics.Interpolation .NaturalSpline(dataXList.ToArray(), chDataDic["FAM"].ToArray(), resolution: 20); chFAMHLArray[chamberNum] = formsPlot.plt.PlotScatterHighlight(nsi.interpolatedXs, nsi.interpolatedYs , Color.Blue, markerSize: 0); chFAMHLArray[chamberNum].visible = chFAMHLIsCheck[chamberNum]; } if (chDataDic["ROX"].Count > 3) { var nsi = new ScottPlot.Statistics.Interpolation .NaturalSpline(dataXList.ToArray(), chDataDic["ROX"].ToArray(), resolution: 20); chROXHLArray[chamberNum] = formsPlot.plt.PlotScatterHighlight(nsi.interpolatedXs, nsi.interpolatedYs , Color.Orange, markerSize: 0); chROXHLArray[chamberNum].visible = chROXHLIsCheck[chamberNum]; } if (chDataDic["HEX"].Count > 3) { var nsi = new ScottPlot.Statistics.Interpolation .NaturalSpline(dataXList.ToArray(), chDataDic["HEX"].ToArray(), resolution: 20); chHEXHLArray[chamberNum] = formsPlot.plt.PlotScatterHighlight(nsi.interpolatedXs, nsi.interpolatedYs , Color.Green, markerSize: 0); chHEXHLArray[chamberNum].visible = chHEXHLIsCheck[chamberNum]; } if (chDataDic["CY5"].Count > 3) { var nsi = new ScottPlot.Statistics.Interpolation .NaturalSpline(dataXList.ToArray(), chDataDic["CY5"].ToArray(), resolution: 20); chCY5HLArray[chamberNum] = formsPlot.plt.PlotScatterHighlight(nsi.interpolatedXs, nsi.interpolatedYs , Color.Red, markerSize: 0); chCY5HLArray[chamberNum].visible = chCY5HLIsCheck[chamberNum]; } //formsPlot.plt.AxisAutoX(expandOnly: true); for (int i = 0; i < dataXList.Count; i++) { if (i < COL_CNT) { labelTicksArray[i] = Optic_Measure_Idx[i].ToString(); } labelTicks.Add(labelTicksArray[i]); } //for (int i = 0; i < dataXList.Count; i++) formsPlot.plt.XTicks(dataXList.ToArray(), labelTicks.ToArray()); formsPlot.plt.Title(title); formsPlot.plt.Legend(location: legendLocation.upperLeft); formsPlot.plt.Axis(0, COL_CNT - 1, 0, 3000); formsPlot.plt.Layout(xLabelHeight: 40); formsPlot.Configure(recalculateLayoutOnMouseUp: false); formsPlot.plt.PlotHLine(y: Ct_FAM, label: "FAM baseline"); formsPlot.plt.PlotHLine(y: Ct_ROX, label: "ROX baseline"); formsPlot.plt.PlotHLine(y: Ct_HEX, label: "HEX baseline"); formsPlot.plt.PlotHLine(y: Ct_CY5, label: "CY5 baseline"); //formsPlot.plt.TightenLayout(padding: 40); formsPlot.Render(); }
void PlotScottPlot(FormsPlot chart, List <List <double> > dados, int nSens) { chart.plt.Clear(); Color[] colors = { Color.FromArgb(51, 205, 117), Color.Blue, Color.Magenta }; double maxY = 0; double minY = 0; for (int i = 0; i < nSens; i++) { chart.plt.PlotSignal(dados[i].ToArray(), sampleRate: 1, markerSize: 1, color: colors[i]); double maxYS = dados[i].Max(); double minYS = dados[i].Min(); if (maxYS > maxY) { maxY = maxYS; } if (minYS < minY) { minY = minYS; } } chart.plt.Ticks( displayTicksX: true, displayTicksXminor: false, displayTickLabelsX: true, displayTicksY: true, displayTicksYminor: true, displayTickLabelsY: true, color: Color.Black, useMultiplierNotation: false, useOffsetNotation: false, useExponentialNotation: false, fontName: "Arial", fontSize: 10); chart.Configure( enablePanning: true, enableZooming: true, enableRightClickMenu: true, lowQualityWhileDragging: false, enableDoubleClickBenchmark: true, lockVerticalAxis: false, lockHorizontalAxis: false, equalAxes: false); chart.plt.YLabel("Kg", bold: true); chart.plt.XLabel("Segundos", bold: true); chart.plt.Title(enable: true); double Ysize = maxY - minY; double Ytick = Ysize / 4.0; double[] YtickPositions = { maxY, maxY - 1.0 * Ytick, maxY - 2.0 * Ytick, maxY - 3.0 * Ytick, maxY - 4.0 * Ytick }; string[] YtickLabels = { maxY.ToString("0.00"), (maxY - 1.0 * Ytick).ToString("0.00"), (maxY - 2.0 * Ytick).ToString("0.00"), (maxY - 3.0 * Ytick).ToString("0.00"), (maxY - 4.0 * Ytick).ToString("0.00") }; chart.plt.YTicks(YtickPositions, YtickLabels); double Xmax = dados[0].Count; double Xmin = 0; double Xsize = Xmax - Xmin; double Xtick = Xsize / 4.0; double[] XtickPositions = { Xmax, Xmax - 1.0 * Xtick, Xmax - 2.0 * Xtick, Xmax - 3.0 * Xtick, Xmax - 4.0 * Xtick }; string[] XtickLabels = { (Xmax / 1000).ToString(), ((Xmax - 1.0 * Xtick) / 1000).ToString(), ((Xmax - 2.0 * Xtick) / 1000).ToString(), ((Xmax - 3.0 * Xtick) / 1000).ToString(), ((Xmax - 4.0 * Xtick) / 1000).ToString() }; chart.plt.XTicks(XtickPositions, XtickLabels); chart.plt.Axis(0, Xmax, minY, maxY); if (nSens == 1) { chart.plt.Title("Plataforma Vertical"); } else if (nSens == 2) { chart.plt.Title("Plataforma Bilatera"); } else if (nSens == 3) { chart.plt.Title("Plataforma Tridimensional"); } chart.plt.TightenLayout(padding: 0, render: true); chart.plt.Frame(drawFrame: true, left: true, right: true, top: true, bottom: true, frameColor: null); chart.plt.Style(figBg: Color.Transparent); //FromArgb(246, 249, 0)); chart.BackColor = Color.Transparent; //FromArgb(246, 249, 0)); chart.Render(); }