private void UpdateGraph(SampleCollection col, ObservableDataSource <Point> dataSourceToUpdate) { var points = col.Select(p => new Point(p.X, p.Y)); dataSourceToUpdate.Collection.Clear(); dataSourceToUpdate.AppendMany(points); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ObservableDataSource<Point> source = new ObservableDataSource<Point>(); this.plotter.AddLineGraph(source, Colors.Black, 1.0, "RVector"); REngine engine = REngine.GetInstance(); NumericVector sequence = engine.Evaluate("x <- seq(-3, 3, 0.01)").AsNumeric(); NumericVector dnorm = engine.Evaluate("dnorm(x, 0, 1)").AsNumeric(); IEnumerable<Point> data = sequence.Zip(dnorm, (x, y) => new Point(x, y)); source.AppendMany(data); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ObservableDataSource <Point> source = new ObservableDataSource <Point>(); this.plotter.AddLineGraph(source, Colors.Black, 1.0, "RVector"); REngine engine = REngine.GetInstance(); NumericVector sequence = engine.Evaluate("x <- seq(-3, 3, 0.01)").AsNumeric(); NumericVector dnorm = engine.Evaluate("dnorm(x, 0, 1)").AsNumeric(); IEnumerable <Point> data = sequence.Zip(dnorm, (x, y) => new Point(x, y)); source.AppendMany(data); }
/// <summary> /// Display data for both Processor graph and Queue graph /// </summary> /// <param name="procStats">Processor usage statistics</param> /// <param name="queueStats">Queue usage statistics per processor</param> public void DisplayGraphs(IEnumerable<Point> procStats, IEnumerable<IEnumerable<Point>> queueStats) { var colors = new[] { "#FFBF00", "#E32636", "#0000FF", "#008000", "#00FFFF", "#5D8AA8", "#4B5320", "#B8860B", "#6D351A", "#BDB76B", "#66FF00", "#CC5500", "#85BB65", "#DFFF00", "#8B008B" }; // initialize processor usage graph var procSource = new ObservableDataSource<Point>(); procSource.SetXYMapping(pt => pt); ProcessorUsageChart.AddLineGraph(procSource, Colors.Blue, 1, "Processor usage"); procSource.AppendMany(procStats); var pidx = 1; foreach(var curr in queueStats) { var queueSource = new ObservableDataSource<Point>(); procSource.SetXYMapping(pt => pt); QueueLengthChart.AddLineGraph(queueSource, (Color)ColorConverter.ConvertFromString(colors[(pidx-1) % colors.Length]), 2, "Processor #" + pidx.ToString() + " queue"); queueSource.AppendMany(curr); pidx++; } }
//private void click_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //{ // showDetailsUG.Children.Clear(); // for (int i = 1; i <= 30; i++) // showDetailsUG.Children.Add(new ShowDetails(i)); //} private void plotDetails_Click(object sender, RoutedEventArgs e) { ObservableDataSource<Point> source1 = null; // Create first source source1 = new ObservableDataSource<Point>(); List<Point> list1 = new List<Point>(); for (int i = 0; i < 30; i++) { Point p1 = new Point(i, 2 * i); list1.Add(p1); } source1.AppendMany(list1); // Set identity mapping of point in collection to point on plot source1.SetXYMapping(p => p); // Add all three graphs. Colors are not specified and chosen random plotter.AddLineGraph(source1, Color.FromRgb(0, 255, 0), 2, "Data row 1"); // Create second source ObservableDataSource<Point> source2 = null; source2 = new ObservableDataSource<Point>(); List<Point> list2 = new List<Point>(); for (int j = 0; j < 30; j++) { Point p1 = new Point(j, 3 * j); list2.Add(p1); } source2.AppendMany(list2); // Set identity mapping of point in collection to point on plot source2.SetXYMapping(p => p); plotter.AddLineGraph(source2, Color.FromRgb(0, 0, 255), 2, "Data row 2"); getDatewiseReport(); }