Esempio n. 1
0
 public void AssignAndShow(PlotModel m, ProcessingClass procCl)
 {
     proc       = procCl;
     Plot.Model = m;
     Plot.InvalidatePlot(true);
     Plot.Show();
 }
Esempio n. 2
0
        /// <summary>
        /// Displaies the plot.
        /// </summary>
        private void DisplayPlot()
        {
            if (pinSequence != null)
            {
                plotView.Model.Series.Clear();

                var current = new TimeSpan(0);
                var data    = new Collection <TimeValue> ();
                for (int i = 0; i < pinSequence.Chain.Count; i++)
                {
                    data.Add(new TimeValue()
                    {
                        Time  = current,
                        Value = ((pinSequence.Chain [i].State == DPinState.HIGH) ? 1 : 0)
                    });
                    current = current.Add(pinSequence.Chain [i].Duration);
                    data.Add(new TimeValue()
                    {
                        Time  = current,
                        Value = ((pinSequence.Chain [i].State == DPinState.HIGH) ? 1 : 0)
                    });
                }

                sequenceSeries = new OxyPlot.Series.LineSeries()
                {
                    DataFieldX      = "Time",
                    DataFieldY      = "Value",
                    ItemsSource     = data,
                    StrokeThickness = 2,
                    Color           = ColorHelper.GdkColorToOxyColor(selectedPin.PlotColor)
                };

                repeateSeries.Color = ColorHelper.GdkColorToOxyColor(selectedPin.PlotColor);

                //next Cycle Tease
                //				if ((rbRepeateContinously.Active || (rbStopAfter.Active && sbRadioBtnStopAfter.ValueAsInt > 1)) && data.Count > 0)
                //				{
                //					var repeateData = new Collection<TimeValue> ();
                //					repeateData.Add (data.Last ());
                //					repeateData.Add (
                //						new TimeValue {
                //							Time = data.Last ().Time,
                //							Value = ((pinSequence.Chain [0].State == DPinState.HIGH) ? 1 : 0)
                //						});
                //					repeateData.Add (
                //						new TimeValue {
                //							Time = data.Last ().Time.Add (pinSequence.Chain [0].Duration),
                //							Value = ((pinSequence.Chain [0].State == DPinState.HIGH) ? 1 : 0)
                //						});
                //					repeateSeries.ItemsSource = repeateData;
                //					plotView.Model.Series.Add (repeateSeries);
                //				}

                plotView.Model.Series.Add(sequenceSeries);
                plotView.InvalidatePlot(true);
                plotView.Model.InvalidatePlot(true);
                plotView.ShowAll();
            }
        }
Esempio n. 3
0
 public void RemoveGraph(string _nameGraph)
 {
     for (int i = 0; i < _canvas.Series.Count; i++)
     {
         if (string.Equals(_canvas.Series[i].Title, _nameGraph) == true)
         {
             _canvas.Series.RemoveAt(i);
         }
     }
     pv.InvalidatePlot(true);
 }
Esempio n. 4
0
        public void UpdatePlot(List <float> dataList)
        {
            var points = dataList.Select((v, index) =>
                                         new DataPoint((double)index, v)
                                         ).ToList();

            _lineSeries.Points.Clear();
            _lineSeries.Points.AddRange(points);

            _pv.InvalidatePlot(true);
        }
Esempio n. 5
0
        public async void InitLoaded(object obj)
        {
            IsDataLoaded    = false;
            IsDataNotLoaded = true;


            await Task.Run(async() =>
            {
                LedgerAccounts = new ObservableCollection <LedgerAccount>(await Service.GetAllLedgerAccountsAsync());
                LedgerGenerals = new ObservableCollection <LedgerGeneral>(await Service.GetAllLedgerGeneralsAsync());
            }).ContinueWith(a =>
            {
                App.Current.Dispatcher.Invoke(() =>
                {
                    PlotModel = new PlotModel();
                    SetUpModelNew();
                    GetIncomeChart();
                    PlotView view = obj as PlotView;
                    view.Model    = PlotModel;
                    view.InvalidatePlot();
                    IsDataLoaded    = true;
                    IsDataNotLoaded = false;
                });
            });
        }
        internal void InitLoaded(object obj)
        {
            IsDataLoaded    = false;
            IsDataNotLoaded = true;



            Task.Run(async() =>
            {
                Beverages    = new ObservableCollection <Beverage>(await Service.GetAllBeveragesForChartAsync());
                OrderDetails = new ObservableCollection <Sale>(await Service.GetAllSalesAsync());
                PlotModel    = new PlotModel();
                SetUpModelNew();
                GetItemSalesChart();
            }).ContinueWith(a =>
            {
                App.Current.Dispatcher.Invoke(() =>
                {
                    PlotView view = obj as PlotView;
                    view.Model    = PlotModel;
                    view.InvalidatePlot();
                    IsDataLoaded    = true;
                    IsDataNotLoaded = false;
                });
            });
        }
