internal void UpdateVisual()
        {
            SfChart chart = fastRangeAreaBitmapSeries.Area;

            isSeriesSelected = false;

            Color checkColor = GetSegmentColor();

            // Set SeriesSelectionBrush and Check EnableSeriesSelection
            if (chart.GetEnableSeriesSelection())
            {
                Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastRangeAreaBitmapSeries);
                if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastRangeAreaBitmapSeries))
                {
                    isSeriesSelected     = true;
                    seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                }
            }

            Color color = isSeriesSelected ? seriesSelectionColor : checkColor;

            if (bitmap != null)
            {
                fastBuffer = fastRangeAreaBitmapSeries.Area.GetFastBuffer();
                int width  = (int)fastRangeAreaBitmapSeries.Area.SeriesClipRect.Width;
                int height = (int)fastRangeAreaBitmapSeries.Area.SeriesClipRect.Height;

                int leftThickness  = (int)fastRangeAreaBitmapSeries.StrokeThickness / 2;
                int rightThickness = (int)(fastRangeAreaBitmapSeries.StrokeThickness % 2 == 0
                    ? (fastRangeAreaBitmapSeries.StrokeThickness / 2) : fastRangeAreaBitmapSeries.StrokeThickness / 2 + 1);

                if (fastRangeAreaBitmapSeries is FastRangeAreaBitmapSeries)
                {
                    isSeriesSelected = false;

                    // Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastRangeAreaBitmapSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastRangeAreaBitmapSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }

                    UpdateVisual(width, height, color, leftThickness, rightThickness);
                }
            }

            fastRangeAreaBitmapSeries.Area.CanRenderToBuffer = true;
        }
        internal void UpdateVisual()
        {
            Color color = new Color();

            if (bitmap != null && xValues.Count != 0)
            {
                fastBuffer = fastCandleBitmapSeries.Area.GetFastBuffer();
                int width  = (int)fastCandleBitmapSeries.Area.SeriesClipRect.Width;
                int height = (int)fastCandleBitmapSeries.Area.SeriesClipRect.Height;

                int leftThickness  = (int)fastCandleBitmapSeries.StrokeThickness / 2;
                int rightThickness = (int)(fastCandleBitmapSeries.StrokeThickness % 2 == 0.0
                    ? (fastCandleBitmapSeries.StrokeThickness / 2) : (fastCandleBitmapSeries.StrokeThickness / 2) + 1);

                if (fastCandleBitmapSeries is FastCandleBitmapSeries)
                {
                    SfChart chart = fastCandleBitmapSeries.Area;
                    isSeriesSelected = false;

                    //Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastCandleBitmapSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastCandleBitmapSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }
                    else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
                    {
                        Brush segmentSelectionBrush = (fastCandleBitmapSeries as ISegmentSelectable).SegmentSelectionBrush;
                        if (segmentSelectionBrush != null)
                        {
                            segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                        }
                    }

                    if (!fastCandleBitmapSeries.IsActualTransposed)
                    {
                        UpdateVisualHorizontal(width, height, color, leftThickness, rightThickness);
                    }
                    else
                    {
                        UpdateVisualVertical(width, height, color, leftThickness, rightThickness);
                    }
                }
            }
            fastCandleBitmapSeries.Area.CanRenderToBuffer = true;

            xValues.Clear();
            x1Values.Clear();
            x2Values.Clear();
            openValue.Clear();
            closeValue.Clear();
            highValue.Clear();
            lowValue.Clear();
        }
