Example #1
0
        private void SetGraphicsAchievementsSources()
        {
            var data = AchievementsDatabase.GetCountBySources();

            //let create a mapper so LiveCharts know how to plot our CustomerViewModel class
            var customerVmMapper = Mappers.Xy <CustomerForSingle>()
                                   .X((value, index) => index)
                                   .Y(value => value.Values);

            //lets save the mapper globally
            Charting.For <CustomerForSingle>(customerVmMapper);

            SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection();

            StatsGraphicAchievementsSeries.Add(new ColumnSeries
            {
                Title  = "",
                Values = data.SeriesUnlocked
            });
            //StatsGraphicAchievementsSeries.Add(new LineSeries
            //{
            //    Title = "",
            //    Values = data.SeriesTotal
            //});

            StatsGraphicAchievementsSources.Series  = StatsGraphicAchievementsSeries;
            StatsGraphicAchievementsSourcesX.Labels = data.Labels;
        }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();
            _elementFactory.canvas = canvas;
            var mapper = Mappers.Xy <TimeSpanPoint>()
                         .X(model => model.DateTime.TotalMilliseconds) //use DateTime.Ticks as X
                         .Y(model => model.Value);                     //use the value property as Y

            //lets save the mapper globally.
            Charting.For <TimeSpanPoint>(mapper);
            SeriesCollection = new SeriesCollection
            {
                new LineSeries()
                {
                    Title          = "Время отклика",
                    Values         = new ChartValues <TimeSpanPoint>(),
                    LineSmoothness = 0
                },
                new LineSeries()
                {
                    Title          = "Время в очереди",
                    Values         = new ChartValues <TimeSpanPoint>(),
                    LineSmoothness = 0
                }
            };
        }
Example #3
0
        //private Nobreak _nobreak;

        public Graficos()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the values property will store our values array
            TensaoSaida   = new ChartValues <MeasureModel>();
            TensaoEntrada = new ChartValues <MeasureModel>();
            Frequencia    = new ChartValues <MeasureModel>();

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("HH:mm:ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(2).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            IsReading = true;
            Task.Factory.StartNew(Read);

            DataContext = this;
        }
Example #4
0
        //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
        #region --Constructors--
        /// <summary>
        /// Basic Constructor
        /// </summary>
        /// <history>
        /// 27/08/2018 Created [Fabian Sauter]
        /// </history>
        public SpeedGraph()
        {
            this.InitializeComponent();

            var mapper = Mappers.Xy <SpeedMeasurement>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <SpeedMeasurement>(mapper);


            //the values property will store our values array
            CHART_VALUES      = new ChartValues <SpeedMeasurement>();
            SPEED_VALUE_CACHE = new List <double>();

            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            SetAxisLimits(DateTime.Now);

            TIMER = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(1000)
            };
            TIMER.Tick += TimerOnTick;
            RANDOM      = new Random();
        }
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks)
                         .Y(model => model.Value);

            Charting.For <MeasureModel>(mapper);

            BasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "perfmon-for-wcf");
            if (!Directory.Exists(BasePath))
            {
                Directory.CreateDirectory(BasePath);
            }

            CounterIds = new Dictionary <string, long>();
            InitDatabase();

            MachineItems     = new ObservableCollection <MachineItem>();
            CounterListeners = new Dictionary <string, List <Series> >();
            Tabs             = new ObservableCollection <Tab>();
            Connections      = new List <Connection>();

            OpenDefaultTab();
        }
Example #6
0
        public MainPage()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => { return(model != null ? model.DateTime.Ticks : DateTime.Now.Ticks); }) //X軸の設定 nullなら現在時刻
                         .Y(model => { return(model != null ? model.Value : 0); });                          //Y軸の設定 nullなら0


            Charting.For <MeasureModel>(mapper);


            ChartValues = new ChartValues <MeasureModel>();

            //軸ラベルの設定
            DateTimeFormatter = value => new DateTime((long)(value)).ToString("mm:ss");
            BPMFormatter      = value => ((long)value).ToString("D");

            //X軸の目盛りの設定
            AxisStep = TimeSpan.FromSeconds(30).Ticks;
            SetAxisLimits(DateTime.Now);

            //Y軸の目盛りの設定
            BPMAxisStep = 10;
            BPMAxisMax  = 150;
            BPMAxisMin  = 50;


            DataContext = this;

            //BLE通信
            OH1             = new HeartRateConnection();
            OH1.ConnectBLE += ShowGraph;
            OH1.Start();
        }