Esempio n. 7
0
        public void PlotMirror(double w, double h)
        {
            var model = new PlotModel();

            model.PlotType = PlotType.Cartesian;

            OxyPlot.Series.ScatterSeries sser = new OxyPlot.Series.ScatterSeries()
            {
                MarkerType = MarkerType.Square,
                BinSize    = 2,
                MarkerSize = 0.75
            };

            sser.ItemsSource = m_Points;

            model.Series.Add(sser);
            model.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = AxisPosition.Bottom, Maximum = w / 2.0, Minimum = -w / 2.0, Title = "x, [mm]"
            });
            model.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = AxisPosition.Left, Maximum = h / 2.0, Minimum = -h / 2.0, Title = "y, [mm]"
            });
            model.Axes.Add(new OxyPlot.Axes.LinearColorAxis {
                Position = AxisPosition.Right,
                Palette  = OxyPalettes.Rainbow(200),
            });

            m_Canvas.Model = model;
            m_Canvas.InvalidatePlot(true);
        }
Esempio n. 8
0
        public void InvalidateDisconnected()
        {
            var model = new PlotModel();

            var view = new PlotView {
                Model = model
            };
            var window = new Window {
                Height = 350, Width = 500, Content = view
            };

            Assert.DoesNotThrow(() => window.Show());
            Assert.DoesNotThrow(() => view.InvalidatePlot());
            window.Content = null;
            Assert.DoesNotThrow(() => view.InvalidatePlot());
        }
        public void OnSensorChanged(SensorEvent e)
        {
            lock (syncLock)
            {
                plotModel.Series.Clear();
                var barSeries = new BarSeries
                {
                    ItemsSource = new List <BarItem>(new[]
                    {
                        new BarItem {
                            Value = (e.Values[2]), Color = OxyColors.Red
                        },
                        new BarItem {
                            Value = (e.Values[1]), Color = OxyColors.Green
                        },
                        new BarItem {
                            Value = (e.Values[0]), Color = OxyColors.Blue
                        }
                    }),

                    LabelPlacement    = LabelPlacement.Inside,
                    LabelFormatString = "{0:.00} m/s^-2"
                };
                plotModel.Series.Add(barSeries);
                view.InvalidatePlot(true);
            }
        }
Esempio n. 10
0
        private void UpdatePlots()
        {
            var x = Storage.Uptime.TotalSeconds;

            for (int i = 0; i < 3; i++)
            {
                (accelerometerPlotView.Model.Series[i] as LineSeries).Points.Add(new DataPoint(x, Storage.AccelerometerData[i]));
                (gyroPlotView.Model.Series[i] as LineSeries).Points.Add(new DataPoint(x, Storage.GyroscopeData[i]));
                (magnetometerPlotView.Model.Series[i] as LineSeries).Points.Add(new DataPoint(x, Storage.MagnetometerData[i]));
            }

            accelerometerPlotView.Model.Axes[0].Minimum = x - 10;
            accelerometerPlotView.Model.Axes[0].Maximum = x + 5;
            accelerometerPlotView.Model.Axes[1].Minimum = -20;
            accelerometerPlotView.Model.Axes[1].Maximum = 20;

            gyroPlotView.Model.Axes[0].Minimum = x - 10;
            gyroPlotView.Model.Axes[0].Maximum = x + 5;
            gyroPlotView.Model.Axes[1].Minimum = -7;
            gyroPlotView.Model.Axes[1].Maximum = 7;

            magnetometerPlotView.Model.Axes[0].Minimum = x - 10;
            magnetometerPlotView.Model.Axes[0].Maximum = x + 5;
            magnetometerPlotView.Model.Axes[1].Minimum = -40;
            magnetometerPlotView.Model.Axes[1].Maximum = 40;

            accelerometerPlotView.InvalidatePlot();
            gyroPlotView.InvalidatePlot();
            magnetometerPlotView.InvalidatePlot();
        }