Example #3
0
        internal void UpdateVisual(bool updateHiLoLine)
        {
            if (bitmap != null && xValues.Count > 0)
            {
                fastBuffer = fastHiLoOpenCloseSeries.Area.GetFastBuffer();
                int width  = (int)fastHiLoOpenCloseSeries.Area.SeriesClipRect.Width;
                int height = (int)fastHiLoOpenCloseSeries.Area.SeriesClipRect.Height;

                int leftThickness  = (int)fastHiLoOpenCloseSeries.StrokeThickness / 2;
                int rightThickness = (int)(fastHiLoOpenCloseSeries.StrokeThickness % 2 == 0
                    ? (fastHiLoOpenCloseSeries.StrokeThickness / 2) : fastHiLoOpenCloseSeries.StrokeThickness / 2 + 1);

                if (fastHiLoOpenCloseSeries is FastHiLoOpenCloseBitmapSeries)
                {
                    SfChart chart = fastHiLoOpenCloseSeries.Area;
                    isSeriesSelected = false;

                    //Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastHiLoOpenCloseSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastHiLoOpenCloseSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }
                    else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
                    {
                        Brush segmentSelectionBrush = (fastHiLoOpenCloseSeries as ISegmentSelectable).SegmentSelectionBrush;
                        if (segmentSelectionBrush != null)
                        {
                            segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                        }
                    }

                    if (!fastHiLoOpenCloseSeries.IsActualTransposed)
                    {
                        UpdateVisualHorizontal(width, height, leftThickness, rightThickness);
                    }
                    else
                    {
                        UpdateVisualVertical(width, height, leftThickness, rightThickness);
                    }
                }
            }
            fastHiLoOpenCloseSeries.Area.CanRenderToBuffer = true;

            xValues.Clear();
            yHiValues.Clear();
            yLoValues.Clear();
            yOpenStartValues.Clear();
            yOpenEndValues.Clear();
            yCloseValues.Clear();
            yCloseEndValues.Clear();
        }
        internal void UpdateVisual()
        {
            double xStart, yStart;
            bool   isMultiColor = Series.Palette != ChartColorPalette.None && fastSeries.Interior == null;
            Color  color        = GetColor(this.Interior);

            if (bitmap != null && xValues.Count > 0 && fastSeries.StrokeThickness > 0)
            {
                fastBuffer = fastSeries.Area.GetFastBuffer();
                xStart     = xValues[0];
                yStart     = yValues[0];

                int width  = (int)fastSeries.Area.SeriesClipRect.Width;
                int height = (int)fastSeries.Area.SeriesClipRect.Height;

                int leftThickness  = (int)fastSeries.StrokeThickness / 2;
                int rightThickness = (int)(fastSeries.StrokeThickness % 2 == 0
                    ? (fastSeries.StrokeThickness / 2) - 1 : fastSeries.StrokeThickness / 2);

                if (fastSeries is FastStepLineBitmapSeries)
                {
                    SfChart chart = fastSeries.Area;
                    isSeriesSelected = false;

                    //Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }

                    if (!fastSeries.IsActualTransposed)
                    {
                        UpdateVisualHorizontal(xStart, yStart, width, height, color, isMultiColor, leftThickness, rightThickness);
                    }
                    else
                    {
                        UpdateVisualVertical(xStart, yStart, width, height, color, isMultiColor, leftThickness, rightThickness);
                    }
                }
            }

            fastSeries.Area.CanRenderToBuffer = true;
            xValues.Clear();
            yValues.Clear();
        }
        internal void UpdateVisual()
        {
            double xr = fastSeries.ScatterWidth, yr = fastSeries.ScatterHeight;
            bool   isMultiColor = Series.Palette != ChartColorPalette.None && fastSeries.Interior == null;
            Color  color        = GetColor(Interior);

            if (bitmap != null && xValues.Count > 0)
            {
                fastBuffer = fastSeries.Area.GetFastBuffer();
                int width  = (int)fastSeries.Area.SeriesClipRect.Width;
                int height = (int)fastSeries.Area.SeriesClipRect.Height;

                if (fastSeries is FastScatterBitmapSeries)
                {
                    isSeriesSelected = false;
                    SfChart chart = fastSeries.Area;

                    //Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }
                    else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
                    {
                        Brush segmentSelectionBrush = (fastSeries as ISegmentSelectable).SegmentSelectionBrush;
                        if (segmentSelectionBrush != null)
                        {
                            segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                        }
                    }

                    DrawScatterType(fastSeries.ShapeType, width, height, color, isMultiColor, xr, yr);
                }
            }

            fastSeries.Area.CanRenderToBuffer = true;

            xValues.Clear();
            yValues.Clear();
        }
        internal void UpdateVisual()
        {
            bool    isMultiColor = fastBarSeries.Palette != ChartColorPalette.None && fastBarSeries.Interior == null;
            float   x1 = 0, x2, y1, y2, diff = 0;
            Color   color;
            SfChart chart = fastBarSeries.Area;

            isSeriesSelected = false;
            Color segmentColor = GetColor(this.Interior);

            //Set SeriesSelectionBrush and Check EnableSeriesSelection
            if (chart.GetEnableSeriesSelection())
            {
                Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastBarSeries);
                if (seriesSelectionBrush != null &&
                    chart.SelectedSeriesCollection.Contains(fastBarSeries))
                {
                    isSeriesSelected     = true;
                    seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                }
            }
            else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
            {
                Brush segmentSelectionBrush = (fastBarSeries as ISegmentSelectable).SegmentSelectionBrush;
                if (segmentSelectionBrush != null)
                {
                    segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                }
            }

            int dataCount = x1Values.Count;

            if (bitmap != null && x1Values.Count != 0)
            {
                fastBuffer = chart.GetFastBuffer();
                double width  = (int)chart.SeriesClipRect.Width;
                double height = (int)chart.SeriesClipRect.Height;

                for (int i = 0; i < dataCount; i++)
                {
                    if (isSeriesSelected)
                    {
                        color = seriesSelectionColor;
                    }
                    else if (fastBarSeries.SelectedSegmentsIndexes.Contains(startIndex) && (fastBarSeries as ISegmentSelectable).SegmentSelectionBrush != null)
                    {
                        color = segmentSelectionColor;
                    }
                    else if (fastBarSeries.SegmentColorPath != null && fastBarSeries.Interior == null)
                    {
                        if (fastBarSeries.ColorValues.Count > 0 && fastBarSeries.ColorValues[startIndex] != null)
                        {
                            color = GetColor(fastBarSeries.ColorValues[startIndex]);
                        }
                        else if (fastBarSeries.Palette == ChartColorPalette.None)
                        {
                            int serIndex = fastBarSeries.ActualArea.GetSeriesIndex(this.Series);
                            color = GetColor(fastBarSeries.ActualArea.ColorModel.GetBrush(serIndex));
                        }
                        else
                        {
                            Brush brush = fastBarSeries.ColorModel.GetBrush(startIndex);
                            color = GetColor(brush);
                        }
                    }
                    else if (isMultiColor)
                    {
                        Brush brush = fastBarSeries.ColorModel.GetBrush(startIndex);
                        color = GetColor(brush);
                    }
                    else
                    {
                        color = segmentColor;
                    }

                    startIndex++;
                    x1 = x1Values[i];
                    x2 = x2Values[i];
                    y1 = y1ChartVals[i] > 0 ? y1Values[i] : y2Values[i];
                    y2 = y1ChartVals[i] > 0 ? y2Values[i] : y1Values[i];
                    double spacing = (fastBarSeries as ISegmentSpacing).SegmentSpacing;
                    if (spacing > 0 && spacing <= 1)
                    {
                        double leftpos  = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing, x1, x2);
                        double rightpos = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing, x2, x1);
                        x2 = (float)leftpos;
                        x1 = (float)rightpos;
                    }
                    diff = x2 - x1;

                    if (y1 < y2)
                    {
                        bitmap.FillRectangle(fastBuffer, (int)width, (int)height, (int)(width - y2), (int)(height - x1 - diff),
                                             (int)(width - y1), (int)(height - x1), color, fastBarSeries.bitmapPixels);

                        Series.bitmapRects.Add(new Rect(new Point((width - y2), (height - x1 - diff)),
                                                        new Point((width - y1), (height - x1))));
                    }
                    else
                    {
                        bitmap.FillRectangle(fastBuffer, (int)width, (int)height, (int)(width - y1), (int)(height - x1 - diff),
                                             (int)(width - y2), (int)(height - x1), color, fastBarSeries.bitmapPixels);

                        Series.bitmapRects.Add(new Rect(new Point((width - y1), (height - x1 - diff)),
                                                        new Point((width - y2), (height - x1))));
                    }
                }
            }
            chart.CanRenderToBuffer = true;

            x1Values.Clear();
            x2Values.Clear();
            y1Values.Clear();
            y2Values.Clear();
        }
