示例#1
0
        protected override IEnumerable <Point> GetPoints(DataPointSegment segment)
        {
            AxisPlotDirection plotDirection = this.model.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            ReferenceDictionary <string, Delegate> valueExtractor = plotDirection == AxisPlotDirection.Vertical ? VerticalPlotValueExtractors : HorizontalPlotValueExtractors;

            foreach (Point point in StepSeriesHelper.GetPoints(segment, this.model as StepSeriesModel, this.renderPoints, valueExtractor))
            {
                yield return(point);
            }
        }
示例#2
0
        internal static IEnumerable <Point> GetPoints(DataPointSegment segment, StepSeriesModel seriesModel, IList <DataPoint> renderPoints, ReferenceDictionary <string, Delegate> valueExtractor)
        {
            AxisPlotDirection plotDirection = seriesModel.GetTypedValue <AxisPlotDirection>(AxisModel.PlotDirectionPropertyKey, AxisPlotDirection.Vertical);
            AxisModel         axisModel     = plotDirection == AxisPlotDirection.Vertical ? seriesModel.firstAxis : seriesModel.secondAxis;

            var risersActualPosition            = StepSeriesHelper.GetActualRisersPosition(seriesModel.RisersPosition, axisModel.ActualPlotMode);
            var isRisersPositionEqualToPlotMode = StepSeriesHelper.IsRisersPositionEqualToPlotMode(axisModel.ActualPlotMode, risersActualPosition);

            var    view           = seriesModel.GetChartArea().view;
            Size   chartScale     = new Size(view.ZoomWidth, view.ZoomHeight);
            double slotLength     = StepSeriesHelper.GetSlotLength(seriesModel, plotDirection, chartScale);
            double halfSlotLength = slotLength / 2;

            Func <Point, Point, Point>         riserPointGetter       = (Func <Point, Point, Point>)valueExtractor[RiserPointGetter];
            Func <Point, Point, double, Point> firstRiserPointGetter  = (Func <Point, Point, double, Point>)valueExtractor[FirstRiserPointGetter];
            Func <Point, Point, double, Point> secondRiserPointGetter = (Func <Point, Point, double, Point>)valueExtractor[SecondRiserPointGetter];

            int pointIndex = segment.StartIndex;

            while (pointIndex <= segment.EndIndex)
            {
                var currentPoint = renderPoints[pointIndex].Center();
                yield return(currentPoint);

                if (pointIndex == segment.EndIndex)
                {
                    yield break;
                }

                var nextPoint = renderPoints[pointIndex + 1].Center();
                if (isRisersPositionEqualToPlotMode || axisModel is DateTimeContinuousAxisModel)
                {
                    yield return(riserPointGetter(currentPoint, nextPoint));
                }
                else
                {
                    yield return(firstRiserPointGetter(currentPoint, nextPoint, halfSlotLength));

                    yield return(secondRiserPointGetter(currentPoint, nextPoint, halfSlotLength));
                }

                pointIndex++;
            }
        }