Beispiel #1
0
        /// <summary>
        /// Updates the Series shape object.
        /// </summary>
        protected virtual void UpdateShape()
        {
            double maximum = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value;

            Func <DataPoint, Point> createPoint =
                dataPoint =>
                new Point(
                    ActualIndependentAxis.GetPlotAreaCoordinate(dataPoint.ActualIndependentValue).Value,
                    maximum - ActualDependentRangeAxis.GetPlotAreaCoordinate(dataPoint.ActualDependentValue).Value);

            IEnumerable <Point> points = Enumerable.Empty <Point>();

            if (ValueHelper.CanGraph(maximum))
            {
                if (ActualIndependentAxis is IRangeAxis)
                {
                    points = DataPointsByIndependentValue.Select(createPoint);
                }
                else
                {
                    points =
                        ActiveDataPoints
                        .Select(createPoint)
                        .OrderBy(point => point.X);
                }
            }
            UpdateShapeFromPoints(points);
        }
Beispiel #2
0
        /// <summary>
        /// Repositions line data point in the sorted collection if the actual
        /// independent axis is a range axis.
        /// </summary>
        /// <param name="dataPoint">The data point that has changed.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        protected override void OnDataPointIndependentValueChanged(DataPoint dataPoint, object oldValue, object newValue)
        {
            if (ActualIndependentAxis is IRangeAxis && !oldValue.Equals(newValue))
            {
                bool removed = DataPointsByIndependentValue.Remove((IComparable)oldValue, dataPoint);
                if (removed)
                {
                    DataPointsByIndependentValue.Add((IComparable)newValue, dataPoint);
                }
            }

            base.OnDataPointIndependentValueChanged(dataPoint, oldValue, newValue);
        }
Beispiel #3
0
        /// <summary>
        /// Called after data points have been loaded from the items source.
        /// </summary>
        /// <param name="newDataPoints">New active data points.</param>
        /// <param name="oldDataPoints">Old inactive data points.</param>
        protected override void OnDataPointsChanged(IList <DataPoint> newDataPoints, IList <DataPoint> oldDataPoints)
        {
            base.OnDataPointsChanged(newDataPoints, oldDataPoints);

            if (ActualIndependentAxis is IRangeAxis)
            {
                foreach (DataPoint dataPoint in oldDataPoints)
                {
                    DataPointsByIndependentValue.Remove((IComparable)dataPoint.IndependentValue, dataPoint);
                }

                foreach (DataPoint dataPoint in newDataPoints)
                {
                    DataPointsByIndependentValue.Add((IComparable)dataPoint.IndependentValue, dataPoint);
                }
            }
        }
        /// <summary>
        /// Updates the point collection object.
        /// </summary>
        protected override void UpdateShape()
        {
            double maximum = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value.Value;

            Func <DataPoint, Point> createPoint =
                dataPoint =>
                new Point(
                    ActualIndependentAxis.GetPlotAreaCoordinate(dataPoint.ActualIndependentValue).Value.Value,
                    maximum - ActualDependentRangeAxis.GetPlotAreaCoordinate(dataPoint.ActualDependentValue).Value.Value);

            IEnumerable <Point> points = null;

            if (ValueHelper.CanGraph(maximum))
            {
                if (ActualIndependentAxis is IRangeAxis)
                {
                    points = DataPointsByIndependentValue.Select(createPoint);
                }
                else
                {
                    points =
                        ActiveDataPoints
                        .Select(createPoint)
                        .OrderBy(point => point.X);
                }

                if (!points.IsEmpty())
                {
                    this.Points = new PointCollection();
                    foreach (Point point in points)
                    {
                        this.Points.Add(point);
                    }
                    return;
                }
            }
            this.Points = null;
        }