Ejemplo n.º 1
0
        /// <summary>
        /// Method used to calculate the segment's rendering rect.
        /// </summary>
        /// <param name="transformer"></param>
        /// <param name="segment"></param>
        /// <returns></returns>
        private Rect CalculateSegmentRect(IChartTransformer transformer)
        {
            double spacing     = (Series is HistogramSeries) ? 0.0 : (Series as ISegmentSpacing).SegmentSpacing;
            Point  tlpoint     = transformer.TransformToVisible(Left, Top);
            Point  rbpoint     = transformer.TransformToVisible(Right, Bottom);
            Rect   segmentRect = new Rect(tlpoint, rbpoint);

            if (spacing > 0.0 && spacing <= 1)
            {
                if (Series.IsActualTransposed == true)
                {
                    double leftpos = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing,
                                                                                         segmentRect.Bottom, segmentRect.Top);
                    segmentRect.Y = leftpos;
                    Height        = segmentRect.Height = (1 - spacing) * segmentRect.Height;
                }

                else
                {
                    double leftpos = (Series as ISegmentSpacing).CalculateSegmentSpacing(spacing, segmentRect.Right,
                                                                                         segmentRect.Left);
                    segmentRect.X = leftpos;
                    Width         = segmentRect.Width = (1 - spacing) * segmentRect.Width;
                }
            }

            return(segmentRect);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates the segments based on its data point value. This method is not
 /// intended to be called explicitly outside the Chart but it can be overriden by
 /// any derived class.
 /// </summary>
 /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
 public override void Update(IChartTransformer transformer)
 {
     bitmap = fastHiLoOpenCloseSeries.Area.GetFastRenderSurface();
     if (transformer != null && fastHiLoOpenCloseSeries.DataCount > 0)
     {
         ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
         xValues.Clear();
         yHiValues.Clear();
         yLoValues.Clear();
         yOpenStartValues.Clear();
         yOpenEndValues.Clear();
         yCloseValues.Clear();
         yCloseEndValues.Clear();
         isBull.Clear();
         x_isInversed = cartesianTransformer.XAxis.IsInversed;
         y_isInversed = cartesianTransformer.YAxis.IsInversed;
         sbsInfo      = (fastHiLoOpenCloseSeries as ChartSeriesBase).GetSideBySideInfo(fastHiLoOpenCloseSeries as ChartSeriesBase);
         center       = sbsInfo.Median;
         Left         = sbsInfo.Start;
         Right        = sbsInfo.End;
         //Removed the screen point calculation methods and added the Transform to Visible method.
         CalculatePoint(cartesianTransformer);
         UpdateVisual(true);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Updates the segments based on its data point value. This method is not
 /// intended to be called explicitly outside the Chart but it can be overridden by
 /// any derived class.
 /// </summary>
 /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
 public override void Update(IChartTransformer transformer)
 {
     if (transformer != null)
     {
         ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
         double xStart         = cartesianTransformer.XAxis.VisibleRange.Start;
         double xEnd           = cartesianTransformer.XAxis.VisibleRange.End;
         double xBase          = cartesianTransformer.XAxis.IsLogarithmic ? (cartesianTransformer.XAxis as LogarithmicAxis).LogarithmicBase : 1;
         bool   xIsLogarithmic = cartesianTransformer.XAxis.IsLogarithmic;
         double edgeValue      = xIsLogarithmic ? Math.Log(xVal, xBase) : xVal;
         if (edgeValue >= xStart && edgeValue <= xEnd && ((!double.IsNaN(highValue) && !double.IsNaN(lowValue)) || Series.ShowEmptyPoints))
         {
             Point hipoint = transformer.TransformToVisible(xVal, highValue);
             Point lopoint = transformer.TransformToVisible(xVal, lowValue);
             segLine.X1 = hipoint.X;
             segLine.Y1 = hipoint.Y;
             segLine.X2 = lopoint.X;
             segLine.Y2 = lopoint.Y;
         }
         else
         {
             segLine.ClearUIValues();
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            var adornment3D = this as ChartAdornment3D;

            if (this.Series is XyzDataSeries3D && !string.IsNullOrEmpty((this.Series as XyzDataSeries3D).ZBindingPath))
            {
                var vector3D = (transformer as ChartTransform.ChartCartesianTransformer).TransformToVisible3D(XPos, YPos, adornment3D.StartDepth);
                this.X = vector3D.X;
                this.Y = vector3D.Y;
                adornment3D.ActualStartDepth = vector3D.Z;
            }
            else
            {
                if (Series is RangeColumnSeries && !Series.IsMultipleYPathRequired)
                {
                    YPos = (Series.ActualYAxis.VisibleRange.End - Math.Abs(Series.ActualYAxis.VisibleRange.Start)) / 2;
                }

                Point point = transformer.TransformToVisible(XPos, YPos);
                this.X = point.X;
                this.Y = point.Y;

                if (adornment3D != null)
                {
                    adornment3D.ActualStartDepth = adornment3D.StartDepth;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            PathFigure figure = new PathFigure();

            int startIndex = 0;
            int endIndex   = AreaPoints.Count - 1;

            if (AreaPoints.Count > 0)
            {
                figure.StartPoint = transformer.TransformToVisible(AreaPoints[0].X, AreaPoints[0].Y);

                for (int i = startIndex; i < AreaPoints.Count; i += 2)
                {
                    WindowsLinesegment lineSeg = new WindowsLinesegment();
                    lineSeg.Point = transformer.TransformToVisible(AreaPoints[i].X, AreaPoints[i].Y);
                    figure.Segments.Add(lineSeg);
                }

                for (int i = endIndex; i >= 1; i -= 2)
                {
                    WindowsLinesegment lineSeg = new WindowsLinesegment();
                    lineSeg.Point = transformer.TransformToVisible(AreaPoints[i].X, AreaPoints[i].Y);
                    figure.Segments.Add(lineSeg);
                }
                figure.IsClosed             = true;
                Series.SeriesRootPanel.Clip = null;
            }
            PathGeometry segmentGeometry = new PathGeometry();

            segmentGeometry.Figures.Add(figure);
            segPath.Data = segmentGeometry;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            if (Series == null || Series.ActualArea == null)
            {
                return;
            }

            if (!this.IsSegmentVisible)
            {
                segmentPath.Visibility = Visibility.Collapsed;
            }
            else
            {
                segmentPath.Visibility = Visibility.Visible;
            }

            if (IsMultipleCircleDoughnut)
            {
                DrawMultipleDoughnut(transformer);
            }
            else
            {
                DrawSingleDoughnut(transformer);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            bitmap = fastCandleBitmapSeries.Area.GetFastRenderSurface();
            if (transformer != null && fastCandleBitmapSeries.DataCount > 0)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;

                count = (int)(Math.Ceiling(xEnd));
                count = (int)Math.Min(count, xChartVals.Count);

                x_isInversed = cartesianTransformer.XAxis.IsInversed;
                y_isInversed = cartesianTransformer.YAxis.IsInversed;
                xStart       = cartesianTransformer.XAxis.VisibleRange.Start;
                xEnd         = cartesianTransformer.XAxis.VisibleRange.End;
                yStart       = cartesianTransformer.YAxis.VisibleRange.Start;
                yEnd         = cartesianTransformer.YAxis.VisibleRange.End;
                if (fastCandleBitmapSeries.IsActualTransposed)
                {
                    ySize   = cartesianTransformer.YAxis.RenderedRect.Width;
                    xSize   = cartesianTransformer.XAxis.RenderedRect.Height;
                    yOffset = cartesianTransformer.YAxis.RenderedRect.Left - fastCandleBitmapSeries.Area.SeriesClipRect.Left;
                    xOffset = cartesianTransformer.XAxis.RenderedRect.Top - fastCandleBitmapSeries.Area.SeriesClipRect.Top;
                }
                else
                {
                    ySize   = cartesianTransformer.YAxis.RenderedRect.Height;
                    xSize   = cartesianTransformer.XAxis.RenderedRect.Width;
                    yOffset = cartesianTransformer.YAxis.RenderedRect.Top - fastCandleBitmapSeries.Area.SeriesClipRect.Top;
                    xOffset = cartesianTransformer.XAxis.RenderedRect.Left - fastCandleBitmapSeries.Area.SeriesClipRect.Left;
                }

                if (x_isInversed)
                {
                    double temp = xStart;
                    xStart = xEnd;
                    xEnd   = temp;
                }

                if (y_isInversed)
                {
                    double temp = yStart;
                    yStart = yEnd;
                    yEnd   = temp;
                }
                isHollow.Clear();
                isBull.Clear();
                xValues.Clear();
                x1Values.Clear();
                x2Values.Clear();
                openValue.Clear();
                closeValue.Clear();
                highValue.Clear();
                highValue1.Clear();
                lowValue.Clear();
                lowValue1.Clear();
                //Removed the screen point calculation methods and added the point to value method.
                CalculatePoints(cartesianTransformer);
                UpdateVisual();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            bitmap = fastBarSeries.Area.GetFastRenderSurface();
            if (transformer != null && fastBarSeries.DataCount != 0)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer =
                    transformer as ChartTransform.ChartCartesianTransformer;
                bool isLogarithmic = cartesianTransformer.XAxis.IsLogarithmic ||
                                     cartesianTransformer.YAxis.IsLogarithmic;
                x_isInversed = cartesianTransformer.XAxis.IsInversed;
                y_isInversed = cartesianTransformer.YAxis.IsInversed;

                xStart = cartesianTransformer.XAxis.VisibleRange.Start;
                xEnd   = cartesianTransformer.XAxis.VisibleRange.End;

                yStart = cartesianTransformer.YAxis.VisibleRange.Start;
                yEnd   = cartesianTransformer.YAxis.VisibleRange.End;


                width  = cartesianTransformer.XAxis.RenderedRect.Height;
                height = cartesianTransformer.YAxis.RenderedRect.Width;

                // WPF-14441 - Calculating Bar Position for the Series
                left = fastBarSeries.Area.SeriesClipRect.Right - cartesianTransformer.YAxis.RenderedRect.Right;
                top  = fastBarSeries.Area.SeriesClipRect.Bottom - cartesianTransformer.XAxis.RenderedRect.Bottom;

                availableSize = new Size(width, height);
                if (x_isInversed)
                {
                    double temp = xStart;
                    xStart = xEnd;
                    xEnd   = temp;
                }

                if (y_isInversed)
                {
                    double temp = yStart;
                    yStart = yEnd;
                    yEnd   = temp;
                }

                x1Values.Clear();
                x2Values.Clear();
                y1Values.Clear();
                y2Values.Clear();
                //Removed the screen point calculation methods and added the point to value method.
                if (!isLogarithmic)
                {
                    CalculatePoints(cartesianTransformer);
                }
                else
                {
                    CalculateLogPoints(cartesianTransformer);
                }
                UpdateVisual();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Updates the <see cref="ChartTrendlinePanel"/>.
        /// </summary>
        /// <param name="finalSize">The Final Size</param>
        internal void Update(Size finalSize)
        {
            IChartTransformer chartTransformer = Trend.Series.CreateTransformer(finalSize, true);

            foreach (var segment in Trend.TrendlineSegments)
            {
                segment.Update(chartTransformer);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            if (transformer != null)
            {
                if (isSegmentUpdated)
                {
                    Series.SeriesRootPanel.Clip = null;
                }
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
                double xBase          = cartesianTransformer.XAxis.IsLogarithmic ? (cartesianTransformer.XAxis as LogarithmicAxis).LogarithmicBase : 1;
                bool   xIsLogarithmic = cartesianTransformer.XAxis.IsLogarithmic;
                double xStart         = cartesianTransformer.XAxis.VisibleRange.Start;
                double xEnd           = cartesianTransformer.XAxis.VisibleRange.End;
                double left           = xIsLogarithmic ? Math.Log(Point1.X, xBase) : Point1.X;
                double right          = xIsLogarithmic ? Math.Log(Point4.X, xBase) : Point4.X;

                if ((left <= xEnd && right >= xStart))
                {
                    PathFigure    figure      = new PathFigure();
                    BezierSegment bezierSeg   = new BezierSegment();
                    PathGeometry  segGeometry = new PathGeometry();

                    P1 = figure.StartPoint = transformer.TransformToVisible(Point1.X, Point1.Y);
                    Q1 = bezierSeg.Point1 = transformer.TransformToVisible(Point2.X, Point2.Y);
                    Q2 = bezierSeg.Point2 = transformer.TransformToVisible(Point3.X, Point3.Y);
                    P2 = bezierSeg.Point3 = transformer.TransformToVisible(Point4.X, Point4.Y);
                    figure.Segments.Add(bezierSeg);
                    segGeometry.Figures = new PathFigureCollection()
                    {
                        figure
                    };

                    var path = this.segPath;
                    if (path != null)
                    {
                        path.Data = segGeometry;
                    }
                    else
                    {
                        Data = segGeometry;
                    }
                }
                else
                {
                    if (segPath != null)
                    {
                        this.segPath.Data = null;
                    }
                    else if (Data != null)
                    {
                        Data = null;
                    }
                }
                isSegmentUpdated = true;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This method is used to gets the selected data point segment pixel positions
        /// </summary>
        internal void GenerateColumnPixels()
        {
            if (!double.IsNaN(dataPoint.YData))
            {
                WriteableBitmap bmp = Area.fastRenderSurface;

                IChartTransformer chartTransformer = CreateTransformer(
                    new Size(
                        Area.SeriesClipRect.Width,
                        Area.SeriesClipRect.Height),
                    true);
                bool x_isInversed = ActualXAxis.IsInversed;
                bool y_isInversed = ActualYAxis.IsInversed;

                DoubleRange sbsInfo = GetSideBySideInfo(this);
                double      origin  = ActualXAxis != null ? ActualXAxis.Origin : 0;
                double      x1      = x_isInversed ? dataPoint.XData + sbsInfo.End : dataPoint.XData + sbsInfo.Start;
                double      x2      = x_isInversed ? dataPoint.XData + sbsInfo.Start : dataPoint.XData + sbsInfo.End;
                double      y1      = y_isInversed ? origin : dataPoint.YData;
                double      y2      = y_isInversed ? dataPoint.YData : origin;

                Point tlpoint = chartTransformer.TransformToVisible(x1, y1);
                Point rbpoint = chartTransformer.TransformToVisible(x2, y2);

                double _x1            = tlpoint.X;
                double _x2            = rbpoint.X;
                double _y1            = y1 > 0 ? tlpoint.Y : rbpoint.Y;
                double _y2            = y1 > 0 ? rbpoint.Y : tlpoint.Y;
                int    width          = (int)Area.SeriesClipRect.Width;
                int    height         = (int)Area.SeriesClipRect.Height;
                var    spacingSegment = this as ISegmentSpacing;
                if (spacingSegment != null)
                {
                    double spacing = spacingSegment.SegmentSpacing;
                    if (spacing > 0 && spacing <= 1)
                    {
                        double leftpos  = spacingSegment.CalculateSegmentSpacing(spacing, _x2, _x1);
                        double rightpos = spacingSegment.CalculateSegmentSpacing(spacing, _x1, _x2);
                        _x1 = (float)(leftpos);
                        _x2 = (float)(rightpos);
                    }
                }

                selectedSegmentPixels.Clear();

                if (_y1 < _y2)
                {
                    selectedSegmentPixels = bmp.GetRectangle(width, height, (int)(_x1), (int)_y1, (int)_x2, (int)_y2, selectedSegmentPixels);
                }
                else
                {
                    selectedSegmentPixels = bmp.GetRectangle(width, height, (int)(_x1), (int)_y2, (int)_x2, (int)_y1, selectedSegmentPixels);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            double bottom;
            Point  center = ChartLayoutUtils.GetCenter(transformer.Viewport);

            bottom    = center.Y;
            center.Y  = 0;
            center.Y += ((CurrY * bottom) * 2) - (Height / 2) * 4;
            this.X    = center.X;
            this.Y    = center.Y;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            this.Points = new PointCollection();

            foreach (var item in distributionPoints)
            {
                Point point = transformer.TransformToVisible(item.X, item.Y);
                Points.Add(point);
            }
            this.polyLine.Points = Points;
        }
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            bitmap = fastRangeAreaBitmapSeries.Area.GetFastRenderSurface();
            if (transformer != null && fastRangeAreaBitmapSeries.DataCount > 0)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;

                // Removed the screen point calculation methods and added the point to value method.
                CalculatePoints(cartesianTransformer);
                UpdateVisual();
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            if (Series is RangeColumnSeries && !Series.IsMultipleYPathRequired)
            {
                YPos = (Series.ActualYAxis.VisibleRange.End - Math.Abs(Series.ActualYAxis.VisibleRange.Start)) / 2;
            }

            Point point = transformer.TransformToVisible(XPos, YPos);

            this.X = point.X;
            this.Y = point.Y;
        }
        /// <summary>
        /// Updates the real coordinates of segment.
        /// </summary>
        /// <param name="transformer">Instance of class that implements <see cref="IChartTransformer"/> interface.</param>
        public override void Update(IChartTransformer transformer)
        {
            if (this.Interior.CanFreeze)
            {
                this.Interior.Freeze();
            }
            if (this.Stroke.CanFreeze)
            {
                this.Stroke.Freeze();
            }


            // Generate the Spline Curve Geomentry
            PathFigure figure = new PathFigure();

            figure.StartPoint = transformer.TransformToVisible(AreaPoints[0].X, 0);
            figure.Segments.Add(new LineSegment(transformer.TransformToVisible(AreaPoints[0].X, AreaPoints[0].Y), true));
            int i;

            for (i = 1; i < CorrespondingPoints.Length; i++)
            {
                Point point1 = transformer.TransformToVisible(i, CorrespondingPoints[i].DataPoint.Y);
                Point point2 = transformer.TransformToVisible(i, CorrespondingPoints[i].DataPoint.Y);
                Point point3 = transformer.TransformToVisible(i, CorrespondingPoints[i].DataPoint.Y);

                figure.Segments.Add(new BezierSegment(point1, point2, point3, true));
            }
            Point point11 = transformer.TransformToVisible(CorrespondingPoints[CorrespondingPoints.Length - 1].DataPoint.X, CorrespondingPoints[CorrespondingPoints.Length - 1].DataPoint.Y);
            Point point21 = transformer.TransformToVisible(CorrespondingPoints[CorrespondingPoints.Length - 1].DataPoint.X, CorrespondingPoints[CorrespondingPoints.Length - 1].DataPoint.Y);
            Point point31 = transformer.TransformToVisible(CorrespondingPoints[CorrespondingPoints.Length - 1].DataPoint.X, m_HybirdLineValue.Y);

            figure.Segments.Add(new BezierSegment(point11, point21, point31, true));

            figure.Segments.Add(new LineSegment(transformer.TransformToVisible(0, m_HybirdLineValue.Y), false));
            figure.IsClosed = true;

            PathGeometry pathgeomentry = new PathGeometry();

            pathgeomentry.Figures.Add(figure);

            PathFigureCollection PathFigurecoll = new PathFigureCollection();

            PathFigurecoll.Add(figure);

            //Initialize the Spline curve Geometry data
            this.Geometry = pathgeomentry;

            // Calculates the value for HybridLine
            Point point = transformer.TransformToVisible(0d, m_HybirdLineValue.Y);

            this.HybirdMargin = new Thickness(0, point.Y, 0, 0);
        }
 /// <summary>
 /// Updates the segments based on its data point value. This method is not
 /// intended to be called explicitly outside the Chart but it can be overriden by
 /// any derived class.
 /// </summary>
 /// <param name="transformer"></param>
 public override void Update(IChartTransformer transformer)
 {
     bitmap = fastSeries.Area.GetFastRenderSurface();
     if (transformer != null && fastSeries.DataCount > 0)
     {
         ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
         xValues.Clear();
         yValues.Clear(); //WPF-14440 In seconday axis scrolling not apply for FastStepLineBitmapSeries
         //Removed the existing screen point calculation methods and added the TransformVisible method.
         CalculatePoints(cartesianTransformer);
         UpdateVisual();
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Updates the segments based on its data point value. This method is not
 /// intended to be called explicitly outside the Chart but it can be overridden by
 /// any derived class.
 /// </summary>
 /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
 public override void Update(IChartTransformer transformer)
 {
     if (transformer != null)
     {
         Point position = transformer.TransformToVisible(XData, YData);
         this.X = position.X - (EmptyPointSymbolWidth / 2);
         this.Y = position.Y - (EmptyPointSymbolHeight / 2);
     }
     if (Series.EmptyPointSymbolTemplate == null)
     {
         base.Update(transformer);
     }
 }
Ejemplo n.º 19
0
 internal void UpdateSegment(int index, NotifyCollectionChangedAction action, IChartTransformer transformer)
 {
     if (action == NotifyCollectionChangedAction.Remove)
     {
         this.Points.RemoveAt(index);
     }
     else if (action == NotifyCollectionChangedAction.Add)
     {
         Point point = transformer.TransformToVisible(xChartVals[index], yChartVals[index]);
         Points.Add(point);
         UpdateVisual(false);
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            if (!this.IsSegmentVisible)
            {
                segmentPath.Visibility = Visibility.Collapsed;
            }
            else
            {
                segmentPath.Visibility = Visibility.Visible;
            }

            Rect          rect   = new Rect(0, 0, transformer.Viewport.Width, transformer.Viewport.Height);
            PyramidSeries series = Series as PyramidSeries;

            if (rect.IsEmpty)
            {
                this.segmentPath.Data = null;
            }
            else
            {
                if (this.isExploded)
                {
                    rect.X += explodedOffset;
                }
                double     top          = y;
                double     bottom       = y + height;
                double     topRadius    = 0.5d * (1d - y);
                double     bottomRadius = 0.5d * (1d - bottom);
                PathFigure figure       = new PathFigure();
                figure.StartPoint = new Point(rect.X + topRadius * rect.Width, rect.Y + top * rect.Height);
                Linesegment lineSeg1 = new Linesegment();
                lineSeg1.Point = new Point(rect.X + (1 - topRadius) * rect.Width, rect.Y + top * rect.Height);
                figure.Segments.Add(lineSeg1);
                Linesegment lineSeg3 = new Linesegment();
                lineSeg3.Point = new Point(rect.X + (1 - bottomRadius) * rect.Width, rect.Y + bottom * rect.Height - series.StrokeThickness / 2);
                figure.Segments.Add(lineSeg3);
                Linesegment lineSeg4 = new Linesegment();
                lineSeg4.Point = new Point(rect.X + bottomRadius * rect.Width, rect.Y + bottom * rect.Height - series.StrokeThickness / 2);
                figure.Segments.Add(lineSeg4);
                figure.IsClosed              = true;
                this.segmentGeometry         = new PathGeometry();
                this.segmentGeometry.Figures = new PathFigureCollection()
                {
                    figure
                };
                segmentPath.Data = segmentGeometry;

                height = ((bottom - top) * rect.Height) / 2;
            }
        }
Ejemplo n.º 21
0
        private void DrawMultipleDoughnut(IChartTransformer transformer)
        {
            if (IsSegmentVisible)
            {
                var segmentStartAngle = ActualStartAngle;
                var segmentEndAngle   = ActualEndAngle;
                var center            = parentSeries.Center;

                double actualRadius   = parentSeries.InternalDoughnutSize * Math.Min(transformer.Viewport.Width, transformer.Viewport.Height) / 2;
                double remainingWidth = actualRadius - (actualRadius * Series.ActualArea.InternalDoughnutHoleSize);
                double equalParts     = (remainingWidth / doughnutSegmentsCount) * parentSeries.InternalDoughnutCoefficient;
                double radius         = actualRadius - (equalParts * (doughnutSegmentsCount - (DoughnutSegmentIndex + 1)));
                parentSeries.Radius = actualRadius - equalParts;
                double innerRadius = radius - equalParts;
                double outerRadius = radius - equalParts * parentSeries.SegmentSpacing;
                innerRadius = ChartMath.MaxZero(innerRadius);

                if (parentSeries.Segments.IndexOf(this) == 0)
                {
                    parentSeries.InnerRadius = innerRadius;
                }

                this.pathGeometry     = GetDoughnutGeometry(center, outerRadius, innerRadius, segmentStartAngle, segmentEndAngle, false);
                this.segmentPath.Data = pathGeometry;

                //Rendering the back segments.
                var seriesStartAngle = parentSeries.DegreeToRadianConverter(parentSeries.StartAngle);
                var seriesEndAngle   = parentSeries.DegreeToRadianConverter(parentSeries.EndAngle);

                var totalArcLength = Math.PI * 2;
                var arcLength      = seriesEndAngle - seriesStartAngle;
                if (Math.Abs(Math.Round(arcLength, 2)) > totalArcLength)
                {
                    arcLength = arcLength % totalArcLength;
                }

                seriesEndAngle = arcLength + seriesStartAngle;

                this.circularPathGeometry      = GetDoughnutGeometry(center, outerRadius, innerRadius, seriesStartAngle, seriesEndAngle, true);
                this.CircularDoughnutPath.Data = circularPathGeometry;
            }
            else
            {
                this.pathGeometry     = null;
                this.segmentPath.Data = null;

                this.circularPathGeometry      = null;
                this.CircularDoughnutPath.Data = null;
            }
        }
Ejemplo n.º 22
0
        internal void UpdateMeanSymbol(IChartTransformer cartesianTransformer, bool showMedian)
        {
            if (showMedian)
            {
                averagePath.Visibility = Visibility.Visible;
                Point  averagePoint = cartesianTransformer.TransformToVisible(Center, average);
                double sizeRatio = 0.25, CenterX, CenterY;

                if (this.Series.IsActualTransposed)
                {
                    //To retain with the path size when the size is increased.
                    double widthFactor = rect.Height * sizeRatio;
                    widthFactor = widthFactor > averagePathSize ? averagePathSize : widthFactor;

                    averagePath.Width  = widthFactor;
                    averagePath.Height = widthFactor;

                    CenterX = averagePoint.X;
                    CenterY = (rect.Top + rect.Height / 2);
                }
                else
                {
                    double widthFactor = rect.Width * sizeRatio;
                    widthFactor = widthFactor > averagePathSize ? averagePathSize : widthFactor;

                    averagePath.Width  = widthFactor;
                    averagePath.Height = widthFactor;

                    CenterX = (rect.X + rect.Width / 2);
                    CenterY = averagePoint.Y;
                }

                Canvas.SetLeft(averagePath, CenterX - averagePath.Width / 2);
                Canvas.SetTop(averagePath, CenterY - averagePath.Height / 2);

                if (!segmentCanvas.Children.Contains(averagePath))
                {
                    segmentCanvas.Children.Add(averagePath);
                }
            }
            else
            {
                if (segmentCanvas.Children.Contains(averagePath))
                {
                    segmentCanvas.Children.Remove(averagePath);
                }
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Updates the panel.
        /// </summary>
        /// <param name="finalSize"></param>
        internal void Update(Size finalSize)
        {
            bool canUpdate = !(Series is ISupportAxes);

            if (Series is ISupportAxes &&
                Series.ActualXAxis != null && Series.ActualYAxis != null)
            {
                canUpdate = true;
                if (Series.Area != null)
                {
                    Series.Area.ClearBuffer();
                }
            }

            if (canUpdate)
            {
                IChartTransformer chartTransformer = Series.CreateTransformer(finalSize, true);
                if (Series is CircularSeriesBase)
                {
                    CircularSeriesBase circularSeries = Series as CircularSeriesBase;
                    Rect rect = ChartLayoutUtils.Subtractthickness(new Rect(new Point(), finalSize), Series.Margin);
                    chartTransformer = Series.CreateTransformer(new Size(rect.Width, rect.Height), true);
                    var    pieSeries   = circularSeries as PieSeries;
                    double coefficient = pieSeries != null ? pieSeries.InternalPieCoefficient : (circularSeries as DoughnutSeries).InternalDoughnutCoefficient;
                    double radius      = coefficient * Math.Min(chartTransformer.Viewport.Width, chartTransformer.Viewport.Height) / 2;
                    circularSeries.Center = circularSeries.GetActualCenter(new Point(chartTransformer.Viewport.Width * 0.5d, chartTransformer.Viewport.Height * 0.5d), radius);
                }

                Series.Pixels.Clear();
                Series.bitmapPixels.Clear();
                Series.bitmapRects.Clear();
                foreach (ChartSegment segment in Series.Segments)
                {
                    segment.Update(chartTransformer);
                }

                if (Series.CanAnimate && Series.Segments.Count > 0)
                {
                    Series.Animate();
                    Series.CanAnimate = false;
                }

                if (Series.IsLoading)
                {
                    Series.IsLoading = false;
                }
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Updates the segments based on its data point value. This method is not
 /// intended to be called explicitly outside the Chart but it can be overriden by
 /// any derived class.
 /// </summary>
 /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
 public override void Update(IChartTransformer transformer)
 {
     bitmap = fastHiloSeries.Area.GetFastRenderSurface();
     if (transformer != null && fastHiloSeries.DataCount > 0)
     {
         ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
         xValues.Clear();
         yHiValues.Clear();
         yLoValues.Clear();
         x_isInversed = cartesianTransformer.XAxis.IsInversed;
         y_isInversed = cartesianTransformer.YAxis.IsInversed;
         //Removed the screen point calculation methods and added the point to value method.
         CalculatePoints(cartesianTransformer);
         UpdateVisual(true);
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            bitmap = fastColumnSeries.Area.GetFastRenderSurface();
            if (transformer != null && fastColumnSeries.DataCount != 0)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
                x_isInversed = cartesianTransformer.XAxis.IsInversed;
                y_isInversed = cartesianTransformer.YAxis.IsInversed;

                x1Values.Clear();
                x2Values.Clear();
                y1Values.Clear();
                y2Values.Clear();
                actualIndexes.Clear();
                //Removed the existing screen point calculation methods and added the TransformVisible method.
                CalculatePoints(cartesianTransformer);
                UpdateVisual(true);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            PathFigure figure = new PathFigure();

            if (AreaPoints.Count > 1)
            {
                int endIndex = AreaPoints.Count - 1;
                WindowsLineSegment lineSegment = new WindowsLineSegment();
                figure.StartPoint = transformer.TransformToVisible(AreaPoints[0].X, AreaPoints[0].Y);
                lineSegment.Point = transformer.TransformToVisible(AreaPoints[1].X, AreaPoints[1].Y);
                figure.Segments.Add(lineSegment);

                for (int i = 2; i < AreaPoints.Count - 1; i += 6)
                {
                    BezierSegment segment = new BezierSegment();
                    segment.Point1 = transformer.TransformToVisible(AreaPoints[i].X, AreaPoints[i].Y);
                    segment.Point2 = transformer.TransformToVisible(AreaPoints[i + 1].X, AreaPoints[i + 1].Y);
                    segment.Point3 = transformer.TransformToVisible(AreaPoints[i + 2].X, AreaPoints[i + 2].Y);
                    figure.Segments.Add(segment);
                }

                lineSegment       = new WindowsLineSegment();
                lineSegment.Point = transformer.TransformToVisible(AreaPoints[endIndex].X, AreaPoints[endIndex].Y);
                figure.Segments.Add(lineSegment);

                for (int i = endIndex - 1; i > 1; i -= 6)
                {
                    BezierSegment segment = new BezierSegment();
                    segment.Point1 = transformer.TransformToVisible(AreaPoints[i].X, AreaPoints[i].Y);
                    segment.Point2 = transformer.TransformToVisible(AreaPoints[i - 1].X, AreaPoints[i - 1].Y);
                    segment.Point3 = transformer.TransformToVisible(AreaPoints[i - 2].X, AreaPoints[i - 2].Y);
                    figure.Segments.Add(segment);
                }
            }

            PathGeometry segmentGeometry = new PathGeometry();

            segmentGeometry.Figures.Add(figure);
            this.segPath.Data = segmentGeometry;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            if (transformer != null)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
                double xBase          = cartesianTransformer.XAxis.IsLogarithmic ? (cartesianTransformer.XAxis as LogarithmicAxis).LogarithmicBase : 1;
                bool   xIsLogarithmic = cartesianTransformer.XAxis.IsLogarithmic;
                double xStart         = cartesianTransformer.XAxis.VisibleRange.Start;
                double xEnd           = cartesianTransformer.XAxis.VisibleRange.End;
                double pos            = xIsLogarithmic ? Math.Log(xPos, xBase) : xPos;

                if (pos >= xStart && pos <= xEnd && (!double.IsNaN(yPos) || Series.ShowEmptyPoints))
                {
                    Point point1 = transformer.TransformToVisible(xPos, yPos);

                    if (ellipseSegment != null)
                    {
                        ellipseSegment.Visibility = Visibility.Visible;
                        ellipseSegment.Height     = ellipseSegment.Width = 2 * this.segmentRadius;
                        ellipseSegment.SetValue(Canvas.LeftProperty, point1.X - this.segmentRadius);
                        ellipseSegment.SetValue(Canvas.TopProperty, point1.Y - this.segmentRadius);
                    }
                    else
                    {
                        control.Visibility = Visibility.Visible;
                        RectX = point1.X - this.segmentRadius;
                        RectY = point1.Y - this.segmentRadius;
                        Size  = SegmentRadius = 2 * this.segmentRadius;
                    }
                }
                else if (customTemplate == null)
                {
                    ellipseSegment.Visibility = Visibility.Collapsed;
                }
                else
                {
                    control.Visibility = Visibility.Collapsed;
                }
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            if (!this.Series.IsMultipleYPathRequired)
            {
                var axisYRange    = Series.ActualYAxis.VisibleRange;
                var median        = (axisYRange.End - Math.Abs(axisYRange.Start)) / 2;
                var segmentMiddle = Top / 2;

                Top    = median + segmentMiddle;
                Bottom = median - segmentMiddle;

                var index = Series.Segments.IndexOf(this);
                YData = (Series as RangeSeriesBase).High == null ? (Series as RangeSeriesBase).LowValues[index] : (Series as RangeSeriesBase).HighValues[index];
            }
            else
            {
                High = Top;
                Low  = Bottom;
            }

            base.Update(transformer);
        }
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overriden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Reresents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>

        public override void Update(IChartTransformer transformer)
        {
            if (Length == 0)
            {
                base.Update(transformer);
            }
            else
            if (transformer != null && fastSeries.DataCount > 1)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
                bool isLogarithmic = cartesianTransformer.XAxis.IsLogarithmic || cartesianTransformer.YAxis.IsLogarithmic;
                if (!isLogarithmic)
                {
                    TransformToScreenCo(cartesianTransformer);
                }
                else
                {
                    TransformToScreenCoInLog(cartesianTransformer);
                }

                UpdateVisual(true);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Updates the segments based on its data point value. This method is not
        /// intended to be called explicitly outside the Chart but it can be overridden by
        /// any derived class.
        /// </summary>
        /// <param name="transformer">Represents the view port of chart control.(refer <see cref="IChartTransformer"/>)</param>
        public override void Update(IChartTransformer transformer)
        {
            if (transformer != null)
            {
                ChartTransform.ChartCartesianTransformer cartesianTransformer = transformer as ChartTransform.ChartCartesianTransformer;
                double xBase          = cartesianTransformer.XAxis.IsLogarithmic ? (cartesianTransformer.XAxis as LogarithmicAxis).LogarithmicBase : 1;
                bool   xIsLogarithmic = cartesianTransformer.XAxis.IsLogarithmic;
                double left           = xIsLogarithmic ? Math.Log(Left, xBase) : Left;
                double right          = xIsLogarithmic ? Math.Log(Right, xBase) : Right;
                double xStart         = Math.Floor(cartesianTransformer.XAxis.VisibleRange.Start);
                double xEnd           = Math.Ceiling(cartesianTransformer.XAxis.VisibleRange.End);

                if (!double.IsNaN(Top) && !double.IsNaN(Bottom) &&
                    (left <= xEnd && right >= xStart))
                {
                    //Calculate the rect for segment rendering.
                    rect = CalculateSegmentRect(transformer);
                    segmentCanvas.Visibility = Visibility.Visible;

                    if (WaterfallRectSegment != null)
                    {
                        WaterfallRectSegment.SetValue(Canvas.LeftProperty, rect.X);
                        WaterfallRectSegment.SetValue(Canvas.TopProperty, rect.Y);
                        WaterfallRectSegment.Visibility = Visibility.Visible;
                        Width  = WaterfallRectSegment.Width = rect.Width;
                        Height = WaterfallRectSegment.Height = rect.Height;

                        //set position for connector line.
                        UpdateConnectorLine(transformer);
                    }
                }
                else
                {
                    segmentCanvas.Visibility = Visibility.Collapsed;
                }
            }
        }