Esempio n. 11
0
        public void InvalidatePlot()
        {
            _now = DateTime.UtcNow;

            if (_axes != null)
            {
                foreach (KeyValuePair <SensorType, LinearAxis> pair in _axes)
                {
                    LinearAxis axis = pair.Value;
                    SensorType type = pair.Key;
                    if (type == SensorType.Temperature)
                    {
                        axis.Unit = _unitManager.TemperatureUnit == TemperatureUnit.Celsius ? "°C" : "°F";
                    }

                    if (!_stackedAxes.Value)
                    {
                        continue;
                    }

                    var annotation = _annotations[pair.Key];
                    annotation.Y = axis.ActualMaximum;
                }
            }

            _plot?.InvalidatePlot(true);
        }
Esempio n. 12
0
        public void InitLoaded(object obj)
        {
            IsDataLoaded    = false;
            IsDataNotLoaded = true;


            Task.Run(async() =>
            {
                Orders = new ObservableCollection <SaleOrder>(await Service.GetAllSalesOrderAsync());

                PlotModel = new PlotModel();
                SetUpModelNew();
                GetTotalSalesChart();
            }).ContinueWith(a =>
            {
                App.Current.Dispatcher.Invoke(() =>
                {
                    PlotView view = obj as PlotView;
                    view.Model    = PlotModel;
                    view.InvalidatePlot();
                    IsDataLoaded    = true;
                    IsDataNotLoaded = false;
                });
            });
        }
 public void SetExample(ExampleInfo example)
 {
     this.Window.Title   = example.Title;
     plotView.Model      = example.PlotModel;
     plotView.Controller = example.PlotController;
     plotView.InvalidatePlot(true);
 }
Esempio n. 14
0
        /// <summary>
        /// This is the event handler that runs every time the Arduino sends a new message.
        /// It parses the message to an array and sends the values to both the graph
        /// and the SaMi object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Characteristic_ValueUpdated(object sender, Plugin.BLE.Abstractions.EventArgs.CharacteristicUpdatedEventArgs e)
        {
            string valueString = Encoding.Default.GetString(e.Characteristic.Value);
            int    count       = valueString.Length - valueString.Replace(",", "").Length;

            if (count != 5 || valueString[0] == ',')
            {
                return;
            }
            double[] values;

            /*This part is wrapped in a try/catch because BLE messages can be a bit jumbled when
             * connection has just been established. Jumbled message won't parse, of course,
             * so they get skipped.*/
            try
            {
                values = Array.ConvertAll(valueString.Split(','), Double.Parse);
            }
            catch
            {
                return;
            }
            SenProReading newReading = new SenProReading {
                DateTime = DateTime.Now, Values = values
            };
            double dateTimePlot = DateTimeAxis.ToDouble(newReading.DateTime);

            (plot.Model.Series[0] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[0]));
            (plot.Model.Series[1] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[1]));
            (plot.Model.Series[2] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[2]));
            (plot.Model.Series[3] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[3]));
            (plot.Model.Series[4] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[4]));
            (plot.Model.Series[5] as LineSeries).Points.Add(new DataPoint(dateTimePlot, newReading.Values[5]));

            if ((plot.Model.Series[0] as LineSeries).Points.Count > 15)
            {
                (plot.Model.Series[0] as LineSeries).Points.RemoveAt(0);
                (plot.Model.Series[1] as LineSeries).Points.RemoveAt(0);
                (plot.Model.Series[2] as LineSeries).Points.RemoveAt(0);
                (plot.Model.Series[3] as LineSeries).Points.RemoveAt(0);
                (plot.Model.Series[4] as LineSeries).Points.RemoveAt(0);
                (plot.Model.Series[5] as LineSeries).Points.RemoveAt(0);
            }

            plot.Model.Axes[0].Maximum = DateTimeAxis.ToDouble(newReading.DateTime.AddSeconds(2));
            plot.Model.Axes[0].Minimum = DateTimeAxis.ToDouble(newReading.DateTime.AddSeconds(-8));

            samiClient.AddMeasurement(newReading);

            if (samiClient.MeasurementMinuteCheck())
            {
                samiClient.SaveResults();
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                plot.InvalidatePlot();
            });
        }
