// [Example("DateTime Minimum bug")] public static PlotModel Example1() { var tmp = new PlotModel("Test"); tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, TickStyle = TickStyle.Outside }); DateTime dt = new DateTime(2010, 1, 1); tmp.Axes.Add(new DateTimeAxis(dt, dt.AddDays(1), AxisPosition.Bottom, null, null, DateTimeIntervalType.Hours) { MajorGridlineStyle = LineStyle.Solid, Angle = 90, StringFormat = "HH:mm", MajorStep = 1.0 / 24 / 2, // 1/24 = 1 hour, 1/24/2 = 30 minutes IsZoomEnabled = true, MaximumPadding = 0, MinimumPadding = 0, TickStyle = TickStyle.None }); var ls = new LineSeries("Line1") { DataFieldX = "X", DataFieldY = "Y" }; List<Item> ii = new List<Item>(); for (int i = 0; i < 24; i++) ii.Add(new Item { X = dt.AddHours(i), Y = i * i }); ls.ItemsSource = ii; tmp.Series.Add(ls); return tmp; }
public MainViewModel() { Model = new PlotModel(); var profile = new Profile(Gender.Male, 80); var start = DateTime.Now.AddHours(-5); var drinks = new List<DrinkEntry> { new DrinkEntry(DrinkType.Beer, start.AddMinutes(5), 330.0, 4.6), new DrinkEntry(DrinkType.Beer, start.AddMinutes(25), 330.0, 4.6), new DrinkEntry(DrinkType.Beer, start.AddMinutes(50), 330.0, 4.6), new DrinkEntry(DrinkType.Beer, start.AddMinutes(75), 330.0, 4.6), new DrinkEntry(DrinkType.Spirits, start.AddMinutes(90), 40.0, 40.0) }; var result = Library.Promillekoll.calculateAlcoholLevelOverTime(profile, ListModule.OfSeq(drinks)); var series = new LineSeries("Alcohol Level"); foreach (var entry in result) { var minutesSinceFirstDrink = entry.Item1.Subtract(start).TotalMinutes; series.Points.Add(new DataPoint(minutesSinceFirstDrink, entry.Item2)); } Model.Series.Add(series); }
public MainWindow(List<double> trainErrors, List<double> cvErrors) : this() { _model = new PlotModel("ANN errors") { LegendSymbolLength = 24 }; var s1 = new LineSeries("train error") { Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5 }; for (int i = 0; i < trainErrors.Count; i++) s1.Points.Add(new DataPoint(i * 10000, trainErrors[i])); _model.Series.Add(s1); var s2 = new LineSeries("cv error") { Color = OxyColors.Teal, MarkerType = MarkerType.Diamond, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.Teal, MarkerStrokeThickness = 1.5 }; for (int i = 0; i < cvErrors.Count; i++) s2.Points.Add(new DataPoint(i * 10000, cvErrors[i])); _model.Series.Add(s2); this.DataContext = _model; }
public static PlotModel TimeSpanaxisPlotModel() { var start = new TimeSpan(0, 0, 0, 0); var end = new TimeSpan(0, 24, 0, 0); double increment = 3600; // Create a random data collection var r = new Random(); var data = new Collection<TimeValue>(); var current = start; while (current <= end) { data.Add(new TimeValue { Time = current, Value = r.NextDouble() }); current = current.Add(new TimeSpan(0, 0, (int)increment)); } var plotModel1 = new PlotModel("TimeSpan axis"); var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "h:mm" }; plotModel1.Axes.Add(timeSpanAxis1); var linearAxis1 = new LinearAxis { Position = AxisPosition.Left }; plotModel1.Axes.Add(linearAxis1); var lineSeries1 = new LineSeries { Color = OxyColor.FromArgb(255, 78, 154, 6), MarkerFill = OxyColor.FromArgb(255, 78, 154, 6), MarkerStroke = OxyColors.ForestGreen, MarkerType = MarkerType.Plus, StrokeThickness = 1, DataFieldX = "Time", DataFieldY = "Value", ItemsSource = data }; plotModel1.Series.Add(lineSeries1); return plotModel1; }
public static PlotModel LineSeries10() { var model = new PlotModel("LineSeries, 100k points, ItemsSource, List<IDataPoint>"); var s1 = new LineSeries(); var points = new List<IDataPoint>(); AddPoints(points, 100000); s1.ItemsSource = points; model.Series.Add(s1); return model; }
public MainWindow() { InitializeComponent(); var ls = new OxyPlot.LineSeries(); for (int i = 0; i < 10; i++) { ls.Points.Add(new DataPoint(i, -i)); } this.AddChild(ls); //panel = this.GetTemplateChild("panel") as StackPanel; }
public void OnDtwChanged() { var dtwPath = Dtw.GetPath(); var xLength = Dtw.XLength; var yLength = Dtw.YLength; var cost = Dtw.GetCost(); var costNormalized = Dtw.GetCost() / Math.Sqrt(xLength * xLength + yLength * yLength); var plotModel = new PlotModel(String.Format("Dtw norm by length: {0:0.00}, total: {1:0.00}", costNormalized, cost)); for (int variableIndex = 0; variableIndex < Dtw.SeriesVariables.Length; variableIndex++) { var variableA = Dtw.SeriesVariables[variableIndex]; var variableASeries = variableA.GetPreprocessedXSeries(); var variableB = Dtw.SeriesVariables[variableIndex]; var variableBSeries = variableB.GetPreprocessedYSeries(); var axisTitleAndKey = String.Format("Value ({0})", variableA.VariableName); plotModel.Axes.Add(new LinearAxis(AxisPosition.Left, axisTitleAndKey) { Key = axisTitleAndKey, PositionTier = variableIndex }); var plotSeriesA = new LineSeries(variableA.VariableName) { YAxisKey = axisTitleAndKey }; for (int i = 0; i < xLength; i++) plotSeriesA.Points.Add(new DataPoint(i, variableASeries[i])); var plotSeriesB = new LineSeries(variableB.VariableName) { YAxisKey = axisTitleAndKey }; for (int i = 0; i < yLength; i++) plotSeriesB.Points.Add(new DataPoint(i, variableBSeries[i])); var plotSeriesPath = new LineSeries("Dtw") { YAxisKey = axisTitleAndKey, StrokeThickness = 0.5, Color = OxyColors.DimGray, }; for (int i = 0; i < dtwPath.Length; i++) { plotSeriesPath.Points.Add(new DataPoint(dtwPath[i].Item1, variableASeries[dtwPath[i].Item1])); plotSeriesPath.Points.Add(new DataPoint(dtwPath[i].Item2, variableBSeries[dtwPath[i].Item2])); plotSeriesPath.Points.Add(new DataPoint(double.NaN, double.NaN)); } plotModel.Series.Add(plotSeriesA); plotModel.Series.Add(plotSeriesB); plotModel.Series.Add(plotSeriesPath); } plotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, "Index")); Plot.Model = plotModel; }
public static PlotModel FilteringInvalidPoints() { var plot = new PlotModel("Filtering invalid points"); plot.Axes.Add(new LinearAxis(AxisPosition.Bottom, "X-axis")); plot.Axes.Add(new LinearAxis(AxisPosition.Left, "Y-axis")); var lsNaN = new LineSeries("NaN"); lsNaN.Points.Add(new DataPoint(double.NaN, double.NaN)); lsNaN.Points.Add(new DataPoint(1, 0)); lsNaN.Points.Add(new DataPoint(2, 10)); lsNaN.Points.Add(new DataPoint(double.NaN, 20)); lsNaN.Points.Add(new DataPoint(3, 10)); lsNaN.Points.Add(new DataPoint(4, 0)); lsNaN.Points.Add(new DataPoint(4.5, double.NaN)); lsNaN.Points.Add(new DataPoint(5, 0)); lsNaN.Points.Add(new DataPoint(6, 10)); lsNaN.Points.Add(new DataPoint(double.NaN, double.NaN)); lsNaN.Points.Add(new DataPoint(7, 0)); lsNaN.Points.Add(new DataPoint(double.NaN, double.NaN)); plot.Series.Add(lsNaN); var lsPosInf = new LineSeries("PositiveInfinity"); lsPosInf.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity)); lsPosInf.Points.Add(new DataPoint(1, 1)); lsPosInf.Points.Add(new DataPoint(2, 11)); lsPosInf.Points.Add(new DataPoint(double.PositiveInfinity, 20)); lsPosInf.Points.Add(new DataPoint(3, 11)); lsPosInf.Points.Add(new DataPoint(4, 1)); lsPosInf.Points.Add(new DataPoint(4.5, double.PositiveInfinity)); lsPosInf.Points.Add(new DataPoint(5, 1)); lsPosInf.Points.Add(new DataPoint(6, 11)); lsPosInf.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity)); lsPosInf.Points.Add(new DataPoint(7, 1)); lsPosInf.Points.Add(new DataPoint(double.PositiveInfinity, double.PositiveInfinity)); plot.Series.Add(lsPosInf); var lsNegInf = new LineSeries("NegativeInfinity"); lsNegInf.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity)); lsNegInf.Points.Add(new DataPoint(1, 2)); lsNegInf.Points.Add(new DataPoint(2, 12)); lsNegInf.Points.Add(new DataPoint(double.NegativeInfinity, 20)); lsNegInf.Points.Add(new DataPoint(3, 12)); lsNegInf.Points.Add(new DataPoint(4, 2)); lsNegInf.Points.Add(new DataPoint(4.5, double.NegativeInfinity)); lsNegInf.Points.Add(new DataPoint(5, 2)); lsNegInf.Points.Add(new DataPoint(6, 12)); lsNegInf.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity)); lsNegInf.Points.Add(new DataPoint(7, 2)); lsNegInf.Points.Add(new DataPoint(double.NegativeInfinity, double.NegativeInfinity)); plot.Series.Add(lsNegInf); return plot; }
public static PlotModel MouseEvents() { var model = new PlotModel("Mouse events", "Left click and drag"); var yaxis = new LinearAxis(AxisPosition.Left, -1, 1); var xaxis = new LinearAxis(AxisPosition.Bottom, -1, 1); model.Axes.Add(yaxis); model.Axes.Add(xaxis); LineSeries s1 = null; // Subscribe to the mouse down event on the line series model.MouseDown += (s, e) => { // only handle the left mouse button (right button can still be used to pan) if (e.ChangedButton == OxyMouseButton.Left) { // Add a line series s1 = new LineSeries("LineSeries" + (model.Series.Count + 1)) { // Color = OxyColors.SkyBlue, MarkerType = MarkerType.None, StrokeThickness = 2 }; s1.Points.Add(Axis.InverseTransform(e.Position, xaxis, yaxis)); model.Series.Add(s1); model.RefreshPlot(false); e.Handled = true; } }; model.MouseMove += (s, e) => { if (s1 != null) { s1.Points.Add(Axis.InverseTransform(e.Position, xaxis, yaxis)); model.RefreshPlot(false); e.Handled = true; } }; model.MouseUp += (s, e) => { if (s1 != null) { s1 = null; e.Handled = true; } }; return model; }
public static PlotModel LineSeries1Round() { var model = new PlotModel("LineSeries, 100k points, round line joins"); #if !SILVERLIGHT && !MONO var watch = new Stopwatch(); model.Updating += (sender, args) => watch.Restart(); model.Updated += (sender, args) => Debug.WriteLine("Updated in " + watch.ElapsedMilliseconds + " ms"); #endif var s1 = new LineSeries() { LineJoin = OxyPenLineJoin.Round }; AddPoints(s1.Points, 100000); model.Series.Add(s1); return model; }
public void OnDtwChanged() { var dtwPath = Dtw.GetPath(); var xLength = Dtw.XLength; var yLength = Dtw.YLength; var seriesAMultivariate = Dtw.SeriesVariables.Select(x => x.GetPreprocessedXSeries()).ToArray(); var seriesBMultivariate = Dtw.SeriesVariables.Select(x => x.GetPreprocessedYSeries()).ToArray(); var cost = Dtw.GetCost(); var plotModel = new PlotModel(String.Format("Dtw ({0:0.00})", cost)); for (int variableIndex = 0; variableIndex < seriesAMultivariate.Length; variableIndex++) { var axisTitleAndKey = String.Format("Value (var {0})", variableIndex + 1); plotModel.Axes.Add(new LinearAxis(AxisPosition.Left, axisTitleAndKey) { Key = axisTitleAndKey, PositionTier = variableIndex} ); var seriesAVariable = seriesAMultivariate[variableIndex]; var seriesBVariable = seriesBMultivariate[variableIndex]; var plotSeriesA = new LineSeries("Series A") { YAxisKey = axisTitleAndKey }; for (int i = 0; i < xLength; i++) plotSeriesA.Points.Add(new DataPoint(i, seriesAVariable[i])); var plotSeriesB = new LineSeries("Series B") { YAxisKey = axisTitleAndKey }; for (int i = 0; i < yLength; i++) plotSeriesB.Points.Add(new DataPoint(i, seriesBVariable[i])); var plotSeriesPath = new LineSeries("Dtw") { YAxisKey = axisTitleAndKey, StrokeThickness = 0.5, Color = OxyColors.DimGray, }; for (int i = 0; i < dtwPath.Length; i++) { plotSeriesPath.Points.Add(new DataPoint(dtwPath[i].Item1, seriesAVariable[dtwPath[i].Item1])); plotSeriesPath.Points.Add(new DataPoint(dtwPath[i].Item2, seriesBVariable[dtwPath[i].Item2])); plotSeriesPath.Points.Add(new DataPoint(double.NaN, double.NaN)); } plotModel.Series.Add(plotSeriesA); plotModel.Series.Add(plotSeriesB); plotModel.Series.Add(plotSeriesPath); } plotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, "Index")); Plot.Model = plotModel; }
private void WindowLoaded(object sender, RoutedEventArgs e) { var temp = new PlotModel(); var rs = new LineSeries(); rs.StrokeThickness = 1; var fuelData = File.ReadAllLines(@"Data/Fuel.txt").Select(double.Parse).ToList(); for (int i = 0; i < fuelData.Count; i++) rs.Points.Add(new DataPoint(i, fuelData[i])); temp.Series.Add(rs); var f = new Matrix(new[,] {{1.0, 1}, {0, 1}}); var b = new Matrix(new[,] {{0.0}, {0}}); var u = new Matrix(new[,] {{0.0}, {0}}); var r = Matrix.CreateVector(10); var q = new Matrix(new[,] {{0.01, 0.4}, {0.1, 0.02}}); var h = new Matrix(new[,] {{1.0 , 0}}); var kalman = new KalmanFilter(f, b, u, q, h, r); // задаем F, H, Q и R kalman.SetState(Matrix.CreateVector(fuelData[0], 0), new Matrix(new[,] {{10.0, 0}, {0 , 10.0}})); // задаем начальные State и Covariance var filtered = new List<double>(); var rashod = new List<double>(); foreach (var d in fuelData) { try { kalman.Correct(new Matrix(new[,] {{d}})); filtered.Add(kalman.State[0, 0]); rashod.Add(kalman.State[1, 0]); } catch(Exception ex) { MessageBox.Show(ex.Message); } } var fs = new LineSeries(); for (int i = 0; i < filtered.Count; i++) fs.Points.Add(new DataPoint(i, filtered[i])); temp.Series.Add(fs); var ras = new LineSeries(); for (int i = 0; i < filtered.Count; i++) ras.Points.Add(new DataPoint(i, rashod[i])); temp.Series.Add(ras); temp.Axes.Add(new LinearAxis(AxisPosition.Left, 0, 4200)); temp.Axes.Add(new LinearAxis(AxisPosition.Bottom)); Plot.Model = temp; }
public MainWindow() { InitializeComponent(); InitializeBackgroundWorker(); _worker.RunWorkerAsync(); DataContext = new MainViewModel(); model = new PlotModel("SNMP Trap Collector", "Voltage Chart"); model.Padding = new OxyThickness(-20, 0, 20, 0); voltageLine = new LineSeries("Voltage") { MarkerType = MarkerType.Square }; model.Series.Add(voltageLine); model.Axes.Add(new LinearAxis(AxisPosition.Left, -1, 4, "Voltage")); model.Axes.Add(new LinearAxis(AxisPosition.Bottom, "Timestamp")); MainViewModel mwm = new MainViewModel(); mwm.Model = model; DataContext = mwm; }
public static PlotModel NoInterpolation() { var model = new PlotModel("No tracker interpolation", "Used for discrete values or scatter plots.") { LegendSymbolLength = 30 }; var s1 = new LineSeries("Series 1") { CanTrackerInterpolatePoints = false, Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5 }; for (int i = 0; i < 63; i++) s1.Points.Add(new DataPoint((int)(Math.Sqrt(i) * Math.Cos(i * 0.1)), (int)(Math.Sqrt(i) * Math.Sin(i * 0.1)))); model.Series.Add(s1); return model; }
public static PlotModel OneSeries() { var model = new PlotModel("LineSeries") { LegendSymbolLength = 24 }; var s1 = new LineSeries("Series 1") { Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5 }; s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 40)); s1.Points.Add(new DataPoint(40, 20)); s1.Points.Add(new DataPoint(60, 30)); model.Series.Add(s1); return model; }
public static PlotModel AmdahlsLaw() { var model = new PlotModel("Amdahl's law") { LegendTitle = "Parallel portion" }; // http://en.wikipedia.org/wiki/Amdahl's_law Func<double, int, double> maxSpeedup = (p, n) => 1.0 / ((1.0 - p) + (double)p / n); Func<double, LineSeries> createSpeedupCurve = p => { // todo: tracker does not work when smoothing = true (too few points interpolated on the left end of the curve) var ls = new LineSeries(p.ToString("P0")) { Smooth = false }; for (int n = 1; n <= 65536; n *= 2) ls.Points.Add(new DataPoint(n, maxSpeedup(p, n))); return ls; }; model.Axes.Add(new LogarithmicAxis(AxisPosition.Bottom, "Number of processors") { Base = 2, MajorGridlineStyle = LineStyle.Solid, TickStyle = TickStyle.None }); model.Axes.Add(new LinearAxis(AxisPosition.Left, 0, 20, 2, 2, "Speedup") { StringFormat = "F2", MajorGridlineStyle = LineStyle.Solid, TickStyle = TickStyle.None }); model.Series.Add(createSpeedupCurve(0.5)); model.Series.Add(createSpeedupCurve(0.75)); model.Series.Add(createSpeedupCurve(0.9)); model.Series.Add(createSpeedupCurve(0.95)); return model; }
//private bool error = false; public MainWindow() { InitializeComponent(); this._backgroundWorker = new BackgroundWorker(); this._backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); this._backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); this._backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_WorkerCompleted); this._backgroundWorker.WorkerReportsProgress = true; this._backgroundWorker.RunWorkerAsync(); this.pModel = new PlotModel("RL-ARM", "SNMP TRAP"); this.pModel.Padding = new OxyThickness(-20, 5, 30, 20); var axisx = new LinearAxis(AxisPosition.Bottom, "Timestamp"); this.pModel.Axes.Add(axisx); var axisy = new LinearAxis(AxisPosition.Left, "Voltage") { Minimum = 0, Maximum = 3.3 }; this.pModel.Axes.Add(axisy); this.lsVoltage = new LineSeries("Voltage") { MarkerType = MarkerType.Circle }; this.pModel.Series.Add(lsVoltage); MainViewModel mvm = new MainViewModel(); mvm.Model = this.pModel; DataContext = mvm; }
public static PlotModel TwoLineSeries() { var model = new PlotModel("Two LineSeries") { LegendSymbolLength = 24 }; model.Axes.Add(new LinearAxis(AxisPosition.Left, -1, 71, "Y-Axis")); model.Axes.Add(new LinearAxis(AxisPosition.Bottom, -1, 61, "X-Axis")); var s1 = new LineSeries("Series 1") { Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5 }; s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 40)); s1.Points.Add(new DataPoint(40, 20)); s1.Points.Add(new DataPoint(60, 30)); model.Series.Add(s1); var s2 = new LineSeries("Series 2") { Color = OxyColors.Teal, MarkerType = MarkerType.Diamond, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.Teal, MarkerStrokeThickness = 1.5 }; s2.Points.Add(new DataPoint(0, 4)); s2.Points.Add(new DataPoint(10, 32)); s2.Points.Add(new DataPoint(40, 14)); s2.Points.Add(new DataPoint(60, 20)); model.Series.Add(s2); return model; }
public static PlotModel LineSeriesandAreaSeries() { var plotModel1 = new PlotModel("LineSeries and AreaSeries"); var linearAxis1 = new LinearAxis(AxisPosition.Bottom); plotModel1.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); plotModel1.Axes.Add(linearAxis2); var areaSeries1 = new AreaSeries { Fill = OxyColors.LightBlue, DataFieldX2 = "Time", DataFieldY2 = "Minimum", Color = OxyColors.Red, StrokeThickness = 0, MarkerFill = OxyColors.Transparent, DataFieldX = "Time", DataFieldY = "Maximum" }; areaSeries1.Points2.Add(new DataPoint(0, -5.04135905692417)); areaSeries1.Points2.Add(new DataPoint(2.5, -4.91731850813018)); areaSeries1.Points2.Add(new DataPoint(5, -4.45266314658926)); areaSeries1.Points2.Add(new DataPoint(7.5, -3.87303874542613)); areaSeries1.Points2.Add(new DataPoint(10, -3.00101110255393)); areaSeries1.Points2.Add(new DataPoint(12.5, -2.17980725503518)); areaSeries1.Points2.Add(new DataPoint(15, -1.67332229254456)); areaSeries1.Points2.Add(new DataPoint(17.5, -1.10537158549082)); areaSeries1.Points2.Add(new DataPoint(20, -0.6145459544447)); areaSeries1.Points2.Add(new DataPoint(22.5, 0.120028106039404)); areaSeries1.Points2.Add(new DataPoint(25, 1.06357270435597)); areaSeries1.Points2.Add(new DataPoint(27.5, 1.87301405606466)); areaSeries1.Points2.Add(new DataPoint(30, 2.57569854952195)); areaSeries1.Points2.Add(new DataPoint(32.5, 3.59165537664278)); areaSeries1.Points2.Add(new DataPoint(35, 4.87991958133872)); areaSeries1.Points2.Add(new DataPoint(37.5, 6.36214537958714)); areaSeries1.Points2.Add(new DataPoint(40, 7.62564585126268)); areaSeries1.Points2.Add(new DataPoint(42.5, 8.69606320261772)); areaSeries1.Points2.Add(new DataPoint(45, 10.0118704438265)); areaSeries1.Points2.Add(new DataPoint(47.5, 11.0434480519236)); areaSeries1.Points2.Add(new DataPoint(50, 11.9794171576758)); areaSeries1.Points2.Add(new DataPoint(52.5, 12.9591851832621)); areaSeries1.Points2.Add(new DataPoint(55, 14.172107889304)); areaSeries1.Points2.Add(new DataPoint(57.5, 15.5520057698488)); areaSeries1.Points2.Add(new DataPoint(60, 17.2274942386092)); areaSeries1.Points2.Add(new DataPoint(62.5, 18.6983982186757)); areaSeries1.Points2.Add(new DataPoint(65, 20.4560332001448)); areaSeries1.Points2.Add(new DataPoint(67.5, 22.4867327382261)); areaSeries1.Points2.Add(new DataPoint(70, 24.5319674302041)); areaSeries1.Points2.Add(new DataPoint(72.5, 26.600547815813)); areaSeries1.Points2.Add(new DataPoint(75, 28.5210891459701)); areaSeries1.Points2.Add(new DataPoint(77.5, 30.6793080755413)); areaSeries1.Points2.Add(new DataPoint(80, 33.0546651200646)); areaSeries1.Points2.Add(new DataPoint(82.5, 35.3256065179713)); areaSeries1.Points2.Add(new DataPoint(85, 37.6336074839968)); areaSeries1.Points2.Add(new DataPoint(87.5, 40.2012266359763)); areaSeries1.Points2.Add(new DataPoint(90, 42.8923555399256)); areaSeries1.Points2.Add(new DataPoint(92.5, 45.8665211907432)); areaSeries1.Points2.Add(new DataPoint(95, 48.8200195945427)); areaSeries1.Points2.Add(new DataPoint(97.5, 51.8304284402311)); areaSeries1.Points2.Add(new DataPoint(100, 54.6969868542147)); areaSeries1.Points2.Add(new DataPoint(102.5, 57.7047292990632)); areaSeries1.Points2.Add(new DataPoint(105, 60.4216644602929)); areaSeries1.Points2.Add(new DataPoint(107.5, 62.926258762519)); areaSeries1.Points2.Add(new DataPoint(110, 65.1829734629407)); areaSeries1.Points2.Add(new DataPoint(112.5, 67.2365592083133)); areaSeries1.Points2.Add(new DataPoint(115, 69.5713628691022)); areaSeries1.Points2.Add(new DataPoint(117.5, 71.7267046705944)); areaSeries1.Points2.Add(new DataPoint(120, 73.633463102781)); areaSeries1.Points2.Add(new DataPoint(122.5, 75.4660150158061)); areaSeries1.Points2.Add(new DataPoint(125, 77.5669292504745)); areaSeries1.Points2.Add(new DataPoint(127.5, 79.564218544664)); areaSeries1.Points2.Add(new DataPoint(130, 81.8631309028078)); areaSeries1.Points2.Add(new DataPoint(132.5, 83.9698189969034)); areaSeries1.Points2.Add(new DataPoint(135, 86.3847886532009)); areaSeries1.Points2.Add(new DataPoint(137.5, 88.5559348267764)); areaSeries1.Points2.Add(new DataPoint(140, 91.0455050418365)); areaSeries1.Points2.Add(new DataPoint(142.5, 93.6964157585504)); areaSeries1.Points2.Add(new DataPoint(145, 96.284336864941)); areaSeries1.Points2.Add(new DataPoint(147.5, 98.7508602689723)); areaSeries1.Points2.Add(new DataPoint(150, 100.904510594255)); areaSeries1.Points2.Add(new DataPoint(152.5, 103.266136681506)); areaSeries1.Points2.Add(new DataPoint(155, 105.780951269521)); areaSeries1.Points2.Add(new DataPoint(157.5, 108.032859257065)); areaSeries1.Points2.Add(new DataPoint(160, 110.035478448093)); areaSeries1.Points2.Add(new DataPoint(162.5, 112.10655731615)); areaSeries1.Points2.Add(new DataPoint(165, 114.37480786097)); areaSeries1.Points2.Add(new DataPoint(167.5, 116.403992550869)); areaSeries1.Points2.Add(new DataPoint(170, 118.61663988727)); areaSeries1.Points2.Add(new DataPoint(172.5, 120.538730287384)); areaSeries1.Points2.Add(new DataPoint(175, 122.515721057177)); areaSeries1.Points2.Add(new DataPoint(177.5, 124.474386629124)); areaSeries1.Points2.Add(new DataPoint(180, 126.448283293214)); areaSeries1.Points2.Add(new DataPoint(182.5, 128.373811322299)); areaSeries1.Points2.Add(new DataPoint(185, 130.33627914667)); areaSeries1.Points2.Add(new DataPoint(187.5, 132.487933658477)); areaSeries1.Points2.Add(new DataPoint(190, 134.716989778456)); areaSeries1.Points2.Add(new DataPoint(192.5, 136.817287595392)); areaSeries1.Points2.Add(new DataPoint(195, 139.216488664698)); areaSeries1.Points2.Add(new DataPoint(197.5, 141.50803227574)); areaSeries1.Points2.Add(new DataPoint(200, 143.539586683614)); areaSeries1.Points2.Add(new DataPoint(202.5, 145.535911545221)); areaSeries1.Points2.Add(new DataPoint(205, 147.516964978686)); areaSeries1.Points2.Add(new DataPoint(207.5, 149.592416731684)); areaSeries1.Points2.Add(new DataPoint(210, 151.600983566512)); areaSeries1.Points2.Add(new DataPoint(212.5, 153.498210993362)); areaSeries1.Points2.Add(new DataPoint(215, 155.512606828247)); areaSeries1.Points2.Add(new DataPoint(217.5, 157.426564302774)); areaSeries1.Points2.Add(new DataPoint(220, 159.364474964172)); areaSeries1.Points2.Add(new DataPoint(222.5, 161.152806492128)); areaSeries1.Points2.Add(new DataPoint(225, 162.679069434562)); areaSeries1.Points2.Add(new DataPoint(227.5, 163.893622036741)); areaSeries1.Points2.Add(new DataPoint(230, 165.475827621238)); areaSeries1.Points2.Add(new DataPoint(232.5, 167.303960444734)); areaSeries1.Points2.Add(new DataPoint(235, 169.259393394952)); areaSeries1.Points2.Add(new DataPoint(237.5, 171.265193646758)); areaSeries1.Points2.Add(new DataPoint(240, 173.074304345192)); areaSeries1.Points2.Add(new DataPoint(242.5, 174.975492766814)); areaSeries1.Points2.Add(new DataPoint(245, 176.684088218484)); areaSeries1.Points2.Add(new DataPoint(247.5, 178.406887247603)); areaSeries1.Points.Add(new DataPoint(0, 5.0184649433561)); areaSeries1.Points.Add(new DataPoint(2.5, 5.27685959268215)); areaSeries1.Points.Add(new DataPoint(5, 5.81437064628786)); areaSeries1.Points.Add(new DataPoint(7.5, 6.51022475040994)); areaSeries1.Points.Add(new DataPoint(10, 7.49921246878766)); areaSeries1.Points.Add(new DataPoint(12.5, 8.41941631823751)); areaSeries1.Points.Add(new DataPoint(15, 9.09826907222079)); areaSeries1.Points.Add(new DataPoint(17.5, 9.89500750098145)); areaSeries1.Points.Add(new DataPoint(20, 10.6633345249404)); areaSeries1.Points.Add(new DataPoint(22.5, 11.6249613445368)); areaSeries1.Points.Add(new DataPoint(25, 12.8816391467497)); areaSeries1.Points.Add(new DataPoint(27.5, 13.9665185705603)); areaSeries1.Points.Add(new DataPoint(30, 14.8501816818724)); areaSeries1.Points.Add(new DataPoint(32.5, 16.0683128022441)); areaSeries1.Points.Add(new DataPoint(35, 17.5378799723172)); areaSeries1.Points.Add(new DataPoint(37.5, 19.1262752954039)); areaSeries1.Points.Add(new DataPoint(40, 20.4103953650735)); areaSeries1.Points.Add(new DataPoint(42.5, 21.5430627723891)); areaSeries1.Points.Add(new DataPoint(45, 22.9105459463366)); areaSeries1.Points.Add(new DataPoint(47.5, 23.9802361888719)); areaSeries1.Points.Add(new DataPoint(50, 24.8659461235003)); areaSeries1.Points.Add(new DataPoint(52.5, 25.7303194442439)); areaSeries1.Points.Add(new DataPoint(55, 26.7688545912359)); areaSeries1.Points.Add(new DataPoint(57.5, 28.0545112571933)); areaSeries1.Points.Add(new DataPoint(60, 29.7036634266394)); areaSeries1.Points.Add(new DataPoint(62.5, 31.2273634344467)); areaSeries1.Points.Add(new DataPoint(65, 33.1038196356519)); areaSeries1.Points.Add(new DataPoint(67.5, 35.2639893610328)); areaSeries1.Points.Add(new DataPoint(70, 37.434293559489)); areaSeries1.Points.Add(new DataPoint(72.5, 39.7109359368267)); areaSeries1.Points.Add(new DataPoint(75, 41.7573881676222)); areaSeries1.Points.Add(new DataPoint(77.5, 44.0460374479862)); areaSeries1.Points.Add(new DataPoint(80, 46.5098714746581)); areaSeries1.Points.Add(new DataPoint(82.5, 48.7754012129155)); areaSeries1.Points.Add(new DataPoint(85, 51.1619816926597)); areaSeries1.Points.Add(new DataPoint(87.5, 53.9036778414639)); areaSeries1.Points.Add(new DataPoint(90, 56.7448825012636)); areaSeries1.Points.Add(new DataPoint(92.5, 59.9294987878434)); areaSeries1.Points.Add(new DataPoint(95, 63.0148831289797)); areaSeries1.Points.Add(new DataPoint(97.5, 66.0721745989622)); areaSeries1.Points.Add(new DataPoint(100, 68.8980036274521)); areaSeries1.Points.Add(new DataPoint(102.5, 71.7719322611447)); areaSeries1.Points.Add(new DataPoint(105, 74.4206055336728)); areaSeries1.Points.Add(new DataPoint(107.5, 76.816198386632)); areaSeries1.Points.Add(new DataPoint(110, 79.0040432726983)); areaSeries1.Points.Add(new DataPoint(112.5, 80.9617606926066)); areaSeries1.Points.Add(new DataPoint(115, 83.1345574620341)); areaSeries1.Points.Add(new DataPoint(117.5, 85.0701022046479)); areaSeries1.Points.Add(new DataPoint(120, 86.8557530286516)); areaSeries1.Points.Add(new DataPoint(122.5, 88.5673387745243)); areaSeries1.Points.Add(new DataPoint(125, 90.6003321543338)); areaSeries1.Points.Add(new DataPoint(127.5, 92.439864576254)); areaSeries1.Points.Add(new DataPoint(130, 94.5383744861178)); areaSeries1.Points.Add(new DataPoint(132.5, 96.4600166864507)); areaSeries1.Points.Add(new DataPoint(135, 98.6091052949006)); areaSeries1.Points.Add(new DataPoint(137.5, 100.496459351478)); areaSeries1.Points.Add(new DataPoint(140, 102.705767030085)); areaSeries1.Points.Add(new DataPoint(142.5, 105.009994476992)); areaSeries1.Points.Add(new DataPoint(145, 107.31287026052)); areaSeries1.Points.Add(new DataPoint(147.5, 109.584842542272)); areaSeries1.Points.Add(new DataPoint(150, 111.641435600837)); areaSeries1.Points.Add(new DataPoint(152.5, 113.988459973544)); areaSeries1.Points.Add(new DataPoint(155, 116.50349048027)); areaSeries1.Points.Add(new DataPoint(157.5, 118.753612704274)); areaSeries1.Points.Add(new DataPoint(160, 120.801728924085)); areaSeries1.Points.Add(new DataPoint(162.5, 122.902486914165)); areaSeries1.Points.Add(new DataPoint(165, 125.104391935796)); areaSeries1.Points.Add(new DataPoint(167.5, 127.06056966547)); areaSeries1.Points.Add(new DataPoint(170, 129.217086578495)); areaSeries1.Points.Add(new DataPoint(172.5, 131.151968896274)); areaSeries1.Points.Add(new DataPoint(175, 133.159906275133)); areaSeries1.Points.Add(new DataPoint(177.5, 135.065263957561)); areaSeries1.Points.Add(new DataPoint(180, 137.041870026822)); areaSeries1.Points.Add(new DataPoint(182.5, 138.937477489811)); areaSeries1.Points.Add(new DataPoint(185, 140.776914926282)); areaSeries1.Points.Add(new DataPoint(187.5, 142.786975776398)); areaSeries1.Points.Add(new DataPoint(190, 144.862762377347)); areaSeries1.Points.Add(new DataPoint(192.5, 146.89654967049)); areaSeries1.Points.Add(new DataPoint(195, 149.204343821204)); areaSeries1.Points.Add(new DataPoint(197.5, 151.369748673527)); areaSeries1.Points.Add(new DataPoint(200, 153.324438580137)); areaSeries1.Points.Add(new DataPoint(202.5, 155.173148715344)); areaSeries1.Points.Add(new DataPoint(205, 157.0501827528)); areaSeries1.Points.Add(new DataPoint(207.5, 159.109122278359)); areaSeries1.Points.Add(new DataPoint(210, 161.044446932778)); areaSeries1.Points.Add(new DataPoint(212.5, 162.942364031841)); areaSeries1.Points.Add(new DataPoint(215, 164.966769883021)); areaSeries1.Points.Add(new DataPoint(217.5, 166.89711806788)); areaSeries1.Points.Add(new DataPoint(220, 168.906874949069)); areaSeries1.Points.Add(new DataPoint(222.5, 170.85692034995)); areaSeries1.Points.Add(new DataPoint(225, 172.602125010408)); areaSeries1.Points.Add(new DataPoint(227.5, 173.964258466598)); areaSeries1.Points.Add(new DataPoint(230, 175.629908385654)); areaSeries1.Points.Add(new DataPoint(232.5, 177.495778359378)); areaSeries1.Points.Add(new DataPoint(235, 179.432933300749)); areaSeries1.Points.Add(new DataPoint(237.5, 181.400180771342)); areaSeries1.Points.Add(new DataPoint(240, 183.232300309899)); areaSeries1.Points.Add(new DataPoint(242.5, 185.225502661441)); areaSeries1.Points.Add(new DataPoint(245, 186.979590140413)); areaSeries1.Points.Add(new DataPoint(247.5, 188.816640077725)); areaSeries1.Title = "Maximum/Minimum"; plotModel1.Series.Add(areaSeries1); var lineSeries1 = new LineSeries { Color = OxyColors.Blue, MarkerFill = OxyColors.Transparent, DataFieldX = "Time", DataFieldY = "Value" }; lineSeries1.Points.Add(new DataPoint(0, -0.011447056784037)); lineSeries1.Points.Add(new DataPoint(2.5, 0.179770542275985)); lineSeries1.Points.Add(new DataPoint(5, 0.6808537498493)); lineSeries1.Points.Add(new DataPoint(7.5, 1.31859300249191)); lineSeries1.Points.Add(new DataPoint(10, 2.24910068311687)); lineSeries1.Points.Add(new DataPoint(12.5, 3.11980453160117)); lineSeries1.Points.Add(new DataPoint(15, 3.71247338983811)); lineSeries1.Points.Add(new DataPoint(17.5, 4.39481795774531)); lineSeries1.Points.Add(new DataPoint(20, 5.02439428524784)); lineSeries1.Points.Add(new DataPoint(22.5, 5.87249472528812)); lineSeries1.Points.Add(new DataPoint(25, 6.97260592555283)); lineSeries1.Points.Add(new DataPoint(27.5, 7.91976631331247)); lineSeries1.Points.Add(new DataPoint(30, 8.71294011569719)); lineSeries1.Points.Add(new DataPoint(32.5, 9.82998408944345)); lineSeries1.Points.Add(new DataPoint(35, 11.208899776828)); lineSeries1.Points.Add(new DataPoint(37.5, 12.7442103374955)); lineSeries1.Points.Add(new DataPoint(40, 14.0180206081681)); lineSeries1.Points.Add(new DataPoint(42.5, 15.1195629875034)); lineSeries1.Points.Add(new DataPoint(45, 16.4612081950815)); lineSeries1.Points.Add(new DataPoint(47.5, 17.5118421203978)); lineSeries1.Points.Add(new DataPoint(50, 18.4226816405881)); lineSeries1.Points.Add(new DataPoint(52.5, 19.344752313753)); lineSeries1.Points.Add(new DataPoint(55, 20.47048124027)); lineSeries1.Points.Add(new DataPoint(57.5, 21.8032585135211)); lineSeries1.Points.Add(new DataPoint(60, 23.4655788326243)); lineSeries1.Points.Add(new DataPoint(62.5, 24.9628808265612)); lineSeries1.Points.Add(new DataPoint(65, 26.7799264178984)); lineSeries1.Points.Add(new DataPoint(67.5, 28.8753610496295)); lineSeries1.Points.Add(new DataPoint(70, 30.9831304948466)); lineSeries1.Points.Add(new DataPoint(72.5, 33.1557418763199)); lineSeries1.Points.Add(new DataPoint(75, 35.1392386567962)); lineSeries1.Points.Add(new DataPoint(77.5, 37.3626727617638)); lineSeries1.Points.Add(new DataPoint(80, 39.7822682973613)); lineSeries1.Points.Add(new DataPoint(82.5, 42.0505038654434)); lineSeries1.Points.Add(new DataPoint(85, 44.3977945883283)); lineSeries1.Points.Add(new DataPoint(87.5, 47.0524522387201)); lineSeries1.Points.Add(new DataPoint(90, 49.8186190205946)); lineSeries1.Points.Add(new DataPoint(92.5, 52.8980099892933)); lineSeries1.Points.Add(new DataPoint(95, 55.9174513617612)); lineSeries1.Points.Add(new DataPoint(97.5, 58.9513015195966)); lineSeries1.Points.Add(new DataPoint(100, 61.7974952408334)); lineSeries1.Points.Add(new DataPoint(102.5, 64.738330780104)); lineSeries1.Points.Add(new DataPoint(105, 67.4211349969828)); lineSeries1.Points.Add(new DataPoint(107.5, 69.8712285745755)); lineSeries1.Points.Add(new DataPoint(110, 72.0935083678195)); lineSeries1.Points.Add(new DataPoint(112.5, 74.0991599504599)); lineSeries1.Points.Add(new DataPoint(115, 76.3529601655682)); lineSeries1.Points.Add(new DataPoint(117.5, 78.3984034376212)); lineSeries1.Points.Add(new DataPoint(120, 80.2446080657163)); lineSeries1.Points.Add(new DataPoint(122.5, 82.0166768951652)); lineSeries1.Points.Add(new DataPoint(125, 84.0836307024042)); lineSeries1.Points.Add(new DataPoint(127.5, 86.002041560459)); lineSeries1.Points.Add(new DataPoint(130, 88.2007526944628)); lineSeries1.Points.Add(new DataPoint(132.5, 90.2149178416771)); lineSeries1.Points.Add(new DataPoint(135, 92.4969469740507)); lineSeries1.Points.Add(new DataPoint(137.5, 94.5261970891274)); lineSeries1.Points.Add(new DataPoint(140, 96.875636035961)); lineSeries1.Points.Add(new DataPoint(142.5, 99.3532051177711)); lineSeries1.Points.Add(new DataPoint(145, 101.798603562731)); lineSeries1.Points.Add(new DataPoint(147.5, 104.167851405622)); lineSeries1.Points.Add(new DataPoint(150, 106.272973097546)); lineSeries1.Points.Add(new DataPoint(152.5, 108.627298327525)); lineSeries1.Points.Add(new DataPoint(155, 111.142220874895)); lineSeries1.Points.Add(new DataPoint(157.5, 113.39323598067)); lineSeries1.Points.Add(new DataPoint(160, 115.418603686089)); lineSeries1.Points.Add(new DataPoint(162.5, 117.504522115157)); lineSeries1.Points.Add(new DataPoint(165, 119.739599898383)); lineSeries1.Points.Add(new DataPoint(167.5, 121.732281108169)); lineSeries1.Points.Add(new DataPoint(170, 123.916863232882)); lineSeries1.Points.Add(new DataPoint(172.5, 125.845349591829)); lineSeries1.Points.Add(new DataPoint(175, 127.837813666155)); lineSeries1.Points.Add(new DataPoint(177.5, 129.769825293343)); lineSeries1.Points.Add(new DataPoint(180, 131.745076660018)); lineSeries1.Points.Add(new DataPoint(182.5, 133.655644406055)); lineSeries1.Points.Add(new DataPoint(185, 135.556597036476)); lineSeries1.Points.Add(new DataPoint(187.5, 137.637454717438)); lineSeries1.Points.Add(new DataPoint(190, 139.789876077902)); lineSeries1.Points.Add(new DataPoint(192.5, 141.856918632941)); lineSeries1.Points.Add(new DataPoint(195, 144.210416242951)); lineSeries1.Points.Add(new DataPoint(197.5, 146.438890474634)); lineSeries1.Points.Add(new DataPoint(200, 148.432012631876)); lineSeries1.Points.Add(new DataPoint(202.5, 150.354530130282)); lineSeries1.Points.Add(new DataPoint(205, 152.283573865743)); lineSeries1.Points.Add(new DataPoint(207.5, 154.350769505022)); lineSeries1.Points.Add(new DataPoint(210, 156.322715249645)); lineSeries1.Points.Add(new DataPoint(212.5, 158.220287512602)); lineSeries1.Points.Add(new DataPoint(215, 160.239688355634)); lineSeries1.Points.Add(new DataPoint(217.5, 162.161841185327)); lineSeries1.Points.Add(new DataPoint(220, 164.135674956621)); lineSeries1.Points.Add(new DataPoint(222.5, 166.004863421039)); lineSeries1.Points.Add(new DataPoint(225, 167.640597222485)); lineSeries1.Points.Add(new DataPoint(227.5, 168.928940251669)); lineSeries1.Points.Add(new DataPoint(230, 170.552868003446)); lineSeries1.Points.Add(new DataPoint(232.5, 172.399869402056)); lineSeries1.Points.Add(new DataPoint(235, 174.346163347851)); lineSeries1.Points.Add(new DataPoint(237.5, 176.33268720905)); lineSeries1.Points.Add(new DataPoint(240, 178.153302327545)); lineSeries1.Points.Add(new DataPoint(242.5, 180.100497714128)); lineSeries1.Points.Add(new DataPoint(245, 181.831839179449)); lineSeries1.Points.Add(new DataPoint(247.5, 183.611763662664)); lineSeries1.Title = "Average"; plotModel1.Series.Add(lineSeries1); return plotModel1; }
public static PlotModel FilteringInvalidPointsLog() { var plot = new PlotModel("Filtering invalid points on logarithmic axes"); plot.Axes.Add(new LogarithmicAxis(AxisPosition.Bottom, "X-axis")); plot.Axes.Add(new LogarithmicAxis(AxisPosition.Left, "Y-axis")); var ls = new LineSeries(); ls.Points.Add(new DataPoint(double.NaN, double.NaN)); ls.Points.Add(new DataPoint(1, 1)); ls.Points.Add(new DataPoint(10, 10)); ls.Points.Add(new DataPoint(0, 20)); ls.Points.Add(new DataPoint(100, 2)); ls.Points.Add(new DataPoint(1000, 12)); ls.Points.Add(new DataPoint(4.5, 0)); ls.Points.Add(new DataPoint(10000, 4)); ls.Points.Add(new DataPoint(100000, 14)); ls.Points.Add(new DataPoint(double.NaN, double.NaN)); ls.Points.Add(new DataPoint(1000000, 5)); ls.Points.Add(new DataPoint(double.NaN, double.NaN)); plot.Series.Add(ls); return plot; }
public static PlotModel SmoothLine() { var model = new PlotModel("Smooth Line") { LegendSymbolLength = 24 }; var s1 = new LineSeries("Series 1") { Color = OxyColors.Purple, MarkerType = MarkerType.Circle, MarkerSize = 4, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.Purple, MarkerStrokeThickness = 1.0, Smooth = true }; s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 5)); s1.Points.Add(new DataPoint(20, 1)); s1.Points.Add(new DataPoint(30, 20)); model.Series.Add(s1); s1 = new LineSeries("Series 2 - tracker") { Color = OxyColors.OrangeRed, MarkerType = MarkerType.Diamond, MarkerSize = 4, MarkerStroke = OxyColors.WhiteSmoke, MarkerFill = OxyColors.OrangeRed, MarkerStrokeThickness = 1.0, Smooth = true }; s1.Points.Add(new DataPoint(0, 15)); s1.Points.Add(new DataPoint(3, 23)); s1.Points.Add(new DataPoint(9, 30)); s1.Points.Add(new DataPoint(20, 12)); s1.Points.Add(new DataPoint(30, 10)); model.Series.Add(s1); s1.CanTrackerInterpolatePoints = true; return model; }
public static PlotModel FilteringPointsOutsideRange() { var plot = new PlotModel("Filtering points outside (-1,1)"); plot.Axes.Add(new LinearAxis(AxisPosition.Bottom, "X-axis") { FilterMinValue=-1, FilterMaxValue=1}); plot.Axes.Add(new LinearAxis(AxisPosition.Left, "Y-axis") { FilterMinValue = -1, FilterMaxValue = 1 }); var ls = new LineSeries(); for (double i = 0; i < 200;i+=0.01) ls.Points.Add(new DataPoint(0.01*i*Math.Sin(i), 0.01*i*Math.Cos(i))); plot.Series.Add(ls); return plot; }
private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { #region avg requests sent var ls = new LineSeries("tmp"); if (lineoxysum.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxysum.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } int pointcount = ls.Points.Count; double nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, e.ProgressPercentage)); lineoxysum.ItemsSource = ls.Points; labelMax.Content = ls.Points.Count > 0 ? ls.Points.Max(p => Math.Abs(p.Y)).ToString("F2") : "0"; lbCurrReqValue.Content = ls.Points.Last().Y.ToString("F2"); #endregion #region Avg home response time double avg = 0; if (requestTotal > 0) avg = (((double)totalTimeHome / (((double)requestTotal) / 2d)) / 1000d); ls = new LineSeries("tmp"); if (lineoxyavgH.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxyavgH.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } pointcount = ls.Points.Count; nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, avg)); lineoxyavgH.ItemsSource = ls.Points; lbAvgHomeTimeValue.Content = avg.ToString("F2"); #endregion #region Avg search response time lbCurrReqValue.Content = ls.Points.Last().Y.ToString("F2"); avg = 0; if (requestTotal > 0) avg = (((double)totalTimeSearch / (((double)requestTotal)/2d)) / 1000d); ls = new LineSeries("tmp"); if (lineoxyavgS.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxyavgS.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } pointcount = ls.Points.Count; nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, avg)); lineoxyavgS.ItemsSource = ls.Points; #endregion #region Requests sent to home /* * Line series sent to home * */ ls = new LineSeries("tmp"); ls.Title = "Requests sent"; ls.Color = OxyColors.DarkMagenta; if (lineoxyhome.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxyhome.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } pointcount = ls.Points.Count; nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, requestsSentToSearch)); lineoxyhome.ItemsSource = ls.Points; lbNbRequestsSentValue.Content = requestsSentToSearch; #endregion #region Requests received from home /* * Line series received from home * */ ls = new LineSeries("tmp"); ls.Title = "Requests received from home"; ls.Color = OxyColors.AliceBlue; if (lineoxyreceivehome.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxyreceivehome.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } pointcount = ls.Points.Count; nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, requestsReceivedFromHome)); lineoxyreceivehome.ItemsSource = ls.Points; lbNbResponseFromHomeValue.Content = requestsReceivedFromHome; #endregion #region Requests received from home /* * Line series received from search * */ ls = new LineSeries("tmp"); if (lineoxyreceivesearch.ItemsSource == null) ls.Points = new List<IDataPoint>(); else { foreach (DataPoint point in lineoxyreceivesearch.ItemsSource) { ls.Points.Add(new DataPoint(point.X, point.Y)); } } pointcount = ls.Points.Count; nextpoint = pointcount > 0 ? ls.Points.Max(p => p.X) + 1 : 1; if (pointcount == 100) ls.Points.RemoveAt(0); ls.Points.Add(new DataPoint(nextpoint, requestsReceivedFromSearch)); lineoxyreceivesearch.ItemsSource = ls.Points; lbNbResponseFromSearchValue.Content = requestsReceivedFromSearch; #endregion MasterPlot.RefreshPlot(true); PlotRequestsSent.RefreshPlot(true); labelFailed.Content = requestFailed; lbTiemoutRequestValue.Content = requestTimeout; }
public static PlotModel RectangleAnnotationsHorizontals() { var model = new PlotModel("RectangleAnnotation - horizontal bands"); model.Axes.Add(new LinearAxis(AxisPosition.Bottom, 0, 10)); model.Axes.Add(new LinearAxis(AxisPosition.Left, 87, 97) { MajorStep = 1, MinorStep = 1 }); model.Annotations.Add(new RectangleAnnotation { MinimumY = 89.5, MaximumY = 90.8, Text = "Invalid", Fill = OxyColors.Red.ChangeAlpha(99) }); model.Annotations.Add(new RectangleAnnotation { MinimumY = 90.8, MaximumY = 92.1, Fill = OxyColors.Orange.ChangeAlpha(99) }); model.Annotations.Add(new RectangleAnnotation { MinimumY = 92.1, MaximumY = 94.6, Fill = OxyColors.Yellow.ChangeAlpha(99) }); model.Annotations.Add(new RectangleAnnotation { MinimumY = 94.6, MaximumY = 96, Text = "Ok", Fill = OxyColors.Green.ChangeAlpha(99) }); LineSeries series1; model.Series.Add(series1 = new LineSeries { Color = OxyColors.Black, StrokeThickness = 6.0, LineJoin = OxyPenLineJoin.Round }); series1.Points.Add(new DataPoint(0.5, 90.7)); series1.Points.Add(new DataPoint(1.5, 91.2)); series1.Points.Add(new DataPoint(2.5, 91)); series1.Points.Add(new DataPoint(3.5, 89.5)); series1.Points.Add(new DataPoint(4.5, 92.5)); series1.Points.Add(new DataPoint(5.5, 93.1)); series1.Points.Add(new DataPoint(6.5, 94.5)); series1.Points.Add(new DataPoint(7.5, 95.5)); series1.Points.Add(new DataPoint(8.5, 95.7)); series1.Points.Add(new DataPoint(9.5, 96.0)); return model; }
public static PlotModel ComplexSmoothLine() { var model = new PlotModel("Complex Smooth Lines"); var s1 = new LineSeries("Series 1") { Smooth = true }; s1.Points.Add(new DataPoint(-0.03, 22695655)); s1.Points.Add(new DataPoint(-0.02, 34005991)); s1.Points.Add(new DataPoint(-0.01, 40209650)); s1.Points.Add(new DataPoint(0, 41306630)); s1.Points.Add(new DataPoint(0.01, 37296932)); s1.Points.Add(new DataPoint(0.02, 28180557)); s1.Points.Add(new DataPoint(0.03, 13957503)); model.Series.Add(s1); return model; }
private static PlotModel CreateModel(string title, int n = 20) { var model = new PlotModel(title); for (int i = 1; i <= n; i++) { var s = new LineSeries("Series " + i); model.Series.Add(s); for (double x = 0; x < 2 * Math.PI; x += 0.1) s.Points.Add(new DataPoint(x, Math.Sin(x * i) / (i + 1) + i)); } return model; }
public void OnDataChanged() { if(DrawCost && DrawDistance) throw new Exception("Only one of the values can be drawn at once, 'cost' or 'distance'."); double[][] matrixValues = null; if(DrawCost) matrixValues = Dtw.GetCostMatrix(); if (DrawDistance) matrixValues = Dtw.GetDistanceMatrix(); var dtwPath = Dtw.GetPath(); var xLength = Dtw.XLength; var yLength = Dtw.YLength; var cost = Dtw.GetCost(); var costNormalized = Dtw.GetCost() / Math.Sqrt(xLength * xLength + yLength * yLength); var plotModel = new PlotModel(String.Format("Dtw norm by length: {0:0.00}, total: {1:0.00}", costNormalized, cost)) { LegendTextColor = DrawCost || DrawDistance ? OxyColors.White : OxyColors.Black, }; if (matrixValues != null) { var maxMatrixValue = 0.0; for (int i = 0; i < xLength; i++) for (int j = 0; j < yLength; j++) maxMatrixValue = Math.Max(maxMatrixValue, Double.IsPositiveInfinity(matrixValues[i][j]) ? 0 : matrixValues[i][j]); for (int i = 0; i < xLength; i++) for (int j = 0; j < yLength; j++) { var value = matrixValues[i][j]; var isValuePositiveInfinity = Double.IsPositiveInfinity(value); var intensityBytes = isValuePositiveInfinity ? new byte[] { 0, 0, 0 } : GetFauxColourRgbIntensity(value, 0, maxMatrixValue); //var intensityByte = (byte)(255 - Math.Floor(255 * intensity)); plotModel.Annotations.Add(new PolygonAnnotation { Points = new[] { new DataPoint(i - 0.5, j - 0.5), new DataPoint(i + 0.5, j - 0.5), new DataPoint(i + 0.5, j + 0.5), new DataPoint(i - 0.5, j + 0.5), }, StrokeThickness = 0, Selectable = false, Layer = AnnotationLayer.BelowAxes, Fill = OxyColor.FromArgb(255, intensityBytes[0], intensityBytes[1], intensityBytes[2]), }); } for (int i = 0; i < 30; i++) { var intensityBytes = GetFauxColourRgbIntensity(i, 0, 29); plotModel.Annotations.Add(new RectangleAnnotation { MinimumX = -39, MaximumX = -25, MinimumY = -i - 6, MaximumY = -i - 5, Selectable = false, Fill = OxyColor.FromArgb(255, intensityBytes[0], intensityBytes[1], intensityBytes[2]) }); } plotModel.Annotations.Add(new TextAnnotation { Position = new DataPoint(-24, -5), HorizontalAlignment = HorizontalTextAlign.Left, VerticalAlignment = VerticalTextAlign.Middle, StrokeThickness = 0, Text = "0" }); plotModel.Annotations.Add(new TextAnnotation { Position = new DataPoint(-24, -34), HorizontalAlignment = HorizontalTextAlign.Left, VerticalAlignment = VerticalTextAlign.Middle, StrokeThickness = 0, Text = String.Format("{0:0.00}", maxMatrixValue), }); } var matrixPathSeries = new LineSeries("Path") { StrokeThickness = 1, Color = OxyColors.Red, }; for (int i = 0; i < dtwPath.Length; i++) matrixPathSeries.Points.Add(new DataPoint(dtwPath[i].Item1, dtwPath[i].Item2)); plotModel.Series.Add(matrixPathSeries); var seriesMatrixScale = (xLength + yLength) * 0.05; for (int variableIndex = 0; variableIndex < Dtw.SeriesVariables.Length; variableIndex++) { var variableA = Dtw.SeriesVariables[variableIndex]; var variableASeries = variableA.OriginalXSeries; var variableB = Dtw.SeriesVariables[variableIndex]; var variableBSeries = variableB.OriginalYSeries; var minSeriesA = variableASeries.Min(); var maxSeriesA = variableASeries.Max(); var normalizedSeriesA = variableASeries.Select(x => (x - minSeriesA) / (maxSeriesA - minSeriesA)).ToList(); var matrixSeriesA = new LineSeries(variableA.VariableName); for (int i = 0; i < normalizedSeriesA.Count; i++) matrixSeriesA.Points.Add(new DataPoint(i, (-1 + normalizedSeriesA[i]) * seriesMatrixScale - 1 - seriesMatrixScale * (variableIndex + 1))); plotModel.Series.Add(matrixSeriesA); var minSeriesB = variableBSeries.Min(); var maxSeriesB = variableBSeries.Max(); var normalizedSeriesB = variableBSeries.Select(x => (x - minSeriesB) / (maxSeriesB - minSeriesB)).ToList(); var matrixSeriesB = new LineSeries(variableB.VariableName); for (int i = 0; i < normalizedSeriesB.Count; i++) matrixSeriesB.Points.Add(new DataPoint( -normalizedSeriesB[i] * seriesMatrixScale - 1 - seriesMatrixScale * (variableIndex + 1), i)); plotModel.Series.Add(matrixSeriesB); } plotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, " Series A") { Maximum = Math.Max(xLength, yLength), PositionAtZeroCrossing = true}); plotModel.Axes.Add(new LinearAxis(AxisPosition.Left, " Series B") { Maximum = Math.Max(xLength, yLength), PositionAtZeroCrossing = true }); MatrixPlot.Model = plotModel; }
public static PlotModel InvisibleLineSeries() { var model = new PlotModel("Invisible LineSeries"); var s1 = new LineSeries("Series 1"); s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 40)); var s2 = new LineSeries("Series 2") { IsVisible = false }; s2.Points.Add(new DataPoint(40, 20)); s2.Points.Add(new DataPoint(60, 30)); model.Series.Add(s1); model.Series.Add(s2); return model; }
public static PlotModel DateTimeaxisPlotModel() { var start = new DateTime(2010, 01, 01); var end = new DateTime(2015, 01, 01); double increment = 3600 * 24 * 14; // Create a random data collection var r = new Random(); var data = new Collection<DateValue>(); var date = start; while (date <= end) { data.Add(new DateValue { Date = date, Value = r.NextDouble() }); date = date.AddSeconds(increment); } var plotModel1 = new PlotModel("DateTime axis"); var dateTimeAxis1 = new DateTimeAxis { CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek, FirstDayOfWeek = DayOfWeek.Monday, Position = AxisPosition.Bottom }; plotModel1.Axes.Add(dateTimeAxis1); var linearAxis1 = new LinearAxis(); plotModel1.Axes.Add(linearAxis1); var lineSeries1 = new LineSeries { Color = OxyColor.FromArgb(255, 78, 154, 6), MarkerFill = OxyColor.FromArgb(255, 78, 154, 6), MarkerStroke = OxyColors.ForestGreen, MarkerType = MarkerType.Plus, StrokeThickness = 1, DataFieldX = "Date", DataFieldY = "Value", ItemsSource = data }; plotModel1.Series.Add(lineSeries1); return plotModel1; }
public Form1() { InitializeComponent(); button2_Disconnect.Enabled = false; checkBox2MedianChart.Checked = true; textBox1Delay.Text = "1000"; //microcontroller default sampling interval 1000 ms PlotVariables.linearAxisX.Title = "Sample number"; PlotVariables.linearAxisX.Position = AxisPosition.Bottom; PlotVariables.linearAxisX.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139); PlotVariables.linearAxisX.MajorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisX.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139); PlotVariables.linearAxisX.MinorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisX.Maximum = 40; PlotVariables.linearAxisX.Minimum = 0; //PlotVariables.linearAxisX.IsZoomEnabled = false; //PlotVariables.linearAxisX.IsPanEnabled = false; PlotVariables.pm.Axes.Add(PlotVariables.linearAxisX); PlotVariables.linearAxisXTop.Title = "Time"; PlotVariables.linearAxisXTop.Position = AxisPosition.Top; PlotVariables.linearAxisXTop.MajorGridlineColor = OxyColor.FromArgb(40, 255, 0, 139); PlotVariables.linearAxisXTop.MajorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisXTop.MinorGridlineColor = OxyColor.FromArgb(20, 255, 0, 139); PlotVariables.linearAxisXTop.MinorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisXTop.Maximum = 40; PlotVariables.linearAxisXTop.Minimum = 0; PlotVariables.pm.Axes.Add(PlotVariables.linearAxisXTop); PlotVariables.linearAxisY.Title = "Temperature [°C]"; PlotVariables.linearAxisY.Position = AxisPosition.Left; PlotVariables.linearAxisY.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139); PlotVariables.linearAxisY.MajorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisY.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139); PlotVariables.linearAxisY.MinorGridlineStyle = LineStyle.Solid; PlotVariables.linearAxisY.Maximum = 35; PlotVariables.linearAxisY.Minimum = 15; //PlotVariables.linearAxisY.IsZoomEnabled = false; //PlotVariables.linearAxisY.IsPanEnabled = false; PlotVariables.pm.Axes.Add(PlotVariables.linearAxisY); PlotVariables.areaSeries1.DataFieldX2 = "Sample number"; PlotVariables.areaSeries1.DataFieldY2 = "3*Standard deviation-Current temperature"; PlotVariables.areaSeries1.Fill = OxyColors.LightBlue; PlotVariables.areaSeries1.Color = OxyColors.Red; PlotVariables.areaSeries1.StrokeThickness = 0; PlotVariables.areaSeries1.DataFieldX = "Sample number"; PlotVariables.areaSeries1.DataFieldY = "3*Standard deviation+Current temperature"; PlotVariables.areaSeries1.Title = "± 3*\u03C3 area"; //http://www.fileformat.info/info/unicode/char/03c3/index.htm PlotVariables.pm.Series.Add(PlotVariables.areaSeries1); //temperature this.lineSeries1 = new LineSeries(); this.lineSeries1.Color = OxyColor.FromArgb(255, 78, 154, 6); this.lineSeries1.MarkerFill = OxyColor.FromArgb(255, 255, 255, 255); this.lineSeries1.MarkerStroke = OxyColors.ForestGreen; this.lineSeries1.MarkerStrokeThickness = 2; this.lineSeries1.MarkerType = MarkerType.Square; this.lineSeries1.MarkerSize = 2; this.lineSeries1.StrokeThickness = 2; this.lineSeries1.DataFieldX = "Sample"; this.lineSeries1.DataFieldY = "Value"; this.lineSeries1.Title = "Current temperature"; PlotVariables.pm.Series.Add(this.lineSeries1); //mean this.lineSeries2Mean = new LineSeries(); this.lineSeries2Mean.Color = OxyColor.FromArgb(255, 255, 0, 0); this.lineSeries2Mean.MarkerFill = OxyColor.FromArgb(255, 255, 255, 255); this.lineSeries2Mean.MarkerStroke = OxyColors.ForestGreen; this.lineSeries2Mean.MarkerStrokeThickness = 2; this.lineSeries2Mean.MarkerType = MarkerType.None; this.lineSeries2Mean.MarkerSize = 1; this.lineSeries2Mean.StrokeThickness = 1; this.lineSeries2Mean.DataFieldX = "Sample"; this.lineSeries2Mean.DataFieldY = "Value"; this.lineSeries2Mean.Title = "Mean temperature"; PlotVariables.pm.Series.Add(this.lineSeries2Mean); //median this.lineSeries3Median = new LineSeries(); this.lineSeries3Median.Color = OxyColor.FromArgb(255, 0, 0, 255); this.lineSeries3Median.MarkerFill = OxyColor.FromArgb(255, 255, 255, 255); this.lineSeries3Median.MarkerStroke = OxyColors.ForestGreen; this.lineSeries3Median.MarkerStrokeThickness = 2; this.lineSeries3Median.MarkerType = MarkerType.None; this.lineSeries3Median.MarkerSize = 1; this.lineSeries3Median.StrokeThickness = 1; this.lineSeries3Median.DataFieldX = "Sample"; this.lineSeries3Median.DataFieldY = "Value"; this.lineSeries3Median.Title = "Median temperature"; PlotVariables.pm.Series.Add(this.lineSeries3Median); plot1.Model = PlotVariables.pm; }
public static PlotModel LineLegendPositionAtEnd() { // http://www.perceptualedge.com/example2.php var model = new PlotModel("Average (Mean) monthly temperatures in 2003") { PlotMargins = new OxyThickness(60, 4, 60, 40), PlotAreaBorderThickness = 0, IsLegendVisible = false }; var phoenix = new LineSeries("Phoenix") { LineLegendPosition = LineLegendPosition.End }; var raleigh = new LineSeries("Raleigh") { LineLegendPosition = LineLegendPosition.End }; var minneapolis = new LineSeries("Minneapolis") { LineLegendPosition = LineLegendPosition.End }; var phoenixTemps = new[] { 52.1, 55.1, 59.7, 67.7, 76.3, 84.6, 91.2, 89.1, 83.8, 72.2, 59.8, 52.5 }; var raleighTemps = new[] { 40.5, 42.2, 49.2, 59.5, 67.4, 74.4, 77.5, 76.5, 70.6, 60.2, 50.0, 41.2 }; var minneapolisTemps = new[] { 12.2, 16.5, 28.3, 45.1, 57.1, 66.9, 71.9, 70.2, 60.0, 50.0, 32.4, 18.6 }; for (int i = 0; i < 12; i++) { phoenix.Points.Add(new DataPoint(i, phoenixTemps[i])); raleigh.Points.Add(new DataPoint(i, raleighTemps[i])); minneapolis.Points.Add(new DataPoint(i, minneapolisTemps[i])); } model.Series.Add(phoenix); model.Series.Add(raleigh); model.Series.Add(minneapolis); model.Axes.Add(new CategoryAxis(null, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") { AxislineStyle = LineStyle.Solid }); model.Axes.Add(new LinearAxis(AxisPosition.Left, "Fahrenheit") { AxislineStyle = LineStyle.Solid }); return model; }