public void VoronoiWithZeroSitesThrowsArgumentException() { points = 0; border = new Rectangle(new Point(0, 10), new Point(10, 0)); scatterPlot = new ScatterPlot(border, points); Assert.Throws <ArgumentException>(() => scatterPlot.Voronoi()); }
public GraphicsPage() { Title = "Graphics"; var physics = new Physics(); var points = new List <Vector2>(); var position = new Vector2(0, 0); for (int i = 0; i < 20; i++) { position = physics.Trajectory(position, i, 45f, 100f); points.Add(position); } var xValues = points.Select(x => x.X.ToDouble()).ToArray(); var yValues = points.Select(x => x.Y.ToDouble()).ToArray(); var signalPlot = new ScatterPlot(xValues, yValues) { }; var wpfPlot = new WpfPlot(); var plot = new Plot(); plot.Add(signalPlot); wpfPlot.Plot.Add(signalPlot); var view = new Grid(); view.Children.Add(wpfPlot); Content = view; }
public void Test_Scatter_Color() { var plt = new ScottPlot.Plot(); // start with default settings double[] xs = { 1, 2, 3, 4 }; double[] ys = { 1, 4, 9, 16 }; var splt = new ScatterPlot(xs, ys) { }; plt.Add(splt); var bmp1 = TestTools.GetLowQualityBitmap(plt); // change the plottable splt.Color = System.Drawing.Color.Gray; var bmp2 = TestTools.GetLowQualityBitmap(plt); // measure what changed //TestTools.SaveFig(bmp1, "1"); //TestTools.SaveFig(bmp2, "2"); var before = new MeanPixel(bmp1); var after = new MeanPixel(bmp2); Console.WriteLine($"Before: {before}"); Console.WriteLine($"After: {after}"); Assert.That(after.IsLighterThan(before)); }
private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForAllStints(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping) { IColorPaletteProvider colorPaletteProvider = new BasicColorPaletteProvider(); List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>(); IEnumerable <IGrouping <int, LapTelemetryDto> > lapsInStints = lapsStintGrouping as IGrouping <int, LapTelemetryDto>[] ?? lapsStintGrouping.ToArray(); string title = BuildTitleForAllStints(lapsInStints); double maxG = 0; AxisDefinition xAxis = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Lat Acc"); AxisDefinition yAxis = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Long Acc"); ScatterPlot scatterPlot = new ScatterPlot(title, xAxis, yAxis); foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsInStints) { string seriesTitle = $"Laps: {string.Join(", ", lapsInStint.Select(x => x.LapSummary.CustomDisplayName))} - Stint: {lapsInStint.Key}"; ScatterPlotSeries newSeries = _dataExtractor.ExtractSeries(lapsInStint, Enumerable.Empty <ITelemetryFilter>().ToList(), seriesTitle, colorPaletteProvider.GetNext().ToOxyColor()); scatterPlot.AddScatterPlotSeries(newSeries); maxG = Math.Max(maxG, newSeries.DataPoints.Max(x => Math.Abs(x.Y))); } SetAxisRanges(maxG, xAxis, yAxis); ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization) { Title = "Lateral / Longitudinal G" }; viewModel.FromModel(scatterPlot); charts.Add(viewModel); return(charts); }
public void Test_Scatter_LineWidth() { var plt = new ScottPlot.Plot(); // start with default settings double[] xs = { 1, 2, 3, 4 }; double[] ys = { 1, 4, 9, 16 }; double[] xErr = { .15, .15, .5, .5 }; double[] yErr = { .5, .5, 1, 1 }; var splt = new ScatterPlot(xs, ys, xErr, yErr) { }; plt.Add(splt); var bmp1 = TestTools.GetLowQualityBitmap(plt); // change the plottable splt.LineWidth += 1; var bmp2 = TestTools.GetLowQualityBitmap(plt); // measure what changed //TestTools.SaveFig(bmp1, "1"); //TestTools.SaveFig(bmp2, "2"); var before = new MeanPixel(bmp1); var after = new MeanPixel(bmp2); Console.WriteLine($"Before: {before}"); Console.WriteLine($"After: {after}"); Assert.That(after.IsDarkerThan(before)); }
public void SetUp() { _plot = new Plot(); _plots = new List <Plot> { _plot }; _plotDto = new PlotDto(); _plotDtos = new List <PlotDto> { _plotDto }; _scatterPlot = new ScatterPlotBuilder().Build(); _scatterPlot.SetPlots(_plots); _mockRepository = new Mock <IViewRepository>(); _mockRepository.Setup(p => p.Get <ScatterPlot>()) .Returns(_scatterPlot); _mockAdapter = new Mock <IScatterPlotAdapter>(); _mockAdapter.Setup(p => p.Adapt(_plots)) .Returns(_plotDtos); _handler = new GetPlotsQueryHandler( _mockRepository.Object, _mockAdapter.Object); }
public void BothCellVertices(int pointCount) { border = new Rectangle(new Point(0, 10), new Point(10, 0)); scatterPlot = new ScatterPlot(border, pointCount); voronoi = scatterPlot.Voronoi(); Assert.AreEqual(pointCount, voronoi.Cells().Count()); }
public void Test_Scatter_MarkerShape() { var plt = new ScottPlot.Plot(); // start with default settings double[] xs = { 1, 2, 3, 4 }; double[] ys = { 1, 4, 9, 16 }; var splt = new ScatterPlot(xs, ys) { MarkerSize = 20, MarkerShape = MarkerShape.filledCircle }; plt.Add(splt); var bmp1 = TestTools.GetLowQualityBitmap(plt); // change the plottable splt.MarkerShape = MarkerShape.openCircle; var bmp2 = TestTools.GetLowQualityBitmap(plt); // measure what changed //TestTools.SaveFig(bmp1, "1"); //TestTools.SaveFig(bmp2, "2"); var before = new MeanPixel(bmp1); var after = new MeanPixel(bmp2); Console.WriteLine($"Before: {before}"); Console.WriteLine($"After: {after}"); Assert.That(after.IsLighterThan(before)); }
public void SetUp() { _row = new RowBuilder() .WithId(1) .WithField("http://www.test.com") .Build(); _column = new ColumnBuilder() .WithIndex(0) .Build(); _layout = new ScatterPlotLayoutBuilder() .WithLinkColumn(_column) .Build(); _view = new ScatterPlotBuilder() .WithLayout(_layout) .Build(); _mockViewRepository = new Mock <IViewRepository>(); _mockViewRepository.Setup(p => p.Get <ScatterPlot>()) .Returns(_view); _mockRowRepository = new Mock <IRowRepository>(); _mockRowRepository.Setup(p => p.Get(_row.Id)) .Returns(_row); _mockProcess = new Mock <IProcess>(); _handler = new ExecuteCommandHandler( _mockViewRepository.Object, _mockRowRepository.Object, _mockProcess.Object); }
public HttpResponseMessage Get(string cristinID, CancellationToken cancellationToken) { ScatterPlot searchResults = new ScatterPlot(); try { searchResults = dataAccess.GetScatterData(cristinID, cancellationToken); if (searchResults == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "No data found for user")); } } catch (OperationCanceledException e) { return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message.ToString())); } var Json = new JavaScriptSerializer(); string JsonString = Json.Serialize(searchResults); return(new HttpResponseMessage() { Content = new StringContent(JsonString, Encoding.UTF8, "application/json"), StatusCode = HttpStatusCode.OK }); }
private void addChartsToTableLayoutPanel() { List <string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList(); //set scatter plots and histograms for (int x = 1; x < variables.Count + 1; x++) { for (int y = 1; y < variables.Count + 1; y++) { // use historgram if x and y variable are equal if (x == y) { PreprocessingDataTable dataTable = new PreprocessingDataTable(); DataRow dataRow = Content.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram); dataTable.Rows.Add(dataRow); PreprocessingDataTableView pcv = new PreprocessingDataTableView(); pcv.ChartDoubleClick += HistogramDoubleClick; pcv.Content = dataTable; tableLayoutPanel.Controls.Add(pcv, y, x); } //scatter plot else { ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]); PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView(); pspv.ChartDoubleClick += ScatterPlotDoubleClick; pspv.Content = scatterPlot; pspv.Dock = DockStyle.Fill; tableLayoutPanel.Controls.Add(pspv, x, y); } } } }
public IAggregatedChartViewModel CreateAggregatedChartViewModel() { IReadOnlyCollection <LapTelemetryDto> loadedLaps = _loadedLapsCache.LoadedLaps; string title = $"{ChartName} - Laps: {string.Join(", ", loadedLaps.Select(x => x.LapSummary.CustomDisplayName))}"; AxisDefinition xAxis = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Lat Acc"); AxisDefinition yAxis = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Long Acc"); ScatterPlot scatterPlot = new ScatterPlot(title, xAxis, yAxis); for (int i = 0; i < 4; i++) { _throttlePositionFilter.Minimum = i * 0.25;; _throttlePositionFilter.Maximum = (i + 1) * 0.25; string seriesTitle = $"Throttle - {i * 25}% - {(i + 1) * 25:F2}%"; scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(loadedLaps, _filters, seriesTitle, ColorMap[i])); } _throttlePositionFilter.Minimum = 1; _throttlePositionFilter.Maximum = double.MaxValue; scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(loadedLaps, _filters, "Throttle - 100%", ColorMap[4])); ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel() { Title = "Lateral / Longitudinal G" }; viewModel.FromModel(scatterPlot); return(viewModel); }
public static void TestScatterPlot() { // the PlotView is a WPF control that's created in the .xaml code OxyPlot.Wpf.PlotView examplePlotView = new OxyPlot.Wpf.PlotView(); // just some example data to plot var datapoint1 = new Datum(0, 1); var datapoint2 = new Datum(2, 3); // create the plot Plot plot = new ScatterPlot(examplePlotView, new List <Datum> { datapoint1, datapoint2 }, markerColor: OxyColors.Blue, xAxisLabel: "xAxis", yAxisLabel: "yAxis", chartTitle: "title", chartSubtitle: "subtitle"); // check to make sure the data was plotted Assert.That(plot.Model.Series.Count == 1); var series = plot.Model.Series[0]; var points = ((ScatterSeries)series).ActualPoints; Assert.That(points.Count == 2); Assert.That(points[0].X == 0); Assert.That(points[0].Y == 1); Assert.That(points[1].X == 2); Assert.That(points[1].Y == 3); Assert.That(((ScatterSeries)series).ActualMarkerFillColor == OxyColors.Blue); Assert.That(plot.Model.Title == "title"); Assert.That(plot.Model.Subtitle == "subtitle"); Assert.That(plot.Model.Axes[0].Title == "xAxis"); Assert.That(plot.Model.Axes[1].Title == "yAxis"); }
public ScatterPlotVisualPropertiesDialog(ScatterPlot scatterPlot) { InitializeComponent(); #region Prepare controls upButton.Text = string.Empty; upButton.Image = VSImageLibrary.ArrowUp; downButton.Text = string.Empty; downButton.Image = VSImageLibrary.ArrowDown; seriesListView.Items.Clear(); seriesListView.SmallImageList = new ImageList(); seriesListView.SmallImageList.Images.Add(VSImageLibrary.Graph); #endregion Content = scatterPlot; originalScatterPlotVPs = (ScatterPlotVisualProperties)Content.VisualProperties.Clone(); originalScatterPlotDataRowVPs = new Dictionary <string, ScatterPlotDataRowVisualProperties>(); foreach (ScatterPlotDataRow row in Content.Rows) { originalScatterPlotDataRowVPs.Add(row.Name, (ScatterPlotDataRowVisualProperties)row.VisualProperties.Clone()); } dataTableVisualPropertiesControl.Content = Content.VisualProperties; modifiedDisplayNames = new HashSet <string>(); FillSeriesListView(); RegisterContentEvents(); }
protected IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForEachStint(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping, AggregatedChartSettingsDto aggregatedChartSettings) { List <IAggregatedChartViewModel> charts = new List <IAggregatedChartViewModel>(); foreach (IGrouping <int, LapTelemetryDto> lapsInStintGroup in lapsStintGrouping) { string title = BuildChartTitle(lapsInStintGroup, aggregatedChartSettings); AxisDefinition xAxis = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit); AxisDefinition yAxis = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit); ScatterPlot scatterPlot = new ScatterPlot(title, xAxis, yAxis) { IsLegendVisible = IsLegendVisible }; scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeries(lapsInStintGroup, Enumerable.Empty <ITelemetryFilter>().ToList(), title, OxyColors.Green)); ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization) { Title = ChartName }; viewModel.FromModel(scatterPlot); charts.Add(viewModel); } return(charts); }
public ScatterPlot PlotScatter( double[] xs, double[] ys, Color?color = null, double lineWidth = 1, double markerSize = 5, string label = null, double[] errorX = null, double[] errorY = null, double errorLineWidth = 1, double errorCapSize = 3, MarkerShape markerShape = MarkerShape.filledCircle, LineStyle lineStyle = LineStyle.Solid ) { var scatterPlot = new ScatterPlot(xs, ys, errorX, errorY) { color = color ?? settings.GetNextColor(), lineWidth = lineWidth, markerSize = (float)markerSize, label = label, errorLineWidth = (float)errorLineWidth, errorCapSize = (float)errorCapSize, stepDisplay = false, markerShape = markerShape, lineStyle = lineStyle }; Add(scatterPlot); return(scatterPlot); }
public void SetUp() { _column = new ColumnBuilder().Build(); _filters = new List <Filter>(); _rows = new List <Row>(); _plots = new List <Plot>(); _layout = new ScatterPlotLayout(); _scatterPlot = new ScatterPlot(_layout, new Rect(), _plots); _mockFilterRepository = new Mock <IFilterRepository>(); _mockFilterRepository.Setup(p => p.GetAll()).Returns(_filters); _mockDataRepository = new Mock <IRowRepository>(); _mockDataRepository.Setup(p => p.GetAll()).Returns(_rows); _mockViewRepository = new Mock <IViewRepository>(); _mockViewRepository.Setup(p => p.Get <ScatterPlot>()).Returns(_scatterPlot); _mockRenderer = new Mock <IScatterPlotRenderer>(); _mockRenderer.Setup(p => p.RenderPlots(new List <Row>(), _layout)).Returns(new List <Plot>()); _handler = new UpdatePlotsCommandHandler( _mockFilterRepository.Object, _mockDataRepository.Object, _mockViewRepository.Object, _mockRenderer.Object); }
private IReadOnlyCollection <IAggregatedChartViewModel> CreateChartForAllStints(IEnumerable <IGrouping <int, LapTelemetryDto> > lapsStintGrouping) { var lapsInStints = lapsStintGrouping as IGrouping <int, LapTelemetryDto>[] ?? lapsStintGrouping.ToArray(); string title = BuildTitleForAllStints(lapsInStints); IColorPaletteProvider colorPaletteProvider = new BasicColorPaletteProvider(); AxisDefinition xAxis = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 4, _dataExtractor.XUnit, "Rear Roll Angle"); AxisDefinition yAxis = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit, "Front Roll Angle"); ScatterPlot scatterPlot = new ScatterPlot(title, xAxis, yAxis); _lateralAccFilter.MinimumG = 0; _lateralAccFilter.MaximumG = double.MaxValue; foreach (IGrouping <int, LapTelemetryDto> lapsInStint in lapsInStints) { string seriesTitle = BuildSeriesTitle(lapsInStint); ScatterPlotSeries newSeries = _dataExtractor.ExtractSeries(lapsInStint, _filters, seriesTitle, colorPaletteProvider.GetNext().ToOxyColor()); scatterPlot.AddScatterPlotSeries(newSeries); } scatterPlot.AddAnnotation(new LineAnnotation() { Slope = 1, Intercept = 0, Color = OxyColors.Red, StrokeThickness = 1, LineStyle = LineStyle.Solid }); ScatterPlotChartViewModel viewModel = new ScatterPlotChartViewModel(_dataPointSelectionSynchronization) { Title = title }; viewModel.FromModel(scatterPlot); return(new[] { viewModel }); }
public void SetUp() { _column = new ColumnBuilder() .WithId(1) .Build(); _layout = new ScatterPlotLayout(); _view = new ScatterPlotBuilder() .WithLayout(_layout) .Build(); var blankColumn = new ColumnBuilder().Build(); _layout.XAxisColumn = blankColumn; _layout.YAxisColumn = blankColumn; _layout.SizeColumn = blankColumn; _layout.ColorColumn = blankColumn; _layout.ShapeColumn = blankColumn; _layout.LabelColumn = blankColumn; _layout.LinkColumn = blankColumn; _mockColumnRepository = new Mock <IColumnRepository>(); _mockColumnRepository.Setup(p => p.Get(_column.Id)) .Returns(_column); _mockViewRepository = new Mock <IViewRepository>(); _mockViewRepository.Setup(p => p.Get <ScatterPlot>()) .Returns(_view); _mockEventBus = new Mock <IEventBus>(); _handler = new AutoLayoutColumnCommandHandler( _mockColumnRepository.Object, _mockViewRepository.Object, _mockEventBus.Object); }
public ParetoFrontScatterPlotView() { InitializeComponent(); scatterPlot = new ScatterPlot(); qualitiesRow = new ScatterPlotDataRow("Qualities", string.Empty, Enumerable.Empty <Point2D <double> >()) { VisualProperties = { PointSize = 8, PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle } }; scatterPlot.Rows.Add(qualitiesRow); paretoFrontRow = new ScatterPlotDataRow("Best Known Pareto Front", string.Empty, Enumerable.Empty <Point2D <double> >()) { VisualProperties = { PointSize = 4, PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Square } }; scatterPlot.Rows.Add(paretoFrontRow); }
public void SetUp() { requestedRadius = 0.05f; sp = new ScatterPlot(new Rectangle(new Point(0, 0.3f), new Point(0.5f, 0)), requestedRadius); float requestedArea = (float)Math.PI * requestedRadius * requestedRadius; expectedPointCount = (int)(sp.rectangle.Area() / requestedArea); }
public void SetUp() { _viewExtent = new Rect(); _scatterPlot = new ScatterPlot(null, _viewExtent, null); _mockRepository = new Mock <IViewRepository>(); _mockRepository.Setup(p => p.Get <ScatterPlot>()).Returns(_scatterPlot); _handler = new GetViewExtentQueryHandler(_mockRepository.Object); }
public void SetUp() { _viewExtent = new Rect(); _scatterPlot = new ScatterPlotBuilder().Build(); _mockRepository = new Mock <IViewRepository>(); _mockRepository.Setup(p => p.Get <ScatterPlot>()).Returns(_scatterPlot); _handler = new SetViewExtentCommandHandler(_mockRepository.Object); }
public void SetUp() { _point = new Point(50d, 50d); _viewExtent = new Rect(0, 0, 100, 100); _scatterPlot = new ScatterPlot(null, _viewExtent, null); _mockRepository = new Mock <IViewRepository>(); _mockRepository.Setup(p => p.Get <ScatterPlot>()).Returns(_scatterPlot); _handler = new ZoomInCommandHandler(_mockRepository.Object); }
protected ScatterPlot CreateScatterPlot(IEnumerable <LapTelemetryDto> loadedLaps, int gear) { AxisDefinition xAxis = new AxisDefinition(_dataExtractor.XMajorTickSize, _dataExtractor.XMajorTickSize / 5, _dataExtractor.XUnit); AxisDefinition yAxis = new AxisDefinition(_dataExtractor.YMajorTickSize, _dataExtractor.YMajorTickSize / 4, _dataExtractor.YUnit); ScatterPlot scatterPlot = new ScatterPlot($"Gear: {gear}", xAxis, yAxis); scatterPlot.AddScatterPlotSeries(_dataExtractor.ExtractSeriesForGear(loadedLaps, gear.ToString())); return(scatterPlot); }
public void SetUp() { _vector = new Vector(0.25, 0.5); _viewExtent = new Rect(0, 0, 1, 1); _scatterPlot = new ScatterPlot(null, _viewExtent, null); _mockRepository = new Mock <IViewRepository>(); _mockRepository.Setup(p => p.Get <ScatterPlot>()).Returns(_scatterPlot); _handler = new PanCommandHandler(_mockRepository.Object); }
protected ScatterPlot CreateScatterPlot(IReadOnlyCollection <LapTelemetryDto> loadedLaps, int gear) { AxisDefinition xAxis = new AxisDefinition(_rpmToHorizontalGExtractor.XMajorTickSize, _rpmToHorizontalGExtractor.XMajorTickSize / 4, _rpmToHorizontalGExtractor.XUnit); AxisDefinition yAxis = new AxisDefinition(_rpmToHorizontalGExtractor.YMajorTickSize, _rpmToHorizontalGExtractor.YMajorTickSize / 4, _rpmToHorizontalGExtractor.YUnit); ScatterPlot scatterPlot = new ScatterPlot($"Gear: {gear}", xAxis, yAxis); scatterPlot.AddScatterPlotSeries(_rpmToHorizontalGExtractor.ExtractSeriesForGear(loadedLaps, gear.ToString())); return(scatterPlot); }
private void plotScatterGraphHelper(ScatterPlot plot, double[] x, double[] y) { lock (this) { plot.ClearData(); plot.PlotXY(x, y); } }
//Open scatter plot in new tab with new content when double clicked private void ScatterPlotDoubleClick(object sender, EventArgs e) { PreprocessingScatterPlotView pspv = (PreprocessingScatterPlotView)sender; ScatterPlotContent scatterContent = new ScatterPlotContent(Content, new Cloner()); // create new content ScatterPlot scatterPlot = pspv.Content; setVariablesInContentFromScatterPlot(scatterContent, scatterPlot); MainFormManager.MainForm.ShowContent(scatterContent, typeof(ScatterPlotSingleView)); // open in new tab }
public void SetUp() { _scatterPlot = new ScatterPlotBuilder().Build(); _mockScatterPlotFactory = new Mock <IScatterPlotFactory>(); _mockScatterPlotFactory.Setup(p => p.Create()) .Returns(_scatterPlot); _factory = new ViewFactory( _mockScatterPlotFactory.Object); }
public ScatterPlotVisualPropertiesDialog(ScatterPlot scatterPlot) { InitializeComponent(); #region Prepare controls upButton.Text = string.Empty; upButton.Image = VSImageLibrary.ArrowUp; downButton.Text = string.Empty; downButton.Image = VSImageLibrary.ArrowDown; seriesListView.Items.Clear(); seriesListView.SmallImageList = new ImageList(); seriesListView.SmallImageList.Images.Add(VSImageLibrary.Graph); #endregion Content = scatterPlot; originalScatterPlotVPs = (ScatterPlotVisualProperties)Content.VisualProperties.Clone(); originalScatterPlotDataRowVPs = new Dictionary<string, ScatterPlotDataRowVisualProperties>(); foreach (ScatterPlotDataRow row in Content.Rows) originalScatterPlotDataRowVPs.Add(row.Name, (ScatterPlotDataRowVisualProperties)row.VisualProperties.Clone()); dataTableVisualPropertiesControl.Content = Content.VisualProperties; modifiedDisplayNames = new HashSet<string>(); FillSeriesListView(); RegisterContentEvents(); }
private void PlotXYAppend(Graph graph, ScatterPlot plot, double[] x, double[] y) { graph.Invoke(new PlotXYDelegate(plot.PlotXYAppend), new Object[] { 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 void scatterGraphPlot(ScatterGraph graph, ScatterPlot plot, double[] x, double[] y) { graph.Invoke(new plotScatterGraphDelegate(plotScatterGraphHelper), new object[] {plot, x, y }); }
protected override void ImplementUserControl() { ScatterGraph scatterGraph = new ScatterGraph(); ScatterPlot scatterPlot = new ScatterPlot(); XAxis xAxis = new XAxis(); YAxis yAxis = new YAxis(); scatterGraph.Border = NationalInstruments.UI.Border.Raised; scatterGraph.Location = new System.Drawing.Point(83, 52); scatterGraph.Name = "scatterGraph"; scatterGraph.PlotAreaBorder = NationalInstruments.UI.Border.ThinFrame3D; scatterGraph.Plots.AddRange(new NationalInstruments.UI.ScatterPlot[] { scatterPlot}); scatterGraph.Size = new System.Drawing.Size(272, 168); scatterGraph.TabIndex = 0; scatterGraph.UseColorGenerator = true; scatterGraph.XAxes.AddRange(new NationalInstruments.UI.XAxis[] { xAxis}); scatterGraph.YAxes.AddRange(new NationalInstruments.UI.YAxis[] { yAxis}); scatterPlot.XAxis = xAxis; scatterPlot.YAxis = yAxis; controlHandle = scatterGraph; InitControl(controlHandle); initContextMenuStrip(); }
// Method to set up the recording side of neurorighter private bool NRAcquisitionSetup() { lock (this) { if (!taskRunning) { try { this.Cursor = Cursors.WaitCursor; if (switch_record.Value) { // Create file name if (filenameBase == null) //user hasn't specified a file button_BrowseOutputFile_Click(null, null); //call file selection routine if (filenameBase == null) //this happens if the user pressed cancel for the dialog { MessageBox.Show("An output file must be selected before recording."); //display an error message this.Cursor = Cursors.Default; return true; } // If the user is just doing repeated recordings if (checkbox_repeatRecord.Checked || Properties.Settings.Default.useFidTimeStamp) { DateTime nowDate = DateTime.Now;//Get current time (local to computer); string datePrefix = nowDate.ToString("'-'yyyy'-'MM'-'dd'-'HH'-'mm'-'ss"); filenameBase = originalNameBase + datePrefix; } // Look for old files with same name string[] matchFiles; try { matchFiles = Directory.GetFiles(currentSaveDir, currentSaveFile + "*"); } catch { matchFiles = new string[0]; } if (matchFiles.Length > 0) { DialogResult dr = MessageBox.Show("File " + filenameBase + " exists. Overwrite?", "NeuroRighter Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dr == DialogResult.No) button_BrowseOutputFile_Click(null, null); //call file selection routine else if (dr == DialogResult.Cancel) { this.Cursor = Cursors.Default; return true; } } // Set file base name + number of channels recordingSettings.SetFID(filenameBase); recordingSettings.SetNumElectrodes(numChannels); } // Find out how many devs and channels/dev we are going to need int numDevices = (numChannels > 32 ? Properties.Settings.Default.AnalogInDevice.Count : 1); numChannelsPerDev = (numChannels < 32 ? numChannels : 32); // Set spike buffer lengths spikeBufferLength = Convert.ToInt32(Properties.Settings.Default.ADCPollingPeriodSec * Properties.Settings.Default.RawSampleFrequency); lfpBufferLength = Convert.ToInt32(Properties.Settings.Default.ADCPollingPeriodSec * Properties.Settings.Default.LFPSampleFrequency); // Create spike aquisition task list spikeTask = new List<Task>(numDevices); Properties.Settings.Default.numSpikeTasks = numDevices; NRAIChannelCollection spikeAqSet = new NRAIChannelCollection(numDevices, numChannelsPerDev); spikeAqSet.SetupSpikeCollection(ref spikeTask); // Check audio and video properties if (Properties.Settings.Default.UseSingleChannelPlayback) spikeOutTask = new Task("spikeOutTask"); //For audio output if (checkBox_video.Checked) //NB: This can't be checked unless video is enabled (no need to check properties) triggerTask = new Task("triggerTask"); // Set MUA sample rate double muaSamplingRate = spikeSamplingRate / MUA_DOWNSAMPLE_FACTOR; //Add LFP channels, if configured if (Properties.Settings.Default.SeparateLFPBoard && Properties.Settings.Default.UseLFPs) { lfpTask = new Task("lfpTask"); for (int i = 0; i < Properties.Settings.Default.NumChannels; ++i) lfpTask.AIChannels.CreateVoltageChannel(Properties.Settings.Default.LFPDevice + "/ai" + i.ToString(), "", AITerminalConfiguration.Nrse, -10.0, 10.0, AIVoltageUnits.Volts); setGain(lfpTask, Properties.Settings.Default.LFPgain); lfpTask.Control(TaskAction.Verify); } //Add EEG channels, if configured if (Properties.Settings.Default.UseEEG) { eegTask = new Task("eegTask"); for (int i = 0; i < Properties.Settings.Default.EEGNumChannels; ++i) eegTask.AIChannels.CreateVoltageChannel(Properties.Settings.Default.EEGDevice + "/ai" + (i).ToString(), "", AITerminalConfiguration.Nrse, -10.0, 10.0, AIVoltageUnits.Volts); setGain(eegTask, (double)Properties.Settings.Default.EEGGain); eegTask.Control(TaskAction.Verify); eegSamplingRate = Properties.Settings.Default.EEGSamplingRate; } //Add channel to control Cineplex, if configured if (checkBox_video.Checked) triggerTask.DOChannels.CreateChannel(Properties.Settings.Default.CineplexDevice + "/Port0/line0:7", "", ChannelLineGrouping.OneChannelForAllLines); //Change gain based on comboBox values (1-100) for (int i = 0; i < spikeTask.Count; ++i) setGain(spikeTask[i], Properties.Settings.Default.A2Dgain); //Verify the Tasks for (int i = 0; i < spikeTask.Count; ++i) spikeTask[i].Control(TaskAction.Verify); //if (Properties.Settings.Default.UseSingleChannelPlayback) // spikeOutTask.Control(TaskAction.Verify); //Get sampling rates, set to private variables spikeSamplingRate = Properties.Settings.Default.RawSampleFrequency; lfpSamplingRate = Properties.Settings.Default.LFPSampleFrequency; //Version with videoTask as master clock if (Properties.Settings.Default.UseCineplex) { for (int i = 0; i < spikeTask.Count; ++i) { spikeTask[i].Timing.ReferenceClockSource = videoTask.Timing.ReferenceClockSource; spikeTask[i].Timing.ReferenceClockRate = videoTask.Timing.ReferenceClockRate; } } else { string masterclock = "/" + Properties.Settings.Default.AnalogInDevice[0].ToString() + "/10MhzRefClock";//"OnboardClock";// if (!Properties.Settings.Default.UseStimulator) { //Deal with non M-series devices (these can't use "ReferenceClockSource" Device analogInDevice = DaqSystem.Local.LoadDevice(Properties.Settings.Default.AnalogInDevice[0]); if (analogInDevice.ProductCategory == ProductCategory.MSeriesDaq || analogInDevice.ProductCategory == ProductCategory.XSeriesDaq) spikeTask[0].Timing.ReferenceClockSource = masterclock; //This will be the master clock } else { spikeTask[0].Timing.ReferenceClockSource = masterclock;//stimPulseTask.Timing.ReferenceClockSource; spikeTask[0].Timing.ReferenceClockRate = 10000000.0; //stimPulseTask.Timing.ReferenceClockRate; } for (int i = 1; i < spikeTask.Count; ++i) //Set other analog in tasks to master clock { spikeTask[i].Timing.ReferenceClockSource = spikeTask[0].Timing.ReferenceClockSource; spikeTask[i].Timing.ReferenceClockRate = spikeTask[0].Timing.ReferenceClockRate; } } spikeTask[0].Timing.ConfigureSampleClock("", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.RawSampleFrequency / 2)); for (int i = 1; i < spikeTask.Count; ++i) { //Pipe ai dev0's sample clock to slave devices spikeTask[i].Timing.ConfigureSampleClock("/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/SampleClock", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.RawSampleFrequency / 2)); //Trigger off of ai dev0's trigger spikeTask[i].Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising); // Manually allocate buffer memory //spikeTask[i].Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; } if (Properties.Settings.Default.SeparateLFPBoard && Properties.Settings.Default.UseLFPs) { lfpTask.Timing.ReferenceClockSource = spikeTask[0].Timing.ReferenceClockSource; lfpTask.Timing.ReferenceClockRate = spikeTask[0].Timing.ReferenceClockRate; lfpTask.Timing.ConfigureSampleClock("", lfpSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.LFPSampleFrequency / 2)); // Manually allocate buffer memory //lfpTask.Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; } else { Properties.Settings.Default.numLFPTasks = Properties.Settings.Default.numSpikeTasks; } if (Properties.Settings.Default.UseEEG) { eegTask.Timing.ReferenceClockSource = spikeTask[0].Timing.ReferenceClockSource; eegTask.Timing.ReferenceClockRate = spikeTask[0].Timing.ReferenceClockRate; eegTask.Timing.ConfigureSampleClock("", eegSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Convert.ToDouble(Properties.Settings.Default.EEGSamplingRate) / 2)); // Manually allocate buffer memory //eegTask.Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; } if (Properties.Settings.Default.UseCineplex) { if (checkBox_video.Checked) { triggerTask.Timing.ConfigureSampleClock("/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/SampleClock", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, 3); } if (Properties.Settings.Default.SeparateLFPBoard && Properties.Settings.Default.UseLFPs) { lfpTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising); } if (Properties.Settings.Default.UseEEG) { eegTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising); } } if (Properties.Settings.Default.UseStimulator && Properties.Settings.Default.RecordStimTimes) { try { numStimReads = new List<int>(numDevices); for (int i = 0; i < spikeTask.Count; ++i) numStimReads.Add(0); stimTimeTask = new Task("stimTimeTask"); stimTimeTask.AIChannels.CreateVoltageChannel(Properties.Settings.Default.StimInfoDevice + "/ai16", "", AITerminalConfiguration.Nrse, -10.0, 10.0, AIVoltageUnits.Volts); stimTimeTask.AIChannels.CreateVoltageChannel(Properties.Settings.Default.StimInfoDevice + "/ai0", "", AITerminalConfiguration.Nrse, -10.0, 10.0, AIVoltageUnits.Volts); //For triggers // Pipe the spikeTasks sample clock to PFI14 on the stim board DaqSystem.Local.ConnectTerminals(spikeTask[0].Timing.ReferenceClockSource, "/" + Properties.Settings.Default.StimulatorDevice.ToString() + "/PFI0"); if (isNormalRecording) stimTimeTask.Timing.ReferenceClockSource = "/" + Properties.Settings.Default.StimulatorDevice.ToString() + "/PFI0"; else stimTimeTask.Timing.ReferenceClockSource = spikeTask[0].Timing.ReferenceClockSource; stimTimeTask.Timing.ReferenceClockRate = spikeTask[0].Timing.ReferenceClockRate; stimTimeTask.Timing.ConfigureSampleClock("", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.RawSampleFrequency / 2)); stimTimeTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger( "/" + Properties.Settings.Default.AnalogInDevice[0] + "/ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising); stimTimeTask.Control(TaskAction.Verify); // stim Timing Channel settings object StringCollection stimTimePhysChan = new StringCollection(); for (int i = 0; i < stimTimeTask.AIChannels.Count; ++i) { stimTimePhysChan.Add(stimTimeTask.AIChannels[i].PhysicalName); } // Write down the indicies corresponding to the portion of this task that will // actually record stimulus infromation instead of aux analog input stimTimeChanSet = new NRAIChannelCollection(stimTimePhysChan); int[] stimTimeChannels = new int[] { 0, 1 }; stimTimeChanSet.SetupNumericalChannelOnly(stimTimeChannels); // Manually allocate buffer memory //stimTimeTask.Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; Console.WriteLine("NRAcquisitionSetup complete"); } catch (Exception e) { MessageBox.Show(e.Message); } } //Setup scaling coefficients (to convert digital values to voltages) scalingCoeffsSpikes = new List<double[]>(spikeTask.Count); for (int i = 0; i < spikeTask.Count; ++i) scalingCoeffsSpikes.Add(spikeTask[0].AIChannels[0].DeviceScalingCoefficients); if (Properties.Settings.Default.SeparateLFPBoard) scalingCoeffsLFPs = lfpTask.AIChannels[0].DeviceScalingCoefficients; if (Properties.Settings.Default.UseEEG) scalingCoeffsEEG = eegTask.AIChannels[0].DeviceScalingCoefficients; // Setup auxiliary recording tasks if (Properties.Settings.Default.useAuxAnalogInput) { // Set up the aux channel set auxChanSet = new NRAIChannelCollection(Properties.Settings.Default.auxAnalogInChan); if (Properties.Settings.Default.auxAnalogInDev == Properties.Settings.Default.StimInfoDevice && Properties.Settings.Default.RecordStimTimes) { // In this case we are recording both stimulus times and aux analog input times on the same // DAQ, so we need to just make the auxAnInTask reference the stimulus timing task twoAITasksOnSingleBoard = true; auxAnInTask = stimTimeTask; auxChanSet.SetupAuxCollection(ref auxAnInTask); } else { // In this case there is no conflict for AI, so we can create a dedicated task for aux analog input twoAITasksOnSingleBoard = false; auxAnInTask = new Task("AuxiliaryAnalogInput"); auxChanSet.SetupAuxCollection(ref auxAnInTask); auxAnInTask.Timing.ReferenceClockSource = spikeTask[0].Timing.ReferenceClockSource; auxAnInTask.Timing.ReferenceClockRate = spikeTask[0].Timing.ReferenceClockRate; //Pipe ai dev0's sample clock to slave devices auxAnInTask.Timing.ConfigureSampleClock("", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.RawSampleFrequency / 2)); auxAnInTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising); // Manually allocate buffer memory // auxAnInTask.Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; // Create space for the buffer auxAnData = new double[auxChanSet.numericalChannels.Length, spikeBufferLength]; } } if (Properties.Settings.Default.useAuxDigitalInput) { auxDigInTask = new Task("AuxiliaryDigitalInput"); auxDigInTask.DIChannels.CreateChannel(Properties.Settings.Default.auxDigitalInPort, "Auxiliary Digitial In", ChannelLineGrouping.OneChannelForAllLines); auxDigInTask.Timing.ConfigureSampleClock("", spikeSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(Properties.Settings.Default.RawSampleFrequency / 2)); auxDigInTask.Timing.SampleClockSource = spikeTask[0].Timing.SampleClockTerminal; // Manually allocate buffer memory // auxDigInTask.Stream.Buffer.InputBufferSize = DAQ_BUFFER_SIZE_SAMPLES; } #region Setup_Plotting numSnipsDisplayed = (int)numericUpDown_NumSnipsDisplayed.Value; #region PlotData_Buffers //*********************** //Make PlotData buffers //*********************** int downsample, numRows, numCols; const double spikeplotlength = 0.25; //in seconds switch (Properties.Settings.Default.NumChannels) { case 16: numRows = numCols = 4; downsample = 10; break; case 32: numRows = numCols = 6; downsample = 15; break; case 64: numRows = numCols = 8; downsample = 20; //if this gets really small, LFP data won't plot break; default: numRows = numCols = 4; downsample = 5; break; } //Create plot colormap NRBrainbow = (64).GenerateBrainbow(); NRSnipBrainbow = (64).GenerateSnipBrainbow(); NRUnitBrainbow = (64).GenerateUnitBrainbow(); //Initialize graphs if (spikeGraph != null) { spikeGraph.Dispose(); spikeGraph = null; } spikeGraph = new GridGraph(); int samplesPerPlot = (int)(Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * spikeSamplingRate / downsample) * (spikeplotlength / Properties.Settings.Default.ADCPollingPeriodSec)); spikeGraph.setup(numRows, numCols, samplesPerPlot, false, 1 / 4.0, spikeTask[0].AIChannels.All.RangeHigh * 2.0); spikeGraph.setMinMax(0, (float)(samplesPerPlot * numCols) - 1, (float)(spikeTask[0].AIChannels.All.RangeLow * (numRows * 2 - 1)), (float)(spikeTask[0].AIChannels.All.RangeHigh)); spikeGraph.Dock = DockStyle.Fill; spikeGraph.Parent = tabPage_spikes; if (Properties.Settings.Default.UseLFPs) { if (lfpGraph != null) { lfpGraph.Dispose(); lfpGraph = null; } lfpGraph = new RowGraph(); lfpGraph.setup(numChannels, (int)((Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * lfpSamplingRate / downsample) * (5 / Properties.Settings.Default.ADCPollingPeriodSec))), 5.0, spikeTask[0].AIChannels.All.RangeHigh * 2.0); if (Properties.Settings.Default.SeparateLFPBoard) lfpGraph.setMinMax(0, 5 * (int)(Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * lfpSamplingRate / downsample) / Properties.Settings.Default.ADCPollingPeriodSec) - 1, (float)(lfpTask.AIChannels.All.RangeLow * (numChannels * 2 - 1)), (float)(lfpTask.AIChannels.All.RangeHigh)); else lfpGraph.setMinMax(0, 5 * (int)(Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * lfpSamplingRate / downsample) / Properties.Settings.Default.ADCPollingPeriodSec) - 1, (float)(spikeTask[0].AIChannels.All.RangeLow * (numChannels * 2 - 1)), (float)(spikeTask[0].AIChannels.All.RangeHigh)); lfpGraph.Dock = DockStyle.Fill; lfpGraph.Parent = tabPage_LFPs; } if (Properties.Settings.Default.ProcessMUA) { if (muaGraph != null) { muaGraph.Dispose(); muaGraph = null; } muaGraph = new RowGraph(); muaGraph.setup(numChannels, (int)((Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * muaSamplingRate / downsample) * (5 / Properties.Settings.Default.ADCPollingPeriodSec))), 5.0, spikeTask[0].AIChannels.All.RangeHigh * 2.0); muaGraph.setMinMax(0, 5 * (int)(Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * muaSamplingRate / downsample) / Properties.Settings.Default.ADCPollingPeriodSec) - 1, (float)(spikeTask[0].AIChannels.All.RangeLow * (numChannels * 2 - 1)), (float)(spikeTask[0].AIChannels.All.RangeHigh)); muaGraph.Dock = DockStyle.Fill; muaGraph.Parent = tabPage_MUA; muaPlotData = new PlotDataRows(numChannels, downsample, (int)(muaSamplingRate * 5), muaSamplingRate, (float)spikeTask[0].AIChannels.All.RangeHigh * 2F, 0.5, 5, Properties.Settings.Default.ADCPollingPeriodSec); //muaPlotData.setGain(Properties.Settings.Default.LFPDisplayGain); //muaGraph.setDisplayGain(Properties.Settings.Default.LFPDisplayGain); muaPlotData.dataAcquired += new PlotData.dataAcquiredHandler(muaPlotData_dataAcquired); } if (Properties.Settings.Default.UseEEG) { if (eegGraph != null) { eegGraph.Dispose(); eegGraph = null; } eegGraph = new RowGraph(); eegGraph.setup(Properties.Settings.Default.EEGNumChannels, (int)((Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * eegSamplingRate / downsample) * (5 / Properties.Settings.Default.ADCPollingPeriodSec))), 5.0, eegTask.AIChannels.All.RangeHigh * 2.0); eegGraph.setMinMax(0, 5 * (int)(Math.Ceiling(Properties.Settings.Default.ADCPollingPeriodSec * eegSamplingRate / downsample) / Properties.Settings.Default.ADCPollingPeriodSec) - 1, (float)(eegTask.AIChannels.All.RangeLow * (Properties.Settings.Default.EEGNumChannels * 2 - 1)), (float)(eegTask.AIChannels.All.RangeHigh)); eegGraph.Dock = DockStyle.Fill; eegGraph.Parent = tabPage_EEG; } resetSpkWfm(); //Take care of spike waveform graph double ampdec = (1 / Properties.Settings.Default.PreAmpGain); spikePlotData = new PlotDataGrid(numChannels, downsample, (int)(spikeSamplingRate), spikeSamplingRate, (float)(spikeTask[0].AIChannels.All.RangeHigh * 2.0), numRows, numCols, spikeplotlength, Properties.Settings.Default.ChannelMapping, Properties.Settings.Default.ADCPollingPeriodSec); spikePlotData.dataAcquired += new PlotData.dataAcquiredHandler(spikePlotData_dataAcquired); spikePlotData.setGain(Properties.Settings.Default.SpikeDisplayGain); spikeGraph.setDisplayGain(Properties.Settings.Default.SpikeDisplayGain); if (Properties.Settings.Default.UseLFPs) { if (Properties.Settings.Default.SeparateLFPBoard) lfpPlotData = new PlotDataRows(numChannels, downsample, (int)(lfpSamplingRate * 5), lfpSamplingRate, (float)lfpTask.AIChannels.All.RangeHigh * 2F, 0.5, 5, Properties.Settings.Default.ADCPollingPeriodSec); else lfpPlotData = new PlotDataRows(numChannels, downsample, (int)(lfpSamplingRate * 5), lfpSamplingRate, (float)spikeTask[0].AIChannels.All.RangeHigh * 2F, 0.5, 5, Properties.Settings.Default.ADCPollingPeriodSec); lfpPlotData.setGain(Properties.Settings.Default.LFPDisplayGain); lfpGraph.setDisplayGain(Properties.Settings.Default.LFPDisplayGain); lfpPlotData.dataAcquired += new PlotData.dataAcquiredHandler(lfpPlotData_dataAcquired); } waveformPlotData = new EventPlotData(numChannels, spikeDet.NumPre + spikeDet.NumPost + 1, (float)(spikeTask[0].AIChannels.All.RangeHigh * 2F), numRows, numCols, numSnipsDisplayed, Properties.Settings.Default.ChannelMapping); waveformPlotData.setGain(Properties.Settings.Default.SpkWfmDisplayGain); spkWfmGraph.setDisplayGain(Properties.Settings.Default.SpkWfmDisplayGain); waveformPlotData.dataAcquired += new EventPlotData.dataAcquiredHandler(waveformPlotData_dataAcquired); waveformPlotData.start(); #endregion if (Properties.Settings.Default.UseEEG) { eegPlotData = new PlotDataRows(Properties.Settings.Default.EEGNumChannels, downsample, (int)(eegSamplingRate * 5), eegSamplingRate, (float)eegTask.AIChannels.All.RangeHigh * 2F, 0.5, 5, Properties.Settings.Default.ADCPollingPeriodSec); eegPlotData.setGain(Properties.Settings.Default.EEGDisplayGain); eegGraph.setDisplayGain(Properties.Settings.Default.EEGDisplayGain); eegPlotData.dataAcquired += new PlotData.dataAcquiredHandler(eegPlotData_dataAcquired); } if (Properties.Settings.Default.useAuxAnalogInput) { // Remove existing plots for (int i = scatterGraph_AuxAnalogData.Plots.Count-1; i > 0; --i) { scatterGraph_AuxAnalogData.Plots.RemoveAt(i); } // Initialize the aux data scatter graph with a plot for each aux Analog channel for (int i = 0; i < Properties.Settings.Default.auxAnalogInChan.Count-1; ++i) { ScatterPlot p = new ScatterPlot(); scatterGraph_AuxAnalogData.Plots.Add(p); } // Initialize the controller auxInputGraphController = new ScatterGraphController(ref scatterGraph_AuxAnalogData); // Make history selector reflect current limits on input //slide_AnalogDispMaxVoltage.Range = new Range(0.05, 10); //slide_AnalogDispWidth.Range = new Range(2*Properties.Settings.Default.ADCPollingPeriodSec, Properties.Settings.Default.datSrvBufferSizeSec); } #endregion #region Setup_Filters //Setup filters, based on user's input resetSpikeFilter(); if (Properties.Settings.Default.UseLFPs) resetLFPFilter(); resetEEGFilter(); muaFilter = new Filters.MUAFilter( numChannels, spikeSamplingRate, spikeBufferLength, Properties.Settings.Default.MUAHighCutHz, Properties.Settings.Default.MUAFilterOrder, MUA_DOWNSAMPLE_FACTOR, Properties.Settings.Default.ADCPollingPeriodSec); #endregion #region Setup_DataStorage //Initialize data storing matrices // numChannels = Properties.Settings.Default.NumChannels; numSpikeReads = new int[spikeTask.Count]; filtSpikeData = new rawType[numChannels][]; if (Properties.Settings.Default.UseLFPs) { filtLFPData = new rawType[numChannels][]; finalLFPData = new rawType[numChannels][]; for (int i = 0; i < filtSpikeData.GetLength(0); ++i) { if (Properties.Settings.Default.SeparateLFPBoard) filtLFPData[i] = new rawType[lfpBufferLength]; else filtLFPData[i] = new rawType[spikeBufferLength]; } } if (Properties.Settings.Default.ProcessMUA) { muaData = new double[numChannels][]; for (int c = 0; c < numChannels; ++c) muaData[c] = new double[spikeBufferLength / MUA_DOWNSAMPLE_FACTOR]; } if (Properties.Settings.Default.UseEEG) { filtEEGData = new double[Properties.Settings.Default.EEGNumChannels][]; for (int i = 0; i < filtEEGData.GetLength(0); ++i) { filtEEGData[i] = new double[eegBufferLength]; } } for (int i = 0; i < filtSpikeData.GetLength(0); ++i) { filtSpikeData[i] = new rawType[spikeBufferLength]; if (Properties.Settings.Default.UseLFPs) finalLFPData[i] = new rawType[lfpBufferLength]; } if (Properties.Settings.Default.UseStimulator) { stimDataBuffer = new double[STIM_BUFFER_LENGTH]; stimJump = (double)spikeSamplingRate * 0.0001; //num. indices in 100 us of data } stimIndices = new List<StimTick>(5); //if devices refresh rate is reset, need to reset SALPA if (checkBox_SALPA.Checked) resetSALPA(); if (spikeDet != null && isNormalRecording) setSpikeDetector(); if (spikeDet.spikeDetector == null) setSpikeDetector(); #endregion #region Verify Tasks if (Properties.Settings.Default.UseStimulator && Properties.Settings.Default.RecordStimTimes) stimTimeTask.Control(TaskAction.Verify); if (Properties.Settings.Default.UseEEG) eegTask.Control(TaskAction.Verify); if (Properties.Settings.Default.SeparateLFPBoard && Properties.Settings.Default.UseLFPs) lfpTask.Control(TaskAction.Verify); if (checkBox_video.Checked) triggerTask.Control(TaskAction.Verify); for (int i = 0; i < spikeTask.Count; ++i) spikeTask[i].Control(TaskAction.Verify); if (Properties.Settings.Default.useAuxAnalogInput) auxAnInTask.Control(TaskAction.Verify); if (Properties.Settings.Default.useAuxDigitalInput) auxDigInTask.Control(TaskAction.Verify); #endregion SetupFileWriting(); //Set callbacks for data acq. spikeReader = new List<AnalogMultiChannelReader>(spikeTask.Count); for (int i = 0; i < spikeTask.Count; ++i) { spikeReader.Add(new AnalogMultiChannelReader(spikeTask[i].Stream)); spikeReader[i].SynchronizeCallbacks = true; } //if (Properties.Settings.Default.UseSingleChannelPlayback) // spikeOutWriter = new AnalogSingleChannelWriter(spikeOutTask.Stream); if (checkBox_video.Checked) triggerWriter = new DigitalSingleChannelWriter(triggerTask.Stream); //if (Properties.Settings.Default.UseSingleChannelPlayback) // spikeOutWriter.SynchronizeCallbacks = false; //These don't use UI, so they don't need to be synched spikeCallback = new AsyncCallback(AnalogInCallback_spikes); if (Properties.Settings.Default.UseStimulator && Properties.Settings.Default.RecordStimTimes) { stimTimeReader = new AnalogMultiChannelReader(stimTimeTask.Stream); } if (Properties.Settings.Default.SeparateLFPBoard && Properties.Settings.Default.UseLFPs) { lfpReader = new AnalogUnscaledReader(lfpTask.Stream); lfpReader.SynchronizeCallbacks = true; lfpCallback = new AsyncCallback(AnalogInCallback_LFPs); } if (Properties.Settings.Default.UseEEG) { eegReader = new AnalogUnscaledReader(eegTask.Stream); eegReader.SynchronizeCallbacks = true; eegCallback = new AsyncCallback(AnalogInCallback_EEG); } if (Properties.Settings.Default.useAuxAnalogInput) { auxAnReader = new AnalogMultiChannelReader(auxAnInTask.Stream); auxAnReader.SynchronizeCallbacks = true; auxAnCallback = new AsyncCallback(AnalogInCallback_AuxAn); } if (Properties.Settings.Default.useAuxDigitalInput) { auxDigReader = new DigitalSingleChannelReader(auxDigInTask.Stream); auxDigReader.SynchronizeCallbacks = true; auxDigCallback = new AsyncCallback(AnalogInCallback_AuxDig); } //Setup background workers for data processing bwSpikes = new List<BackgroundWorker>(spikeTask.Count); bwIsRunning = new bool[spikeTask.Count]; for (int i = 0; i < spikeTask.Count; ++i) { bwSpikes.Add(new BackgroundWorker()); bwSpikes[i].DoWork += new DoWorkEventHandler(bwSpikes_DoWork); bwSpikes[i].RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSpikes_RunWorkerCompleted); bwSpikes[i].WorkerSupportsCancellation = true; } //Make persistent buffers for spikeData spikeData = new List<AnalogWaveform<double>[]>(spikeReader.Count); for (int i = 0; i < spikeReader.Count; ++i) { spikeData.Add(new AnalogWaveform<double>[numChannelsPerDev]); for (int j = 0; j < numChannelsPerDev; ++j) spikeData[i][j] = new AnalogWaveform<double>(spikeBufferLength); } //Make channel playback task if (Properties.Settings.Default.UseSingleChannelPlayback) BNCOutput = new ChannelOutput(spikeSamplingRate, 0.1, Properties.Settings.Default.ADCPollingPeriodSec, spikeTask[0], Properties.Settings.Default.SingleChannelPlaybackDevice, 0); } catch (Exception exception) { //Display Errors this.Cursor = Cursors.Default; MessageBox.Show(exception.Message); reset(); } // Set up the DataSrv object. This is an object that publishes a nice large data history // for use in closed loop control and other things if (datSrv != null) datSrv = null; datSrv = new DataSrv( Properties.Settings.Default.datSrvBufferSizeSec, checkBox_SALPA.Checked, SALPA_WIDTH, checkBox_spikesFilter.Checked, spikeDet.spikeDetectionLag ); // Set the number of units if appropriate if (spikeDet.spikeSorter != null) datSrv.SetNumberOfUnits(spikeDet.spikeSorter.totalNumberOfUnits, spikeDet.spikeSorter.unit2Channel); Debugger = new Logger(); Debugger.GrabTimer(spikeTask[0]); //Send debug output to the user's application data folder Debugger.SetPath(Path.Combine(Properties.Settings.Default.neurorighterAppDataPath, "neurorighter-log.txt")); //Tell neuroRighter that the tasks now exist taskRunning = true; } else { Console.WriteLine("NRAcquisitionSetup was called while a task was running, and therefore setup did not execute. Perhaps this should have thrown an error"); } } //update gui at the end // Modify the UI, so user doesn't try running multiple instances of tasks spikeDet.numPreSamples.Enabled = false; spikeDet.numPostSamples.Enabled = false; settingsToolStripMenuItem.Enabled = false; button_Train.Enabled = false; button_SetRecordingStreams.Enabled = false; switch_record.Enabled = false; //processingSettingsToolStripMenuItem.Enabled = false; button_startStimFromFile.Enabled = false; button_startClosedLoopStim.Enabled = false; checkBox_SALPA.Enabled = false; //numericUpDown_NumSnipsDisplayed.Enabled = false; button_startClosedLoopStim.Enabled = false; button_scaleUp.Enabled = true; button_scaleDown.Enabled = true; button_scaleReset.Enabled = true; // Disable spike detector saving while running spikeDet.DisableFileMenu(); Console.WriteLine("NRAcquisitionSetup successfully executed"); this.Cursor = Cursors.Default; return false; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TweakViewerWindow)); this.pmtXAxis = new NationalInstruments.UI.XAxis(); this.xAxis5 = new NationalInstruments.UI.XAxis(); this.differenceYAxis = new NationalInstruments.UI.YAxis(); this.differenceGraph = new NationalInstruments.UI.WindowsForms.ScatterGraph(); this.differencePlot = new NationalInstruments.UI.ScatterPlot(); this.differenceAvgPlot = new NationalInstruments.UI.ScatterPlot(); this.tofGraph = new NationalInstruments.UI.WindowsForms.WaveformGraph(); this.tofLowCursor = new NationalInstruments.UI.XYCursor(); this.tofOnAveragePlot = new NationalInstruments.UI.WaveformPlot(); this.xAxis4 = new NationalInstruments.UI.XAxis(); this.tofAvgYAxis = new NationalInstruments.UI.YAxis(); this.tofHighCursor = new NationalInstruments.UI.XYCursor(); this.tofOnPlot = new NationalInstruments.UI.WaveformPlot(); this.tofYAxis = new NationalInstruments.UI.YAxis(); this.tofOffPlot = new NationalInstruments.UI.WaveformPlot(); this.tofOffAveragePlot = new NationalInstruments.UI.WaveformPlot(); this.tofFitPlot = new NationalInstruments.UI.WaveformPlot(); this.tofFitModeCombo = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.tofFitFunctionCombo = new System.Windows.Forms.ComboBox(); this.tofFitResultsLabel = new System.Windows.Forms.Label(); this.updateTOFFitButton = new System.Windows.Forms.Button(); this.tofFitDataSelectCombo = new System.Windows.Forms.ComboBox(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.statusBar2 = new System.Windows.Forms.StatusBar(); this.defaultGateButton = new System.Windows.Forms.Button(); this.statusBar1 = new System.Windows.Forms.StatusBar(); this.OnAvTextBox = new System.Windows.Forms.TextBox(); this.OnErrTextBox = new System.Windows.Forms.TextBox(); this.OffAvTextBox = new System.Windows.Forms.TextBox(); this.OffErrTextBox = new System.Windows.Forms.TextBox(); this.asymTextBox = new System.Windows.Forms.TextBox(); this.asymErrTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.pmtFitPlot = new NationalInstruments.UI.ScatterPlot(); this.xAxis3 = new NationalInstruments.UI.XAxis(); this.pmtYAxis = new NationalInstruments.UI.YAxis(); this.pmtOffAvgPlot = new NationalInstruments.UI.ScatterPlot(); this.pmtOnAvgPlot = new NationalInstruments.UI.ScatterPlot(); this.pmtOffPlot = new NationalInstruments.UI.ScatterPlot(); this.pmtOnPlot = new NationalInstruments.UI.ScatterPlot(); this.pmtHighCursor = new NationalInstruments.UI.XYCursor(); this.pmtLowCursor = new NationalInstruments.UI.XYCursor(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.resetButton = new System.Windows.Forms.Button(); this.pmtGraph = new NationalInstruments.UI.WindowsForms.ScatterGraph(); this.xyCursor1 = new NationalInstruments.UI.XYCursor(); this.scatterPlot1 = new NationalInstruments.UI.ScatterPlot(); this.xAxis1 = new NationalInstruments.UI.XAxis(); this.yAxis1 = new NationalInstruments.UI.YAxis(); this.xyCursor2 = new NationalInstruments.UI.XYCursor(); this.scatterPlot2 = new NationalInstruments.UI.ScatterPlot(); this.scatterPlot3 = new NationalInstruments.UI.ScatterPlot(); this.scatterPlot4 = new NationalInstruments.UI.ScatterPlot(); this.scatterPlot5 = new NationalInstruments.UI.ScatterPlot(); ((System.ComponentModel.ISupportInitialize)(this.differenceGraph)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tofGraph)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tofLowCursor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tofHighCursor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pmtHighCursor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pmtLowCursor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pmtGraph)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xyCursor1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xyCursor2)).BeginInit(); this.SuspendLayout(); // // pmtXAxis // this.pmtXAxis.Mode = NationalInstruments.UI.AxisMode.Fixed; // // xAxis5 // this.xAxis5.CaptionBackColor = System.Drawing.SystemColors.ControlLight; this.xAxis5.Mode = NationalInstruments.UI.AxisMode.Fixed; // // differenceYAxis // this.differenceYAxis.CaptionBackColor = System.Drawing.SystemColors.ControlLight; // // differenceGraph // this.differenceGraph.Location = new System.Drawing.Point(8, 304); this.differenceGraph.Name = "differenceGraph"; this.differenceGraph.Plots.AddRange(new NationalInstruments.UI.ScatterPlot[] { this.differencePlot, this.differenceAvgPlot}); this.differenceGraph.Size = new System.Drawing.Size(352, 280); this.differenceGraph.TabIndex = 15; this.differenceGraph.XAxes.AddRange(new NationalInstruments.UI.XAxis[] { this.xAxis5}); this.differenceGraph.YAxes.AddRange(new NationalInstruments.UI.YAxis[] { this.differenceYAxis}); // // differencePlot // this.differencePlot.LineStyle = NationalInstruments.UI.LineStyle.None; this.differencePlot.PointColor = System.Drawing.Color.Lime; this.differencePlot.PointStyle = NationalInstruments.UI.PointStyle.Cross; this.differencePlot.XAxis = this.xAxis5; this.differencePlot.YAxis = this.differenceYAxis; // // differenceAvgPlot // this.differenceAvgPlot.LineColor = System.Drawing.Color.Red; this.differenceAvgPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.differenceAvgPlot.XAxis = this.xAxis5; this.differenceAvgPlot.YAxis = this.differenceYAxis; // // tofGraph // this.tofGraph.Cursors.AddRange(new NationalInstruments.UI.XYCursor[] { this.tofLowCursor, this.tofHighCursor}); this.tofGraph.Location = new System.Drawing.Point(8, 8); this.tofGraph.Name = "tofGraph"; this.tofGraph.Plots.AddRange(new NationalInstruments.UI.WaveformPlot[] { this.tofOnPlot, this.tofOffPlot, this.tofOnAveragePlot, this.tofOffAveragePlot, this.tofFitPlot}); this.tofGraph.Size = new System.Drawing.Size(352, 280); this.tofGraph.TabIndex = 16; this.tofGraph.XAxes.AddRange(new NationalInstruments.UI.XAxis[] { this.xAxis4}); this.tofGraph.YAxes.AddRange(new NationalInstruments.UI.YAxis[] { this.tofYAxis, this.tofAvgYAxis}); // // tofLowCursor // this.tofLowCursor.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.tofLowCursor.LabelVisible = true; this.tofLowCursor.LabelXFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "G3"); this.tofLowCursor.LabelYFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "G3"); this.tofLowCursor.Plot = this.tofOnAveragePlot; this.tofLowCursor.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; this.tofLowCursor.AfterMove += new NationalInstruments.UI.AfterMoveXYCursorEventHandler(this.TOFCursorMoved); // // tofOnAveragePlot // this.tofOnAveragePlot.LineColor = System.Drawing.Color.Red; this.tofOnAveragePlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.tofOnAveragePlot.XAxis = this.xAxis4; this.tofOnAveragePlot.YAxis = this.tofAvgYAxis; // // tofAvgYAxis // this.tofAvgYAxis.Position = NationalInstruments.UI.YAxisPosition.Right; // // tofHighCursor // this.tofHighCursor.Color = System.Drawing.Color.Lime; this.tofHighCursor.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.tofHighCursor.LabelVisible = true; this.tofHighCursor.LabelXFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "G3"); this.tofHighCursor.LabelYFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "G3"); this.tofHighCursor.Plot = this.tofOnAveragePlot; this.tofHighCursor.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; this.tofHighCursor.AfterMove += new NationalInstruments.UI.AfterMoveXYCursorEventHandler(this.TOFCursorMoved); // // tofOnPlot // this.tofOnPlot.LineColor = System.Drawing.Color.Blue; this.tofOnPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.tofOnPlot.LineStyle = NationalInstruments.UI.LineStyle.None; this.tofOnPlot.PointStyle = NationalInstruments.UI.PointStyle.Plus; this.tofOnPlot.XAxis = this.xAxis4; this.tofOnPlot.YAxis = this.tofYAxis; // // tofOffPlot // this.tofOffPlot.LineStyle = NationalInstruments.UI.LineStyle.None; this.tofOffPlot.PointColor = System.Drawing.Color.LawnGreen; this.tofOffPlot.PointStyle = NationalInstruments.UI.PointStyle.Plus; this.tofOffPlot.XAxis = this.xAxis4; this.tofOffPlot.YAxis = this.tofYAxis; // // tofOffAveragePlot // this.tofOffAveragePlot.LineColor = System.Drawing.Color.PowderBlue; this.tofOffAveragePlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.tofOffAveragePlot.XAxis = this.xAxis4; this.tofOffAveragePlot.YAxis = this.tofAvgYAxis; // // tofFitPlot // this.tofFitPlot.LineColor = System.Drawing.Color.Silver; this.tofFitPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.tofFitPlot.LineStyle = NationalInstruments.UI.LineStyle.DashDot; this.tofFitPlot.LineWidth = 2F; this.tofFitPlot.XAxis = this.xAxis4; this.tofFitPlot.YAxis = this.tofAvgYAxis; // // tofFitModeCombo // this.tofFitModeCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.tofFitModeCombo.Items.AddRange(new object[] { "off", "average"}); this.tofFitModeCombo.Location = new System.Drawing.Point(64, 605); this.tofFitModeCombo.Name = "tofFitModeCombo"; this.tofFitModeCombo.Size = new System.Drawing.Size(72, 21); this.tofFitModeCombo.TabIndex = 17; this.tofFitModeCombo.SelectedIndexChanged += new System.EventHandler(this.tofFitModeCombo_SelectedIndexChanged); // // label1 // this.label1.Location = new System.Drawing.Point(6, 584); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(48, 23); this.label1.TabIndex = 18; this.label1.Text = "Fit TOF:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // tofFitFunctionCombo // this.tofFitFunctionCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.tofFitFunctionCombo.Location = new System.Drawing.Point(142, 605); this.tofFitFunctionCombo.Name = "tofFitFunctionCombo"; this.tofFitFunctionCombo.Size = new System.Drawing.Size(88, 21); this.tofFitFunctionCombo.TabIndex = 19; this.tofFitFunctionCombo.SelectedIndexChanged += new System.EventHandler(this.tofFitFunctionCombo_SelectedIndexChanged); // // tofFitResultsLabel // this.tofFitResultsLabel.ForeColor = System.Drawing.Color.Blue; this.tofFitResultsLabel.Location = new System.Drawing.Point(260, 602); this.tofFitResultsLabel.Name = "tofFitResultsLabel"; this.tofFitResultsLabel.Size = new System.Drawing.Size(100, 24); this.tofFitResultsLabel.TabIndex = 23; this.tofFitResultsLabel.Text = "..."; this.tofFitResultsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // updateTOFFitButton // this.updateTOFFitButton.Location = new System.Drawing.Point(236, 603); this.updateTOFFitButton.Name = "updateTOFFitButton"; this.updateTOFFitButton.Size = new System.Drawing.Size(18, 23); this.updateTOFFitButton.TabIndex = 25; this.updateTOFFitButton.Text = ">"; this.updateTOFFitButton.UseVisualStyleBackColor = true; this.updateTOFFitButton.Click += new System.EventHandler(this.updateTOFFitButton_Click); // // tofFitDataSelectCombo // this.tofFitDataSelectCombo.FormattingEnabled = true; this.tofFitDataSelectCombo.Items.AddRange(new object[] { "On", "Off"}); this.tofFitDataSelectCombo.Location = new System.Drawing.Point(8, 605); this.tofFitDataSelectCombo.Name = "tofFitDataSelectCombo"; this.tofFitDataSelectCombo.Size = new System.Drawing.Size(50, 21); this.tofFitDataSelectCombo.TabIndex = 27; // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitContainer1.Location = new System.Drawing.Point(0, 636); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.statusBar1); this.splitContainer1.Size = new System.Drawing.Size(970, 23); this.splitContainer1.SplitterDistance = 371; this.splitContainer1.TabIndex = 30; // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(0, 0); this.splitContainer2.Name = "splitContainer2"; // // splitContainer2.Panel1 // this.splitContainer2.Panel1.Controls.Add(this.statusBar2); // // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.defaultGateButton); this.splitContainer2.Size = new System.Drawing.Size(371, 23); this.splitContainer2.SplitterDistance = 236; this.splitContainer2.TabIndex = 0; // // statusBar2 // this.statusBar2.Location = new System.Drawing.Point(0, 0); this.statusBar2.Name = "statusBar2"; this.statusBar2.Size = new System.Drawing.Size(236, 23); this.statusBar2.SizingGrip = false; this.statusBar2.TabIndex = 32; this.statusBar2.Text = "Ready"; // // defaultGateButton // this.defaultGateButton.Location = new System.Drawing.Point(3, 0); this.defaultGateButton.Name = "defaultGateButton"; this.defaultGateButton.Size = new System.Drawing.Size(120, 23); this.defaultGateButton.TabIndex = 26; this.defaultGateButton.Text = "Default Gate"; this.defaultGateButton.UseVisualStyleBackColor = true; this.defaultGateButton.Click += new System.EventHandler(this.defaultGateButton_Click); // // statusBar1 // this.statusBar1.Location = new System.Drawing.Point(0, 0); this.statusBar1.Name = "statusBar1"; this.statusBar1.Size = new System.Drawing.Size(595, 23); this.statusBar1.SizingGrip = false; this.statusBar1.TabIndex = 14; this.statusBar1.Text = "Ready"; // // OnAvTextBox // this.OnAvTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.OnAvTextBox.Location = new System.Drawing.Point(392, 91); this.OnAvTextBox.Name = "OnAvTextBox"; this.OnAvTextBox.ReadOnly = true; this.OnAvTextBox.Size = new System.Drawing.Size(100, 20); this.OnAvTextBox.TabIndex = 31; // // OnErrTextBox // this.OnErrTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.OnErrTextBox.Location = new System.Drawing.Point(516, 91); this.OnErrTextBox.Name = "OnErrTextBox"; this.OnErrTextBox.ReadOnly = true; this.OnErrTextBox.Size = new System.Drawing.Size(100, 20); this.OnErrTextBox.TabIndex = 32; // // OffAvTextBox // this.OffAvTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.OffAvTextBox.Location = new System.Drawing.Point(392, 133); this.OffAvTextBox.Name = "OffAvTextBox"; this.OffAvTextBox.ReadOnly = true; this.OffAvTextBox.Size = new System.Drawing.Size(100, 20); this.OffAvTextBox.TabIndex = 33; // // OffErrTextBox // this.OffErrTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.OffErrTextBox.Location = new System.Drawing.Point(516, 133); this.OffErrTextBox.Name = "OffErrTextBox"; this.OffErrTextBox.ReadOnly = true; this.OffErrTextBox.Size = new System.Drawing.Size(100, 20); this.OffErrTextBox.TabIndex = 34; // // asymTextBox // this.asymTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.asymTextBox.Location = new System.Drawing.Point(392, 182); this.asymTextBox.Name = "asymTextBox"; this.asymTextBox.ReadOnly = true; this.asymTextBox.Size = new System.Drawing.Size(100, 20); this.asymTextBox.TabIndex = 35; // // asymErrTextBox // this.asymErrTextBox.BackColor = System.Drawing.SystemColors.ControlLight; this.asymErrTextBox.Location = new System.Drawing.Point(516, 182); this.asymErrTextBox.Name = "asymErrTextBox"; this.asymErrTextBox.ReadOnly = true; this.asymErrTextBox.Size = new System.Drawing.Size(100, 20); this.asymErrTextBox.TabIndex = 36; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(399, 75); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(85, 13); this.label2.TabIndex = 37; this.label2.Text = "Average on shot"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(400, 117); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(85, 13); this.label3.TabIndex = 38; this.label3.Text = "Average off shot"; // // pmtFitPlot // this.pmtFitPlot.LineColor = System.Drawing.Color.Silver; this.pmtFitPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.pmtFitPlot.LineStyle = NationalInstruments.UI.LineStyle.DashDot; this.pmtFitPlot.LineWidth = 2F; this.pmtFitPlot.XAxis = this.xAxis3; this.pmtFitPlot.YAxis = this.pmtYAxis; // // xAxis3 // this.xAxis3.Mode = NationalInstruments.UI.AxisMode.Fixed; // // pmtOffAvgPlot // this.pmtOffAvgPlot.LineColor = System.Drawing.Color.PowderBlue; this.pmtOffAvgPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.pmtOffAvgPlot.XAxis = this.xAxis3; this.pmtOffAvgPlot.YAxis = this.pmtYAxis; // // pmtOnAvgPlot // this.pmtOnAvgPlot.LineColor = System.Drawing.Color.Red; this.pmtOnAvgPlot.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.pmtOnAvgPlot.XAxis = this.xAxis3; this.pmtOnAvgPlot.YAxis = this.pmtYAxis; // // pmtOffPlot // this.pmtOffPlot.LineStyle = NationalInstruments.UI.LineStyle.None; this.pmtOffPlot.PointColor = System.Drawing.Color.Magenta; this.pmtOffPlot.PointStyle = NationalInstruments.UI.PointStyle.Cross; this.pmtOffPlot.XAxis = this.xAxis3; this.pmtOffPlot.YAxis = this.pmtYAxis; // // pmtOnPlot // this.pmtOnPlot.LineStyle = NationalInstruments.UI.LineStyle.None; this.pmtOnPlot.PointStyle = NationalInstruments.UI.PointStyle.Cross; this.pmtOnPlot.XAxis = this.xAxis3; this.pmtOnPlot.YAxis = this.pmtYAxis; // // pmtHighCursor // this.pmtHighCursor.Color = System.Drawing.Color.Lime; this.pmtHighCursor.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.pmtHighCursor.LabelVisible = true; this.pmtHighCursor.Plot = this.pmtOnAvgPlot; this.pmtHighCursor.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; this.pmtHighCursor.AfterMove += new NationalInstruments.UI.AfterMoveXYCursorEventHandler(this.PMTCursorMoved); // // pmtLowCursor // this.pmtLowCursor.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.pmtLowCursor.LabelVisible = true; this.pmtLowCursor.Plot = this.pmtOnAvgPlot; this.pmtLowCursor.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; this.pmtLowCursor.AfterMove += new NationalInstruments.UI.AfterMoveXYCursorEventHandler(this.PMTCursorMoved); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(389, 166); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(112, 13); this.label4.TabIndex = 39; this.label4.Text = "Average on-off/on+off"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(538, 75); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(53, 13); this.label5.TabIndex = 40; this.label5.Text = "Shot error"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(538, 117); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(53, 13); this.label6.TabIndex = 41; this.label6.Text = "Shot error"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(538, 166); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(53, 13); this.label7.TabIndex = 42; this.label7.Text = "Shot error"; // // resetButton // this.resetButton.Location = new System.Drawing.Point(392, 220); this.resetButton.Name = "resetButton"; this.resetButton.Size = new System.Drawing.Size(224, 23); this.resetButton.TabIndex = 43; this.resetButton.Text = "Reset!"; this.resetButton.UseVisualStyleBackColor = true; this.resetButton.Click += new System.EventHandler(this.resetButton_Click); // // pmtGraph // this.pmtGraph.Cursors.AddRange(new NationalInstruments.UI.XYCursor[] { this.xyCursor1, this.xyCursor2}); this.pmtGraph.InteractionMode = ((NationalInstruments.UI.GraphInteractionModes)((((((((NationalInstruments.UI.GraphInteractionModes.ZoomX | NationalInstruments.UI.GraphInteractionModes.ZoomY) | NationalInstruments.UI.GraphInteractionModes.ZoomAroundPoint) | NationalInstruments.UI.GraphInteractionModes.PanX) | NationalInstruments.UI.GraphInteractionModes.PanY) | NationalInstruments.UI.GraphInteractionModes.DragCursor) | NationalInstruments.UI.GraphInteractionModes.DragAnnotationCaption) | NationalInstruments.UI.GraphInteractionModes.EditRange))); this.pmtGraph.Location = new System.Drawing.Point(373, 304); this.pmtGraph.Name = "pmtGraph"; this.pmtGraph.Plots.AddRange(new NationalInstruments.UI.ScatterPlot[] { this.scatterPlot2, this.scatterPlot3, this.scatterPlot1, this.scatterPlot4, this.scatterPlot5}); this.pmtGraph.Size = new System.Drawing.Size(584, 280); this.pmtGraph.TabIndex = 44; this.pmtGraph.XAxes.AddRange(new NationalInstruments.UI.XAxis[] { this.xAxis1}); this.pmtGraph.YAxes.AddRange(new NationalInstruments.UI.YAxis[] { this.yAxis1}); // // xyCursor1 // this.xyCursor1.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.xyCursor1.LabelVisible = true; this.xyCursor1.Plot = this.scatterPlot1; this.xyCursor1.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; // // scatterPlot1 // this.scatterPlot1.LineColor = System.Drawing.Color.Red; this.scatterPlot1.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.scatterPlot1.XAxis = this.xAxis1; this.scatterPlot1.YAxis = this.yAxis1; // // xAxis1 // this.xAxis1.Mode = NationalInstruments.UI.AxisMode.Fixed; // // xyCursor2 // this.xyCursor2.Color = System.Drawing.Color.Lime; this.xyCursor2.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.xyCursor2.LabelVisible = true; this.xyCursor2.Plot = this.scatterPlot1; this.xyCursor2.SnapMode = NationalInstruments.UI.CursorSnapMode.Floating; // // scatterPlot2 // this.scatterPlot2.LineStyle = NationalInstruments.UI.LineStyle.None; this.scatterPlot2.PointStyle = NationalInstruments.UI.PointStyle.Cross; this.scatterPlot2.XAxis = this.xAxis1; this.scatterPlot2.YAxis = this.yAxis1; // // scatterPlot3 // this.scatterPlot3.LineStyle = NationalInstruments.UI.LineStyle.None; this.scatterPlot3.PointColor = System.Drawing.Color.Magenta; this.scatterPlot3.PointStyle = NationalInstruments.UI.PointStyle.Cross; this.scatterPlot3.XAxis = this.xAxis1; this.scatterPlot3.YAxis = this.yAxis1; // // scatterPlot4 // this.scatterPlot4.LineColor = System.Drawing.Color.PowderBlue; this.scatterPlot4.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.scatterPlot4.XAxis = this.xAxis1; this.scatterPlot4.YAxis = this.yAxis1; // // scatterPlot5 // this.scatterPlot5.LineColor = System.Drawing.Color.Silver; this.scatterPlot5.LineColorPrecedence = NationalInstruments.UI.ColorPrecedence.UserDefinedColor; this.scatterPlot5.LineStyle = NationalInstruments.UI.LineStyle.DashDot; this.scatterPlot5.LineWidth = 2F; this.scatterPlot5.XAxis = this.xAxis1; this.scatterPlot5.YAxis = this.yAxis1; // // TweakViewerWindow // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(970, 659); this.Controls.Add(this.pmtGraph); this.Controls.Add(this.resetButton); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.asymErrTextBox); this.Controls.Add(this.asymTextBox); this.Controls.Add(this.OffErrTextBox); this.Controls.Add(this.OffAvTextBox); this.Controls.Add(this.OnErrTextBox); this.Controls.Add(this.OnAvTextBox); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.tofFitDataSelectCombo); this.Controls.Add(this.updateTOFFitButton); this.Controls.Add(this.tofFitResultsLabel); this.Controls.Add(this.tofFitFunctionCombo); this.Controls.Add(this.label1); this.Controls.Add(this.tofFitModeCombo); this.Controls.Add(this.tofGraph); this.Controls.Add(this.differenceGraph); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "TweakViewerWindow"; this.Text = "Tweak View"; this.Closing += new System.ComponentModel.CancelEventHandler(this.WindowClosing); ((System.ComponentModel.ISupportInitialize)(this.differenceGraph)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tofGraph)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tofLowCursor)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tofHighCursor)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pmtHighCursor)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pmtLowCursor)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pmtGraph)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xyCursor1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xyCursor2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
public void 构造波形() { YAxis 电压Y轴 = new YAxis(); YAxis 电流Y轴 = new YAxis(); YAxis 流量Y轴 = new YAxis(); YAxis 进口压力Y轴 = new YAxis(); YAxis 出口压力Y轴 = new YAxis(); YAxis 转速Y轴 = new YAxis(); xyGraph1.Graph.YAxes.Clear(); xyGraph1.Graph.YAxes.Add(转速Y轴); xyGraph1.Graph.YAxes.Add(出口压力Y轴); xyGraph1.Graph.YAxes.Add(进口压力Y轴); xyGraph1.Graph.YAxes.Add(流量Y轴); xyGraph1.Graph.YAxes.Add(电流Y轴); xyGraph1.Graph.YAxes.Add(电压Y轴); ScatterPlot 电压线 = new ScatterPlot(); 电压线.YAxis = 电压Y轴; NationalInstruments.UI.LegendItem 电压标签 = new LegendItem(); 电压标签.Text = "电压"; 电压标签.Source = 电压线; ScatterPlot 电流线 = new ScatterPlot(); 电流线.YAxis = 电流Y轴; NationalInstruments.UI.LegendItem 电流标签 = new LegendItem(); 电流标签.Text = "电流"; 电流标签.Source = 电流线; ScatterPlot 流量线 = new ScatterPlot(); 流量线.YAxis = 流量Y轴; NationalInstruments.UI.LegendItem 流量标签 = new LegendItem(); 流量标签.Text = "流量"; 流量标签.Source = 流量线; ScatterPlot 转速线 = new ScatterPlot(); 转速线.YAxis = 转速Y轴; NationalInstruments.UI.LegendItem 转速标签 = new LegendItem(); 转速标签.Text = "转速"; 转速标签.Source = 转速线; ScatterPlot 进口压力线 = new ScatterPlot(); 进口压力线.YAxis = 进口压力Y轴; NationalInstruments.UI.LegendItem 进口压力标签 = new LegendItem(); 进口压力标签.Text = "进口压力"; 进口压力标签.Source = 进口压力线; ScatterPlot 出口压力线 = new ScatterPlot(); 出口压力线.YAxis = 出口压力Y轴; NationalInstruments.UI.LegendItem 出口压力标签 = new LegendItem(); 出口压力标签.Text = "出口压力"; 出口压力标签.Source = 出口压力线; xyGraph1.Graph.Plots.Clear(); xyGraph1.Graph.Plots.Add(电压线); xyGraph1.Graph.Plots.Add(电流线); xyGraph1.Graph.Plots.Add(流量线); xyGraph1.Graph.Plots.Add(进口压力线); xyGraph1.Graph.Plots.Add(出口压力线); xyGraph1.Graph.Plots.Add(转速线); this.xyGraph1.波形下标.Items.Add(电压标签); this.xyGraph1.波形下标.Items.Add(电流标签); this.xyGraph1.波形下标.Items.Add(流量标签); this.xyGraph1.波形下标.Items.Add(进口压力标签); this.xyGraph1.波形下标.Items.Add(出口压力标签); this.xyGraph1.波形下标.Items.Add(转速标签); 电压Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 电压Y轴.MajorDivisions.LabelForeColor = 电压线.LineColor; 电流Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 电流Y轴.MajorDivisions.LabelForeColor = 电流线.LineColor; 流量Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 流量Y轴.MajorDivisions.LabelForeColor = 流量线.LineColor; 进口压力Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 进口压力Y轴.MajorDivisions.LabelForeColor = 进口压力线.LineColor; 出口压力Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 出口压力Y轴.MajorDivisions.LabelForeColor = 出口压力线.LineColor; 转速Y轴.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F0"); 转速Y轴.MajorDivisions.LabelForeColor = 转速线.LineColor; }