protected override void DrawPath(SeriesBase series, System.Drawing.Pen pen)
        {
            if (series is AreaSeries)
            {
                AreaSeries areaSeries = series as AreaSeries;
                var        brush      = (this.Series as AreaSeries).Fill.AsDrawingBrush();
                var        points     = areaSeries.AreaPoints;
                var        pointCount = areaSeries.AreaPoints.Count;
                if (RenderingMode == RenderingMode.Default)
                {
                    PartsCanvas.Children.Clear();
                    for (int i = 0; i < areaSeries.Parts.Count; i++)
                    {
                        var element = areaSeries.Parts[i].CreatePart();
                        if (element != null && !PartsCanvas.Children.Contains(element))
                        {
                            PartsCanvas.Children.Add(element);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < pointCount - 1; i++)
                    {
                        switch (RenderingMode)
                        {
                        case RenderingMode.GDIRendering:
                            GDIGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());
                            break;

                        case RenderingMode.Default:
                            break;

                        case RenderingMode.WritableBitmap:
                            this.WritableBitmap.Lock();
                            WritableBitmapGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());
                            this.WritableBitmap.AddDirtyRect(new Int32Rect(0, 0, WritableBitmap.PixelWidth, WritableBitmap.PixelHeight));
                            this.WritableBitmap.Unlock();
                            break;

                        default:
                            break;
                        }
                    }
                    DrawFilledPath(areaSeries, pen, brush);
                }
                this.Collection.InvalidateBitmap();
            }
        }
        override protected void DrawPath(SeriesBase series, System.Drawing.Pen pen)
        {
            if (series is StepLineSeries)
            {
                StepLineSeries stepLineSeries = series as StepLineSeries;
                var            points         = stepLineSeries.LinePoints;
                var            pointCount     = stepLineSeries.LinePoints.Count;
                if (RenderingMode == RenderingMode.Default)
                {
                    PartsCanvas.Children.Clear();
                    for (int i = 0; i < stepLineSeries.Parts.Count; i++)
                    {
                        var element = stepLineSeries.Parts[i].CreatePart();
                        if (element != null && !PartsCanvas.Children.Contains(element))
                        {
                            PartsCanvas.Children.Add(element);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < pointCount - 1; i++)
                    {
                        switch (RenderingMode)
                        {
                        case RenderingMode.GDIRendering:
                            GDIGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());
                            break;

                        case RenderingMode.Default:
                            break;

                        case RenderingMode.WritableBitmap:
                            WritableBitmapGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());
                            break;

                        default:
                            break;
                        }
                    }
                    this.Collection.InvalidateBitmap();
                }
            }
        }