Example #7
0
        private void initChartData()
        {
            var lineSeries = new LineSeries
            {
                Values            = new ChartValues <RLVChartData>(),
                StrokeThickness   = 1,
                Fill              = Brushes.Transparent,
                PointGeometrySize = 10,
                Title             = "",
                DataLabels        = false,
                PointForeground   = new SolidColorBrush(Colors.White),
                LineSmoothness    = 0,
                Stroke            = new SolidColorBrush(Colors.Orange)
            };

            ((IRLVProgressionChartVM)ViewModel).SeriesCollection = new SeriesCollection()
            {
                lineSeries
            };

            var chartMapper = Mappers.Xy <RLVChartData>()
                              .X(a => a.Time)
                              .Y(a => a.Score)
                              .Fill(a => a.Selected ? Brushes.Red : Brushes.Orange);

            Charting.For <RLVChartData>(chartMapper);

            createAxis();
            progressionChart.LegendLocation = LegendLocation.None;
        }
Example #8
0
        private void construirRespostaGalvanica()
        {
            var mapper = Mappers.Xy <RespostaGalvanica>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <RespostaGalvanica>(mapper);

            //the dadesRG property will store our values array
            _dadesRG = new ChartValues <RespostaGalvanica>();
            respostaGalvanica.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values            = _dadesRG,
                    PointGeometrySize = 18,
                    StrokeThickness   = 4
                }
            };
            respostaGalvanica.AxisX.Add(new Axis
            {
                DisableAnimations = true,
                LabelFormatter    = value => new System.DateTime((long)Math.Abs(value)).ToString("mm:ss"),
                Separator         = new Separator
                {
                    Step = TimeSpan.FromSeconds(1).Ticks
                }
            });

            // S'enllaça l'event de Connexio_Singleton amb LivaCharts_UserControl. S'ha de recollir l'event riseDada
            Connexio_Singleton.getInstance().nouEventRespostaGalvanica += mostraLecturesArduinoRG;
        }
Example #9
0
        public FeedbackChart()
        {
            //initialize series storage
            MotorLeftValues  = new ChartValues <MeasurementModel>();
            MotorRightValues = new ChartValues <MeasurementModel>();

            //register and setup current chart model
            var mapper = Mappers.Xy <MeasurementModel>()
                         .X(model => model.DateTime.Ticks)
                         .Y(model => model.Value);

            Charting.For <MeasurementModel>(mapper);

            //initialize formatter
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");
            YAxisFormatter    = value => $"{value:#.##}";

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            historyLeft  = new List <MeasurementModel>();
            historyRight = new List <MeasurementModel>();
        }
Example #10
0
        //  static readonly CancellationTokenSource s_cts = new CancellationTokenSource();
        public Graph3()
        {
            InitializeComponent();
            TitleX     = "Длина волны(нм)";
            TitleY     = "Мощность (мВТ)";
            SerieTitle = "Длина волны";
            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.ValueX)  //use DateTime.Ticks as X
                         .Y(model => model.ValueY); //use the value property as Y

            Charting.For <MeasureModel>(mapper);
            ChartValues = new ChartValues <MeasureModel>();
            //  ChartValues = SQLAdapter.FetchAsync().Result;
            AxisMinX = 1528; //ChartValues.Select(x => x.ValueX).Min();
            AxisMaxX = 1529; // ChartValues.Select(x => x.ValueX).Max();
            AxisMinY = 1.7;
            AxisMaxY = 1.8;
            //AxisMinX = 1525;
            //AxisMaxX = 1630;
            //AxisMinY = 5;
            //AxisMaxY = 7;

            MinY        = 0;
            IsReading   = false;
            DataContext = this;
        }
