Пример #1
0
        public void Fill(bool showByTime, IList <GPSPointViewModel> points)
        {
            Series.Clear();
            ResetBarAndColumnCaches();

            if (points == null || points.Count == 0)
            {
                return;
            }

            var yAxis = new LinearAxis();

            yAxis.ShowMinorTicks     = false;
            yAxis.ShowMajorGridlines = false;
            yAxis.LabelFormatString  = "0'";
            YAxis       = yAxis;
            YAxis.Title = UIHelper.SpeedType;

            var ySecondaryAxis = new LinearAxis();

            ySecondaryAxis.ShowMinorTicks     = false;
            ySecondaryAxis.ShowMajorGridlines = false;
            ySecondaryAxis.LabelFormatString  = "0'";
            SecondaryYAxis       = ySecondaryAxis;
            SecondaryYAxis.Title = UIHelper.AltitudeType;

            SplineSeries speedSeries = new SplineSeries();

            speedSeries.IsVisibleChanged += (s, e) =>
            {
                (YAxis as LinearAxis).Visibility = speedSeries.Visibility;
            };
            speedSeries.LineStrokeThickness = 1.5;
            Series.Add(speedSeries);


            LineSeries altitudeSeries = new LineSeries();

            altitudeSeries.IsVisibleChanged += (s, e) =>
            {
                (SecondaryYAxis as LinearAxis).Visibility = altitudeSeries.Visibility;
            };
            altitudeSeries.LineStrokeThickness = 1.5;

            Series.Add(altitudeSeries);

            //altitudeSeries.AreaFill=new SolidColorBrush(Colors.DarkGray){Opacity = 0.5};
            altitudeSeries.ShowArea = true;
            altitudeSeries.YAxis    = SecondaryYAxis;

            if (showByTime)
            {
                fillChart(points, speedSeries, altitudeSeries);
            }
            else
            {
                fillChartByDistance(points, speedSeries, altitudeSeries);
            }

            foreach (LineSeries series in Series)
            {
                series.LegendItemTemplate = (ControlTemplate)Application.Current.Resources["CustomLegendItemTemplate"];
            }
            XAxis.AdoptZoomAsRange();
        }