Esempio n. 15
0
            public void InvalidateFromOtherThread()
            {
                var model    = new PlotModel();
                var plotView = new PlotView {
                    Model = model
                };

                Task.Factory.StartNew(() => plotView.InvalidatePlot()).Wait();
            }
Esempio n. 16
0
            public void InvalidateFromSameThread()
            {
                var model    = new PlotModel();
                var plotView = new PlotView {
                    Model = model
                };

                plotView.InvalidatePlot();
            }
Esempio n. 17
0
        public void AddDataToChartSeries()
        {
            for (int i = 0; i < _mainSeries_dict.Count; i++)
            {
                List <PointF> _chart_list = _mainSeries_dict[_mainSeries_dict.Keys.ElementAt(i)];
                LineSeries    serie       = new LineSeries();

                serie.MarkerSize = 2;
                serie.MarkerFill = Color.LightBlue.ToOxyColor();
                serie.MarkerType = MarkerType.Circle;
                serie.LineStyle  = LineStyle.Solid;
                serie.Color      = Color.White.ToOxyColor();

                foreach (var item in _chart_list)
                {
                    DataPoint point = new DataPoint(item.X, item.Y);
                    serie.Points.Add(point);
                }

                MainPlotModel.Series.Add(serie);
                MainChart.InvalidatePlot(true);
            }
            //// Get index from last data added
            //int lastDataAdded_index = 0;
            //lastDataAdded_index = _mainSeries_dict.Count - 1;

            //List<PointF> _chart_list = _mainSeries_dict[_mainSeries_dict.Keys.ElementAt(lastDataAdded_index)];
            //LineSeries serie = new LineSeries();

            //serie.MarkerSize = 2;
            //serie.MarkerFill = Color.LightBlue.ToOxyColor();
            //serie.MarkerType = MarkerType.Circle;
            //serie.LineStyle = LineStyle.Solid;
            //serie.Color = Color.White.ToOxyColor();

            //foreach (var item in _chart_list)
            //{
            //	DataPoint point = new DataPoint(item.X, item.Y);
            //	serie.Points.Add(point);
            //}

            //MainPlotModel.Series.Add(serie);
            //MainChart.InvalidatePlot(true);
        }
Esempio n. 18
0
        private void Button_Click_Add_Crypto(object sender, RoutedEventArgs e)
        {
            string cryptoCurrency = ParseCurrencyInput(nameOfCryptoCurrency, FileType.CRYPTO_CURRENCY);
            string currency       = ParseCurrencyInput(nameOfCurrency, FileType.CURRENCY);

            if (!currency.Equals("") & !cryptoCurrency.Equals(""))
            {
                string nameOfSeries = cryptoCurrency + "__" + currency;
                bool   success      = Gvm.addSeries(nameOfSeries, "CRYPTO CURRENCIES");

                if (success)
                {
                    Thread newWindowThread = new Thread(new ThreadStart(showWaitDialog));
                    newWindowThread.SetApartmentState(ApartmentState.STA);
                    newWindowThread.IsBackground = true;
                    newWindowThread.Start();

                    string contentOfTimeSeriesComboBox = TimeSeriesTypeComboBox.Text;

                    int counterAttempts = 0;

                    List <DataPoint> dataPoints;
                    do
                    {
                        dataPoints = Mwvm.getSpecificData(cryptoCurrency, contentOfTimeSeriesComboBox, currentSelectedForCrypto + " crypto", "", currency);
                        if (dataPoints != null)
                        {
                            Gvm.addPoints(nameOfSeries, dataPoints);
                            double[] values = Statistics.getValues(dataPoints);
                            StatisticsTable.Items.Add(new Statistics(values, "crypto", nameOfSeries));
                        }

                        counterAttempts++;
                    } while (dataPoints == null && counterAttempts < 3);

                    CloseDialogSafe();
                    newWindowThread.Abort();

                    if (dataPoints == null)
                    {
                        Gvm.removeSeries(nameOfSeries);
                        MessageBox.Show("Problem with data delivery for " + nameOfSeries, "Error");
                    }
                }
                else
                {
                    MessageBox.Show("This series already exists!");
                }
            }
            else
            {
                MessageBox.Show("Invalid input!");
            }

            PlotView.InvalidatePlot(true); // refresh
        }
        private async void LoadData()
        {
            var client = new SensorThingsClient(serverurl);
            var odata  = new OdataQuery {
                QueryExpand = new QueryExpand(new[]
                {
                    new Expand(new[] { "Observations" })
                }
                                              )
            };


            var response = await client.GetDatastream(datastreamid, odata);

            var datastream = response.Result;

            var lineSerie = new OxyPlot.Series.LineSeries
            {
                StrokeThickness             = 2,
                MarkerSize                  = 3,
                MarkerStroke                = Colors.GetColors[0],
                MarkerType                  = MarkerTypes.markerTypes[0],
                CanTrackerInterpolatePoints = false,
                Title  = datastream.Description,
                Smooth = false,
            };

            var obs = datastream.Observations.OrderBy(m => m.PhenomenonTime.Start);

            foreach (var observation in obs)
            {
                if (observation.PhenomenonTime != null)
                {
                    var time = observation.GetPhenomenonTime(true);
                    var res  = Convert.ToDouble(observation.Result);
                    lineSerie.Points.Add(new DataPoint(OxyPlot.Axes.DateTimeAxis.ToDouble(time), res));
                }
            }

            plotModel.Series.Add(lineSerie);
            plotview.InvalidatePlot();
        }