Example #11
0
        /// <summary>
        /// Postavlja graf.
        /// </summary>
        public GraphControl()
        {
            // Stvori novog Mappera
            var mapper = Mappers.Xy <GraphingModel>()
                         .X(model => model.DateTime.Ticks) // Koristi DateTime.Ticks kao X
                         .Y(model => model.Value);         // Koristi vrijednost kao Y

            // Specificiraj podatke
            Charting.For <GraphingModel>(mapper);
            this.ChartValues = new ChartValues <GraphingModel>();

            // Specificiraj oblik vremena
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            // AxisStep se koristi za razmak između svakog unosa (?)
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            AxisUnit = TimeSpan.TicksPerSecond; // Mapiramo sekunde

            // Postavi granice
            SetAxisLimits(DateTime.Now);

            // Pokreni Task odnosno pozadinsku nit koja je zadužena za dohvaćanje novih podataka
            Task.Factory.StartNew(Read);

            DataContext = this;
        }
Example #12
0
        public MainWindow()
        {
            InitializeComponent();

            CartesianMapper <MeasureModel> mapper = Mappers.Xy <MeasureModel>().X(model => model.Time).Y(model => model.Value);

            Charting.For <MeasureModel>(mapper);

            ChartValuesRed   = new ChartValues <MeasureModel>();
            ChartValuesIR    = new ChartValues <MeasureModel>();
            ChartValuesHeart = new ChartValues <MeasureModel>();

            Bpm  = new ChartValues <MeasureModel>();
            Spo2 = new ChartValues <MeasureModel>();

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //lets set how to display the X Labels
            //DateTimeFormatter = value => new DateTime((long)value).ToString("ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = 1; // TimeSpan.FromMilliseconds(50).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = 1;

            SetAxisLimits(0);

            //The next code simulates data changes every 300 ms

            DataContext = this;

            this.Loaded += MainWindow_Loaded;
        }
Example #13
0
        public UserControlStat()
        {
            InitializeComponent();

            /* Converts a Date-DetectedDevices pair into chart X, Y values */
            Charting.For <Tuple <DateTime, int> >(Mappers.Xy <Tuple <DateTime, int> >()
                                                  .X(model => model.Item1.Ticks)
                                                  .Y(model => model.Item2));

            /* Converts a MAC-PacketsCount pair into chart X, Y values */
            Charting.For <Tuple <string, int> >(Mappers.Xy <Tuple <string, int> >()
                                                .X(model => talkativeDevices.IndexOf(model.Item1))
                                                .Y(model => model.Item2));

            SeriesCollection = new SeriesCollection();

            chartRefreshTimer.Tick += ChartRefreshTimer_Tick;

            /* Stop the timer when the Control is unloaded */
            this.Unloaded += (object sender, RoutedEventArgs e) => {
                if (chartRefreshTimer.IsEnabled)
                {
                    chartRefreshTimer.Stop();
                }
            };

            DataContext = this;
        }