Example #7
0
        internal void UpdateVisual(bool updateHiLoLine)
        {
            bool  isMultiColor = fastHiloSeries.Palette != ChartColorPalette.None && fastHiloSeries.Interior == null;
            Color color        = GetColor(this.Interior);
            int   dataCount    = 0;

            if (yLoValues.Count < xValues.Count)
            {
                dataCount = yLoValues.Count;
            }
            else
            {
                dataCount = xValues.Count;
            }
            if (bitmap != null && xValues.Count > 0)
            {
                fastBuffer = fastHiloSeries.Area.GetFastBuffer();
                int width  = (int)fastHiloSeries.Area.SeriesClipRect.Width;
                int height = (int)fastHiloSeries.Area.SeriesClipRect.Height;

                int leftThickness  = (int)fastHiloSeries.StrokeThickness / 2;
                int rightThickness = (int)(fastHiloSeries.StrokeThickness % 2 == 0
                    ? (fastHiloSeries.StrokeThickness / 2) : fastHiloSeries.StrokeThickness / 2 + 1);

                if (fastHiloSeries is FastHiLoBitmapSeries)
                {
                    SfChart chart = fastHiloSeries.Area;
                    isSeriesSelected = false;

                    //Set SeriesSelectionBrush and Check EnableSeriesSelection
                    if (chart.GetEnableSeriesSelection())
                    {
                        Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastHiloSeries);
                        if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastHiloSeries))
                        {
                            isSeriesSelected     = true;
                            seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                        }
                    }
                    else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
                    {
                        Brush segmentSelectionBrush = (fastHiloSeries as ISegmentSelectable).SegmentSelectionBrush;
                        if (segmentSelectionBrush != null)
                        {
                            segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                        }
                    }

                    if (!fastHiloSeries.IsActualTransposed)
                    {
                        UpdateVisualHorizontal(width, height, color, leftThickness, rightThickness, isMultiColor, dataCount);
                    }
                    else
                    {
                        UpdateVisualVertical(width, height, color, leftThickness, rightThickness, isMultiColor, dataCount);
                    }
                }
            }
            fastHiloSeries.Area.CanRenderToBuffer = true;
            xValues.Clear();
            yHiValues.Clear();
            yLoValues.Clear();
        }
