/// <summary> /// Creates a variety of graphs to show capabilities /// </summary> /// <param name="sender">The sender</param> /// <param name="e">Event Args</param> private void OnCreateGraphs(object sender, RoutedEventArgs e) { var numFigures = 3; for (var i = 1; i <= numFigures; i++) { // Create an empty figure var figure = _graphService.AddFigure(string.Format("Figure {0}", i)); // Multi-series using default line styles var lineGraph = _graphService.AddLineGraph(figure, "Graph 1", "Current (mA)", "Voltage (V)"); _graphService.Plot(lineGraph, "y1", XSinc, YSinc.Select(y => y + 0).ToList()); _graphService.Plot(lineGraph, "y2", XSinc, YSinc.Select(y => y + 4).ToList()); _graphService.Plot(lineGraph, "y3", XSinc, YSinc.Select(y => y + 8).ToList()); _graphService.Plot(lineGraph, "y4", XSinc, YSinc.Select(y => y + 12).ToList()); // Multi-series using custom line styles lineGraph = _graphService.AddLineGraph(figure, "Graph 2", "Current (mA)", "Voltage (V)"); _graphService.Plot(lineGraph, "y1", XSinc, YSinc.Select(y => y + 0).ToList(), Styles.RedLine); _graphService.Plot(lineGraph, "y2", XSinc, YSinc.Select(y => y + 4).ToList(), Styles.BlueLine); _graphService.Plot(lineGraph, "y3", XSinc, YSinc.Select(y => y + 8).ToList(), Styles.GreenLine); _graphService.Plot(lineGraph, "y4", XSinc, YSinc.Select(y => y + 12).ToList(), Styles.SlateBlueLine); // Single series with different lines styles, markers and axis boundaries lineGraph = _graphService.AddLineGraph(figure, "Graph 3", "time", "space", false); _graphService.Plot(lineGraph, "Smooth", XSpiral1, YSpiral1, Styles.RedDashDot); _graphService.Plot(lineGraph, "Not Smooth", XSpiral1, YSpiral1, Styles.BlueWithMarkers); _graphService.SetAxisBoundaries(lineGraph, XSpiral1.Min() - .1 * (XSpiral1.Max() - XSpiral1.Min()), XSpiral1.Max() + .1 * (XSpiral1.Max() - XSpiral1.Min()), YSpiral1.Min() - .1 * (YSpiral1.Max() - YSpiral1.Min()), YSpiral1.Max() + .1 * (YSpiral1.Max() - YSpiral1.Min())); // Multi-series with markers only lineGraph = _graphService.AddLineGraph(figure, "Graph 4", "time", "space", false); _graphService.Plot(lineGraph, "Series 1", XSpiral1, YSpiral1, Styles.BlueStarMarkers); _graphService.Plot(lineGraph, "Series 2", XSpiral2, YSpiral2, Styles.RedCrossMarkers); _graphService.SetAxisBoundaries(lineGraph, XSpiral1.Min() - .1 * (XSpiral1.Max() - XSpiral1.Min()), XSpiral1.Max() + .1 * (XSpiral1.Max() - XSpiral1.Min()), YSpiral1.Min() - .1 * (YSpiral1.Max() - YSpiral1.Min()), YSpiral1.Max() + .1 * (YSpiral1.Max() - YSpiral1.Min())); // Multi-series with dynamically changing style lineGraph = _graphService.AddLineGraph(figure, "Graph 5", "time", "space", false); var xMarkerCoords = new List <double>(); var yMarkerCoords = new List <double>(); for (double j = 1; j < XSpiral1.Count; j++) { _graphService.Plot(lineGraph, null, new List <double> { 0, XSpiral1[(int)j] }, new List <double> { 0, YSpiral1[(int)j] }, Styles.BlueLine); xMarkerCoords.Add(XSpiral1[(int)j]); yMarkerCoords.Add(YSpiral1[(int)j]); } _graphService.SetAxisBoundaries(lineGraph, XSpiral1.Min() - .025 * (XSpiral1.Max() - XSpiral1.Min()), XSpiral1.Max() + .025 * (XSpiral1.Max() - XSpiral1.Min()), YSpiral1.Min() - .025 * (YSpiral1.Max() - YSpiral1.Min()), YSpiral1.Max() + .025 * (YSpiral1.Max() - YSpiral1.Min())); _graphService.Plot(lineGraph, null, xMarkerCoords, yMarkerCoords, Styles.GreenDiamondMarker); // Heatmap / Contour plot _graphService.Plot(figure, "Graph 6", "x", "y", Xmin, Xmax, Ymin, Ymax, _levels, Surfaces.GetPoints(Xmin, Xmax, Ymin, Ymax, 100, Surfaces.EggCrate)); } }