Example #14
0
        public LiveLineGraph()
        {
            InitLineSeries();
            InitializeComponent();
            this.DataContext = this;

            ProcessPid = 0;

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            // Save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            // Set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            // AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(10).Ticks;

            // AxisUnit forces lets the axis know that we are plotting seconds
            AxisUnit = TimeSpan.TicksPerSecond;

            ChartColor = "Red";

            SetAxisLimits(DateTime.Now);
        }
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this; IsReading = true;

            VoltageValues = new ObservableValue(0);
            CurrentValues = new ObservableValue(1);
            WattValues    = new ObservableValue(2);
            EnergyValues  = new ObservableValue(3);

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks / TimeSpan.FromTicks(1).Ticks) //use DateTime.Ticks as X (Cannot be FromSeconds() else the graph won't show anything!)
                         .Y(model => model.Value);                                       //use the value property as Y

            //lets set how to display the X Labels (mm:ss)
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the values property will store our values array
            VoltageChartValues = new ChartValues <MeasureModel>(); // For the voltage cartesian graph values
            CurrentChartValues = new ChartValues <MeasureModel>(); // For the current cartesian graph values
            WattChartValues    = new ChartValues <MeasureModel>();
            EnergyChartValues  = new ChartValues <MeasureModel>();

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);
        }
        public KDMetricsTestResultWindow(double[] euclidPerformance, double[] manhattanPerformance, double[] chebyshevPerformance, double[] mahalanobisPerformance)
        {
            InitializeComponent();
            DataContext = this;
            var mapper = new CartesianMapper <double>()
                         .X((value, index) => index + 1)
                         .Y((value, index) => value);

            Charting.For <double>(mapper);
            Collection.Add(new LineSeries
            {
                Title          = "Euklides",
                Values         = new ChartValues <double>(euclidPerformance),
                LineSmoothness = 0.01, //0: straight lines, 1: really smooth lines
            });
            Collection.Add(new LineSeries
            {
                Title          = "Manhattan",
                Values         = new ChartValues <double>(manhattanPerformance),
                LineSmoothness = 0.01, //0: straight lines, 1: really smooth lines
            });
            Collection.Add(new LineSeries
            {
                Title          = "Czebyszew",
                Values         = new ChartValues <double>(chebyshevPerformance),
                LineSmoothness = 0.01, //0: straight lines, 1: really smooth lines
            });
            Collection.Add(new LineSeries
            {
                Title          = "Mahalanobis",
                Values         = new ChartValues <double>(mahalanobisPerformance),
                LineSmoothness = 0.01, //0: straight lines, 1: really smooth lines
            });
        }
        private void SetGraphicsAchievementsSources()
        {
            var data = PluginDatabase.GetCountBySources();

            this.Dispatcher.BeginInvoke((Action) delegate
            {
                //let create a mapper so LiveCharts know how to plot our CustomerViewModel class
                var customerVmMapper = Mappers.Xy <CustomerForSingle>()
                                       .X((value, index) => index)
                                       .Y(value => value.Values);

                //lets save the mapper globally
                Charting.For <CustomerForSingle>(customerVmMapper);

                SeriesCollection StatsGraphicAchievementsSeries = new SeriesCollection();
                StatsGraphicAchievementsSeries.Add(new ColumnSeries
                {
                    Title  = string.Empty,
                    Values = data.SeriesUnlocked
                });

                StatsGraphicAchievementsSources.Series  = StatsGraphicAchievementsSeries;
                StatsGraphicAchievementsSourcesX.Labels = data.Labels;
            });
        }
Example #18
0
        public void Init()
        {
            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the values property will store our values array
            GetBandChartValues        = new ChartValues <MeasureModel>();
            ProcessControlChartValues = new ChartValues <MeasureModel>();
            PostTraceChartValues      = new ChartValues <MeasureModel>();
            PostJGPChartValues        = new ChartValues <MeasureModel>();
            PostIFactoryChartValues   = new ChartValues <MeasureModel>();

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            Refresh(DateTime.Now.AddSeconds(-15), DateTime.Now);
        }
Example #19
0
        public SessionStatistics()
        {
            //To handle live data easily, in this case we built a specialized type
            //the MeasureModel class, it only contains 2 properties
            //DateTime and Value
            //We need to configure LiveCharts to handle MeasureModel class
            //The next code configures MEasureModel  globally, this means
            //that livecharts learns to plot MeasureModel and will use this config every time
            //a ChartValues instance uses this type.
            //this code ideally should only run once, when application starts is reccomended.
            //you can configure series in many ways, learn more at http://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the values property will store our values array
            DownloadChartValues = new ChartValues <MeasureModel>();
            UploadChartValues   = new ChartValues <MeasureModel>();

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("hh:mm:ss");

            // the y label
            SizeFormatter = value => Utils.StrFormatByteSize((long)value).Replace("0 bytes", "0");

            XAxisStep = TimeSpan.FromSeconds(1).Ticks;

            YAxisMax = 0.1;
            SetAxisLimits(DateTime.Now);
        }