Example #8
0
        internal void UpdateVisual(bool updateHiLoLine)
        {
            float   x1           = 0;
            float   x2           = 0;
            float   y1           = 0;
            float   y2           = 0;
            bool    isMultiColor = fastColumnSeries.Palette != ChartColorPalette.None && fastColumnSeries.Interior == null;
            Color   color;
            SfChart chart        = fastColumnSeries.Area;
            Color   segmentColor = GetColor(this.Interior);

            isSeriesSelected = false;

            //Set SeriesSelectionBrush and Check EnableSeriesSelection
            if (chart.GetEnableSeriesSelection())
            {
                Brush seriesSelectionBrush = chart.GetSeriesSelectionBrush(fastColumnSeries);
                if (seriesSelectionBrush != null && chart.SelectedSeriesCollection.Contains(fastColumnSeries))
                {
                    isSeriesSelected     = true;
                    seriesSelectionColor = ((SolidColorBrush)seriesSelectionBrush).Color;
                }
            }
            else if (chart.GetEnableSegmentSelection())//Set SegmentSelectionBrush and Check EnableSegmentSelection
            {
                Brush segmentSelectionBrush = (fastColumnSeries as ISegmentSelectable).SegmentSelectionBrush;
                if (segmentSelectionBrush != null)
                {
                    segmentSelectionColor = ((SolidColorBrush)segmentSelectionBrush).Color;
                }
            }

            int dataCount = x1Values.Count;

            if (bitmap != null && x1Values.Count != 0)
            {
                fastBuffer = fastColumnSeries.Area.GetFastBuffer();
                int width  = (int)fastColumnSeries.Area.SeriesClipRect.Width;
                int height = (int)fastColumnSeries.Area.SeriesClipRect.Height;

                if (fastColumnSeries is FastColumnBitmapSeries || fastColumnSeries is FastStackingColumnBitmapSeries || fastColumnSeries is FastBarBitmapSeries)
                {
                    for (int i = 0; i < dataCount; i++)
                    {
                        if (double.IsNaN(y1Values[i]))
                        {
                            continue;
                        }

                        if (isSeriesSelected)
                        {
                            color = seriesSelectionColor;
                        }
                        else if (fastColumnSeries.SelectedSegmentsIndexes.Contains(startIndex) && (fastColumnSeries as ISegmentSelectable).SegmentSelectionBrush != null)
                        {
                            color = segmentSelectionColor;
                        }
                        else if (fastColumnSeries.SegmentColorPath != null && fastColumnSeries.Interior == null)
                        {
                            if (fastColumnSeries.ColorValues.Count > 0 && fastColumnSeries.ColorValues[startIndex] != null)
                            {
                                color = GetColor(fastColumnSeries.ColorValues[startIndex]);
                            }
                            else if (fastColumnSeries.Palette == ChartColorPalette.None)
                            {
                                int serIndex = fastColumnSeries.ActualArea.GetSeriesIndex(this.Series);
                                color = GetColor(fastColumnSeries.ActualArea.ColorModel.GetBrush(serIndex));
                            }
                            else
                            {
                                color = GetColor(fastColumnSeries.ColorModel.GetBrush(startIndex));
                            }
                        }
                        else if (isMultiColor)
                        {
                            color = GetColor(fastColumnSeries.ColorModel.GetBrush(actualIndexes[i]));
                        }
                        else
                        {
                            color = segmentColor;
                        }
                        startIndex++;
                        x1 = x1Values[i];
                        x2 = x2Values[i];
                        y1 = y1ChartVals[i] > 0 ? y1Values[i] : y2Values[i];
                        y2 = y1ChartVals[i] > 0 ? y2Values[i] : y1Values[i];
                        if (y1 == 0 && y2 == 0)
                        {
                            continue;
                        }
                        double spacing = (fastColumnSeries as ISegmentSpacing).SegmentSpacing;
                        if (spacing > 0 && spacing <= 1)
                        {
                            double leftpos  = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing, x2, x1);
                            double rightpos = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing, x1, x2);
                            x1 = (float)(leftpos);
                            x2 = (float)(rightpos);
                        }


                        if (y1 < y2)
                        {
                            bitmap.FillRectangle(fastBuffer, width, height, (int)(x1), (int)y1, (int)x2, (int)y2, color, fastColumnSeries.bitmapPixels);
                            Series.bitmapRects.Add(new Rect(new Point(x1, y1), new Point(x2, y2)));
                        }
                        else
                        {
                            bitmap.FillRectangle(fastBuffer, width, height, (int)(x1), (int)y2, (int)x2, (int)y1, color, fastColumnSeries.bitmapPixels);
                            Series.bitmapRects.Add(new Rect(new Point(x1, y2), new Point(x2, y1)));
                        }
                    }
                }
            }
            fastColumnSeries.Area.CanRenderToBuffer = true;
            x1Values.Clear();
            y1Values.Clear();
            y2Values.Clear();
            x2Values.Clear();
            actualIndexes.Clear();
        }