Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <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;
        }