Example #20
0
        //  static readonly CancellationTokenSource s_cts = new CancellationTokenSource();
        public Graph()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.ValueX)  //use DateTime.Ticks as X
                         .Y(model => model.ValueY); //use the value property as Y

            Charting.For <MeasureModel>(mapper);
            //  ChartValues = new ChartValues<MeasureModel>();
            ChartValues = SQLAdapter.FetchAsync().Result;

            LineSeries lineSeries = new LineSeries
            {
                Title             = "Длина волны",
                Values            = ChartValues,
                StrokeThickness   = 1,
                Stroke            = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)),
                Fill              = System.Windows.Media.Brushes.Transparent,
                LineSmoothness    = 0,
                PointGeometrySize = 0,
                PointForeground   = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)),
                Opacity           = 0,
                OpacityMask       = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0))
            };

            SeriesCollection = new SeriesCollection();
            SeriesCollection.Add(lineSeries);
            MaxX        = ChartValues.Select(x => x.ValueX).Max();
            MinX        = ChartValues.Select(x => x.ValueX).Min();
            MinY        = 0;
            DataContext = this;
        }
Example #21
0
        private void InitTableReAt()
        {
            var mapper = Mappers.Xy <AtModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            Charting.For <AtModel>(mapper);
            ChartValuesat       = new ChartValues <AtModel>();
            chartRealAtt.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values            = ChartValuesat,
                    PointGeometrySize = 18,
                    StrokeThickness   = 4
                }
            };
            chartRealAtt.AxisX.Add(new Axis
            {
                DisableAnimations = true,
                LabelFormatter    = value => new System.DateTime((long)value).ToString("mm:ss"),
                Separator         = new Separator
                {
                    Step = TimeSpan.FromSeconds(1).Ticks
                }
            });
            SetAxisLimitsat(System.DateTime.Now);
        }
Example #22
0
        public LatencyViewModel()
        {
            var mapper = Mappers.Xy <LatencyModel>()
                         .X(model => model.DateTime.Ticks)
                         .Y(model => model.Value);

            Charting.For <LatencyModel>(mapper);
            ChartValues       = new ChartValues <LatencyModel>();
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");
            CpuFormatter      = value => String.Format("{0}%", value.ToString());

            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            IsReading = false;
            // 新建一个进程获取网络监控信息
            IsReading = !IsReading;
            // start a task with a means to do a hard abort (unsafe!)
            Cts = new CancellationTokenSource();
            Ct  = Cts.Token;
            if (IsReading)
            {
                Task.Factory.StartNew(Read, Ct);
            }

            //获取事件聚合器, 连接成功时开始监控
            eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
            ConnectedEvent e = eventAggregator.GetEvent <ConnectedEvent>();

            e.Subscribe(GetConfig, ThreadOption.UIThread);
        }
        private void ShowElevationOnChart(Collection <Feature> features)
        {
            ChartAxisLabels.Clear();
            ChartData.Clear();

            double     distance  = 0.0;
            int        index     = 0;
            PointShape lastPoint = new PointShape();

            foreach (var feature in features)
            {
                PointShape point = new PointShape(feature.ColumnValues["point"]);
                if (index++ != 0)
                {
                    LineShape line = new LineShape(new Collection <Vertex> {
                        new Vertex(lastPoint), new Vertex(point)
                    });
                    distance += line.GetAccurateLength(4326, DistanceUnit.Meter, DistanceCalculationMode.Haversine);
                }

                double tmpDistance = Math.Round(distance / 1000.0, 2);
                double value       = Math.Round(double.Parse(feature.ColumnValues["elevation"]), 2);
                ChartAxisLabels.Add(tmpDistance);
                ChartData.Add(new ChartInformation(value, point.X, point.Y, tmpDistance));

                lastPoint = point;
            }

            var mapper = Mappers.Xy <ChartInformation>().X(value => value.Distance).Y(value => value.Elevation);

            Charting.For <ChartInformation>(mapper);
            DataContext = this;
        }