示例#3
0
        protected override void DrawPath(SeriesBase series, System.Drawing.Pen pen)
        {
            if (series is BarErrorSeries)
            {
                var             points          = new PointCollection();
                var             lowPoints       = new PointCollection();
                var             openPoints      = new PointCollection();
                var             closePoints     = new PointCollection();
                var             openOffPoints   = new PointCollection();
                var             closeOffPoints  = new PointCollection();
                var             pointCount      = 0;
                PartsCollection partsCollection = new PartsCollection();
                if (series is BarErrorSeries)
                {
                    BarErrorSeries lineSeries = series as BarErrorSeries;
                    points         = lineSeries.HighPoints;
                    lowPoints      = lineSeries.LowPoints;
                    openPoints     = lineSeries.OpenPoints;
                    closePoints    = lineSeries.ClosePoints;
                    openOffPoints  = lineSeries.OpenOffPoints;
                    closeOffPoints = lineSeries.CloseOffPoints;

                    pointCount      = lineSeries.HighPoints.Count;
                    partsCollection = lineSeries.Parts;
                }
                if (RenderingMode == RenderingMode.Default)
                {
                    for (int i = 0; i < partsCollection.Count; i++)
                    {
                        var element = partsCollection[i].CreatePart();
                        if (element != null && !PartsCanvas.Children.Contains(element))
                        {
                            PartsCanvas.Children.Add(element);
                        }
                    }
                }
                else
                {
                    if (series is BarErrorSeries)
                    {
                        for (int i = 0; i < pointCount; i++)
                        {
                            switch (RenderingMode)
                            {
                            case RenderingMode.GDIRendering:
                                GDIGraphics.DrawLine(pen, points[i].AsDrawingPointF(), lowPoints[i].AsDrawingPointF());
                                GDIGraphics.DrawLine(pen, openOffPoints[i].AsDrawingPointF(), openPoints[i].AsDrawingPointF());
                                GDIGraphics.DrawLine(pen, closeOffPoints[i].AsDrawingPointF(), closePoints[i].AsDrawingPointF());
                                break;

                            case RenderingMode.Default:
                                break;

                            case RenderingMode.WritableBitmap:
                                this.WritableBitmap.Lock();
                                WritableBitmapGraphics.DrawLine(pen, points[i].AsDrawingPointF(), lowPoints[i].AsDrawingPointF());
                                WritableBitmapGraphics.DrawLine(pen, openOffPoints[i].AsDrawingPointF(), openPoints[i].AsDrawingPointF());
                                WritableBitmapGraphics.DrawLine(pen, closeOffPoints[i].AsDrawingPointF(), closePoints[i].AsDrawingPointF());
                                this.WritableBitmap.Unlock();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    this.Collection.InvalidateBitmap();
                }
            }
        }
示例#4
0
        override protected void DrawPath(SeriesBase series, System.Drawing.Pen pen)
        {
            if (series is LineSeries || series is HiLoSeries || series is HiLoOpenCloseSeries)
            {
                var             points          = new PointCollection();
                var             lowPoints       = new PointCollection();
                var             pointCount      = 0;
                PartsCollection partsCollection = new PartsCollection();
                if (series is LineSeries)
                {
                    LineSeries lineSeries = series as LineSeries;
                    points          = lineSeries.LinePoints;
                    pointCount      = lineSeries.LinePoints.Count;
                    partsCollection = lineSeries.Parts;
                }
                else if (series is HiLoSeries)
                {
                    HiLoSeries lineSeries = series as HiLoSeries;
                    points          = lineSeries.HighPoints;
                    lowPoints       = lineSeries.LowPoints;
                    pointCount      = lineSeries.HighPoints.Count;
                    partsCollection = lineSeries.Parts;
                }
                else if (series is HiLoOpenCloseSeries)
                {
                    HiLoOpenCloseSeries lineSeries = series as HiLoOpenCloseSeries;
                    points          = lineSeries.HighPoints;
                    lowPoints       = lineSeries.LowPoints;
                    pointCount      = lineSeries.HighPoints.Count;
                    partsCollection = lineSeries.Parts;
                }
                if (RenderingMode == RenderingMode.Default)
                {
                    for (int i = 0; i < partsCollection.Count; i++)
                    {
                        UIElement renderElement = partsCollection[i].CreatePart();
                        if (renderElement != null && !PartsCanvas.Children.Contains(renderElement))
                        {
                            PartsCanvas.Children.Add(renderElement);
                        }
                    }
                }
                else
                {
                    if (series is LineSeries)
                    {
                        for (int i = 0; i < pointCount - 1; i++)
                        {
                            switch (RenderingMode)
                            {
                            case RenderingMode.GDIRendering:
                                GDIGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());

                                break;

                            case RenderingMode.Default:
                                break;

                            case RenderingMode.WritableBitmap:
                                this.WritableBitmap.Lock();
                                WritableBitmapGraphics.DrawLine(pen, points[i].AsDrawingPointF(), points[i + 1].AsDrawingPointF());
                                this.WritableBitmap.Unlock();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < pointCount; i++)
                        {
                            switch (RenderingMode)
                            {
                            case RenderingMode.GDIRendering:
                                GDIGraphics.DrawLine(pen, points[i].AsDrawingPointF(), lowPoints[i].AsDrawingPointF());

                                break;

                            case RenderingMode.Default:
                                break;

                            case RenderingMode.WritableBitmap:
                                this.WritableBitmap.Lock();
                                WritableBitmapGraphics.DrawLine(pen, points[i].AsDrawingPointF(), lowPoints[i].AsDrawingPointF());
                                this.WritableBitmap.Unlock();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    this.Collection.InvalidateBitmap();
                }
            }
        }