Esempio n. 20
0
        private void Button_Delete_Click(object sender, RoutedEventArgs e)
        {
            int index = StatisticsTable.SelectedIndex;

            if (index >= 0)
            {
                StatisticsTable.Items.RemoveAt(index);
                Gvm.removeSeries(index);

                PlotView.InvalidatePlot(true); // refresh
            }
        }
Esempio n. 21
0
        private void UpdatePlot()
        {
            SampleComputationFlags computation = SampleComputationFlags.None;

            if (_darkSubtraction)
            {
                computation = computation | SampleComputationFlags.DarkSubtraction;
            }

            if (_intensityCorrection)
            {
                computation = computation | SampleComputationFlags.IntensityCorrection;
            }

            IComputedSample computedSample = _clientContext.ComputeSample(_computationDependencies, computation);

            _plotModel.Series.Clear();

            LineSeries lineSeries = new LineSeries();

            _plotModel.Axes.Clear();
            _plotModel.Series.Add(lineSeries);

            _plotModel.Axes.Add(new LinearAxis {
                Key = "sigY", Position = AxisPosition.Left, Title = "Counts"
            });
            if (_ramanShift)
            {
                _plotModel.Axes.Add(new LinearAxis {
                    Key = "sigX", Position = AxisPosition.Bottom, Title = "Raman Shift"
                });

                for (int i = 0; i < computedSample.Data.Length; i++)
                {
                    lineSeries.Points.Add(new DataPoint(computedSample.RamanShiftData[i], computedSample.Data[i]));
                }
            }
            else
            {
                _plotModel.Axes.Add(new LinearAxis {
                    Key = "sigX", Position = AxisPosition.Bottom, Title = "Wavelength"
                });

                for (int i = 0; i < computedSample.Data.Length; i++)
                {
                    lineSeries.Points.Add(new DataPoint(computedSample.WavelengthData[i], computedSample.Data[i]));
                }
            }

            PlotView.InvalidatePlot();
        }
        // Scaling and setting the Graph.
        private void SetGraphData(PlotView pw, double x, double y)
        {
            var xAxis = pw.Model.Axes[0];
            var yAxis = pw.Model.Axes[1];

            //Scaling the axes.
            xAxis.Maximum = x + 10;
            yAxis.Maximum = y + 10;

            (pw.Model.Series[0] as ScatterSeries).Points.Add(new ScatterPoint(x, y, 3, 1));
            (pw.Model.Series[1] as LineSeries).Points.Add(new DataPoint(xAxis.Minimum, _intercept));
            (pw.Model.Series[1] as LineSeries).Points.Add(new DataPoint(xAxis.Maximum, _slope * xAxis.Maximum + _intercept));
            pw.InvalidatePlot(false);
        }