Example #24
0
        public UC_AnalysisChart( )
        {
            InitializeComponent();

            ColorList = typeof(Brushes).GetProperties()
                        .Select(x => x.GetValue(null) as Brush)
                        .ToArray();


            var mapper = Mappers.Xy <double[]>()
                         .X(model => model[0])   //use DateTime.Ticks as X
                         .Y(model => model[1]);  //use the value property as Y

            Charting.For <double []>(mapper);
            DataContext = this;

            axisX.Title = "WaveLength";

            axisX.MaxValue = 1200;
            axisX.MinValue = 200;



            ClearSeries();
        }
        public RTChart()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the values property will store our values array
            ChartValues = new ChartValues <MeasureModel>();

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("HH:mm:ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);


            AxisXName = "Time";
            AxisYName = "";
            Title     = "";



            DataContext = this;
        }
Example #26
0
        public DynamicLineChartViewModel(string chartName, string hardwareName)
        {
            this.ChartName             = chartName;
            this.HardwareName          = hardwareName;
            this.SectionName           = this.ChartName + " - " + this.HardwareName;
            this.ChartValuesDictionary = new Dictionary <string, ChartValues <MeasureModel> >();
            //the values property will store our values array
            this.SeriesCollection = new SeriesCollection();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //lets set how to display the X Labels
            this.DateTimeFormatter = value =>
            {
                return(new DateTime((long)value).ToString("mm:ss"));
            };

            //AxisStep forces the distance between each separator in the X axis
            this.AxisStep = TimeSpan.FromSeconds(5).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            this.AxisUnit = TimeSpan.TicksPerSecond;

            this.SetAxisLimits(DateTime.Now);
        }
        public CoilChangeChart()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <CoilChangeModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <CoilChangeModel>(mapper);

            //the values property will store our values array
            ChartValues = new GearedValues <CoilChangeModel>();
            ChartValues.WithQuality(Quality.Highest);

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            //The next code simulates data changes every 300 ms

            IsReading = false;

            DataContext = this;
        }
Example #28
0
        public LiveChar3()
        {
            InitializeComponent();
            Customers = new ChartValues <CustomerVm>()
            {
                new CustomerVm()
                {
                    X = 1,
                    Y = 2
                },
                new CustomerVm()
                {
                    X = 2,
                    Y = 3
                },
                new CustomerVm()
                {
                    X = 5,
                    Y = 4
                },
                new CustomerVm()
                {
                    X = 10,
                    Y = 20
                },
            };
            //重定义数据映射
            var customerVmMapper = Mappers.Xy <CustomerVm>()
                                   .X(value => value.X)
                                   .Y(value => value.Y);

            //保存加载数据映射
            Charting.For <CustomerVm>(customerVmMapper);
            DataContext = this;
        }
Example #29
0
        public Chart(PatientInfo patientInfo)
        {
            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks)
                         .Y(model => model.Value);

            Charting.For <MeasureModel>(mapper);

            ChartValues = new ChartValues <MeasureModel>();

            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            AxisStep = TimeSpan.FromSeconds(1).Ticks;

            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            IsReading = true;

            ChartValues.Add(new MeasureModel
            {
                DateTime = DateTime.Now,
                Value    = 8
            });
        }
        private void SetupPlot()
        {
            // Create line plot data.
            var mapper = Mappers.Xy <TemperatureModel>()
                         .X(model => model.DateTime.Ticks)
                         .Y(model => model.Temperature.GetTemperature(_tempUnit));

            Charting.For <TemperatureModel>(mapper);

            ChartValues = new ChartValues <TemperatureModel>();

            TimeRange = 30;

            //Formats the x axis
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");
            DegreeFormatter   = value => $"{value:0.0}";

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(4).Ticks;

            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetPlotTitle();

            SetAxisLimits(DateTime.Now);
        }