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;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartCategoryAxis{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartAxisDefaults(Chart <T> chart)
     : base(chart)
 {
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Labels         = new ChartAxisLabels();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartNumericAxis{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartNumericAxis(Chart <T> chart)
     : base(chart)
 {
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Labels         = new ChartAxisLabels();
     Format         = "";
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartAxisBase{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartAxisBase(Chart <T> chart)
 {
     Chart          = chart;
     MinorTickSize  = ChartDefaults.Axis.MinorTickSize;
     MajorTickSize  = ChartDefaults.Axis.MajorTickSize;
     MajorTickType  = ChartDefaults.Axis.MajorTickType;
     MinorTickType  = ChartDefaults.Axis.MinorTickType;
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Line           = new ChartLine();
     Labels         = new ChartAxisLabels();
 }
 public ChartAxisLabelsSerializerTests()
 {
     labels = new ChartAxisLabels();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartDateAxisLabelsBuilder" /> class.
 /// </summary>
 /// <param name="chartLabels">The labels configuration.</param>
 public ChartDateAxisLabelsBuilder(ChartAxisLabels chartLabels)
     : base(chartLabels)
 {
     labels = chartLabels;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartAxisLabelsBuilder" /> class.
 /// </summary>
 /// <param name="chartLabels">The labels configuration.</param>
 public ChartAxisLabelsBuilder(ChartAxisLabels chartLabels)
     : base(chartLabels)
 {
     this.ChartLabels = chartLabels;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartDateAxisLabelsBuilder" /> class.
 /// </summary>
 /// <param name="chartLabels">The labels configuration.</param>
 public ChartDateAxisLabelsBuilder(ChartAxisLabels chartLabels)
     : base(chartLabels)
 {
     labels = chartLabels;
 }
 public ChartAxisLabelsBuilderTests()
 {
     labels  = new ChartAxisLabels();
     builder = new ChartAxisLabelsBuilder(labels);
 }