Esempio n. 23
0
        public void VisualizeData(SortedDictionary <DateTime, double> loadData, bool marker)
        {
            DataPoint dp = new DataPoint(DateTimeAxis.ToDouble(loadData.Keys.Last()), loadData.Values.Last());

            lineSeries.Points.Add(dp);

            //marker 1 value
            if (marker == true)
            {
                markerSeries.Points.Add(dp);
            }

            //for update chart
            Plot.InvalidatePlot(true);
        }
Esempio n. 24
0
        public void PlotDetector(Detector detector)
        {
            var model = new PlotModel();

            model.PlotType = PlotType.Cartesian;

            var sser = new OxyPlot.Series.HeatMapSeries()
            {
                X0           = detector.MinDetectorPositionMer,
                X1           = detector.MaxDetectorPositionMer,
                Y0           = detector.MinDetectorPositionSag - detector.PixelSize / 2.0,
                Y1           = detector.MaxDetectorPositionSag + detector.PixelSize / 2.0,
                Data         = detector.GetHeatMap(),
                Interpolate  = false,
                RenderMethod = HeatMapRenderMethod.Bitmap
            };

            model.Series.Add(sser);
            model.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Title = "x, [mm]", Position = AxisPosition.Bottom, Maximum = detector.MaxDetectorPositionMer, Minimum = detector.MinDetectorPositionMer
            });
            model.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Title = "y, [mm]", Position = AxisPosition.Left, Maximum = detector.MaxDetectorPositionSag, Minimum = detector.MinDetectorPositionSag
            });
            model.Axes.Add(new OxyPlot.Axes.LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Gray(1000).Reverse()
            });



            model.Axes[0].AxisChanged += DetectorPlotX_AxisChanged;
            model.Axes[1].AxisChanged += DetectorPlotY_AxisChanged;

            m_Canvas.Model = model;
            m_Canvas.InvalidatePlot(true);
        }
Esempio n. 25
0
 public static void RefreshModel(PlotView view)
 {
     view.Model = new PlotModel();
     view.Model.Series.Add(new FunctionSeries(ThingSpeakLightConverter.Eval, 0, 1024, 1024, "monitor Brightness by light level"));
     OxyPlot.Axes.LinearAxis x = new OxyPlot.Axes.LinearAxis()
     {
         Position = AxisPosition.Bottom, Minimum = -1, Maximum = 1025
     };
     OxyPlot.Axes.LinearAxis y = new OxyPlot.Axes.LinearAxis()
     {
         Position = AxisPosition.Left, Minimum = -1, Maximum = 101
     };
     view.Model.Axes.Add(x);
     view.Model.Axes.Add(y);
     view.InvalidatePlot();
     view.Controller.UnbindAll();
 }
        public static PlotView Chart1(string _tytul, double[,] data)
        {
            var plot = new PlotView
            {
                Dock = DockStyle.Fill,
                Size = new Size(500, 500)
            };

            var model = new PlotModel {
                Title = _tytul
            };
            var scatterSeries = new ScatterSeries()
            {
                MarkerType = MarkerType.Circle, MarkerSize = 0.01, MarkerFill = OxyColors.Aqua
            };

            for (var i = 0; i < Program.TestDane.Length / 2; i++)
            {
                var x = Program.TestDane[0, i];
                var y = Program.TestDane[1, i];
                scatterSeries.Points.Add(new ScatterPoint(x, y, 2));
            }

            var lineSeries = new LineSeries()
            {
            };

            for (var i = 0; i < data.Length / 2; i++)
            {
                lineSeries.Points.Add(new DataPoint(data[0, i], data[1, i]));
            }
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, Minimum = -5, Maximum = 5
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Minimum = -8, Maximum = 5
            });
            model.Series.Add(scatterSeries);
            model.Series.Add(lineSeries);
            plot.Model = model;

            plot.InvalidatePlot(true);
            model.InvalidatePlot(true);

            return(plot);
        }
Esempio n. 27
0
        private void GetGraph_OnClick(object sender, RoutedEventArgs e)
        {
            var power = Convert.ToByte(PowerComboBox.Text);

            TextBox[]     textBoxs = { CoeffA0, CoeffA1, CoeffA2, CoeffA3, CoeffA4, CoeffA5 };
            List <double> A        = new List <double>();

            for (int k = 0; k <= power; k++)
            {
                A.Add(Convert.ToDouble(textBoxs[k].Text));
            }
            Computing T = new Computing(A, power);
            var       newModel = new PlotModel();
            double    xMin, xMax, yMin, yMax;

            xMax = Convert.ToDouble(XMAX.Text);
            xMin = Convert.ToDouble(XMIN.Text);
            yMax = Convert.ToDouble(YMAX.Text);
            yMin = Convert.ToDouble(YMIN.Text);
            newModel.Axes.Clear();
            newModel.Axes.Add(new LinearAxis()
            {
                Position = AxisPosition.Bottom,
                PositionAtZeroCrossing = true,
                AxislineStyle          = LineStyle.Solid,
                FilterMaxValue         = xMax,
                FilterMinValue         = xMin
            });
            newModel.Axes.Add(new LinearAxis()
            {
                Position = AxisPosition.Left,
                PositionAtZeroCrossing = true,
                AxislineStyle          = LineStyle.Solid,
                FilterMaxValue         = yMax,
                FilterMinValue         = yMin
            });
            newModel.Axes[0].Reset();
            newModel.Axes[1].Reset();
            newModel.Axes[0].Maximum = xMax;
            newModel.Axes[0].Minimum = xMin;
            newModel.Axes[1].Maximum = yMax;
            newModel.Axes[1].Minimum = yMin;
            PlotView.InvalidatePlot();
            newModel.Series.Add(new FunctionSeries(T.FxP, xMin - 100, xMax + 100, 0.1));
            PlotView.Model = newModel;
        }
Esempio n. 28
0
        public void DrawTideGraph(List <DateTimeValues> values)
        {
            ScatterSeries rawTide = new ScatterSeries()
            {
                MarkerType = MarkerType.Circle,
                MarkerSize = 2,
            };


            foreach (var item in values)
            {
                rawTide.Points.Add(new ScatterPoint(DateTimeAxis.ToDouble(item.dateTime), item.values));
            }

            _canvas.Series.Add(rawTide);

            pv.InvalidatePlot(true);
        }
        public async void updateCellGraph()
        {
            isUpdating = true;
            if (plotView == null)
            {
                return;
            }
            else if (plotView.Hidden)
            {
                plotView.Hidden = false;
            }

            var device = (cellSensor as GaugeDeviceSensor)?.device;

            isConnected = device.isConnected;

            if (device == null || device.isConnected)
            {
                InvalidatePrimary();
                if (cellSensor.linkedSensor != null && !(cellSensor.linkedSensor is ManualSensor))
                {
                    InvalidateSecondary();
                }
                InvalidateTime();

                InvokeOnMainThread(() => {
                    plotView.InvalidatePlot();
                    plotView.Model.InvalidatePlot(true);
                });
            }

            await Task.Delay(TimeSpan.FromMilliseconds(NSUserDefaults.StandardUserDefaults.IntForKey("settings_default_trending_interval")));

            if (isConnected)
            {
                plotView.Hidden = false;
                updateCellGraph();
            }
            else
            {
                isUpdating      = false;
                plotView.Hidden = true;
            }
        }
Esempio n. 30
0
        public void InvalidatePlot()
        {
            _now = DateTime.UtcNow;

            if (_axes != null)
            {
                foreach (KeyValuePair <SensorType, LinearAxis> pair in _axes)
                {
                    LinearAxis axis = pair.Value;
                    SensorType type = pair.Key;
                    if (type == SensorType.Temperature)
                    {
                        axis.Unit = _unitManager.TemperatureUnit == TemperatureUnit.Celsius ? "°C" : "°F";
                    }
                }
            }

            _plot?.InvalidatePlot(true);
        }
Esempio n. 31
0
 public void InvalidateFromSameThread()
 {
     var model = new PlotModel();
     var plotView = new PlotView { Model = model };
     plotView.InvalidatePlot();
 }
Esempio n. 32
0
 public void InvalidateFromOtherThread()
 {
     var model = new PlotModel();
     var plotView = new PlotView { Model = model };
     Task.Factory.StartNew(() => plotView.InvalidatePlot()).Wait();
 }