예제 #1
0
 void _chart_OnDrawCircle(object sender, Chart.DrawEventArgs <Events.SingleDrawingData> e)
 {
     _canvas.DrawCircle(e.Data.X, e.Data.Y, 5, new Paint()
     {
         Color = _colors[e.Data.SeriesNo]
     });
 }
예제 #2
0
 /// <summary>
 /// _chart_s the on draw circle.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void _chart_OnDrawCircle(object sender, Chart.DrawEventArgs <SingleDrawingData> e)
 {
     Canvas.DrawCircle((float)e.Data.X, (float)e.Data.Y, (float)e.Data.Size, new Paint()
     {
         Color = Colors[e.Data.SeriesNo]
     });
 }
예제 #3
0
 void _chart_OnDrawLine(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
 {
     _canvas.DrawLine(e.Data.XFrom, e.Data.YFrom, e.Data.XTo, e.Data.YTo, new Paint()
     {
         Color = _colors[e.Data.SeriesNo], StrokeWidth = 2.5F
     });
 }
예제 #4
0
 /// <summary>
 /// _chart_s the on draw line.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void _chart_OnDrawLine(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
 {
     Canvas.DrawLine((float)e.Data.XFrom, (float)e.Data.YFrom, (float)e.Data.XTo, (float)e.Data.YTo, new Paint()
     {
         Color = Colors[e.Data.SeriesNo], StrokeWidth = 2.5F
     });
 }
예제 #5
0
 void _chart_OnDrawBar(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
 {
     _canvas.DrawRect(e.Data.XFrom, e.Data.YFrom, e.Data.XTo, e.Data.YTo, new Paint()
     {
         Color = _colors[e.Data.SeriesNo]
     });
 }
예제 #6
0
 /// <summary>
 /// _chart_s the on draw bar.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void _chart_OnDrawBar(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
 {
     Canvas.DrawRect((float)e.Data.XFrom, (float)e.Data.YFrom, (float)e.Data.XTo, (float)e.Data.YTo, new Paint()
     {
         Color = Colors[e.Data.SeriesNo]
     });
 }
예제 #7
0
        void _chart_OnDrawText(object sender, Chart.DrawEventArgs <Events.TextDrawingData> e)
        {
            TextBlock textBlock = new TextBlock();

            textBlock.Foreground = _brush;

            Canvas.SetLeft(textBlock, e.Data.X);
            Canvas.SetTop(textBlock, e.Data.Y);

            this.Children.Add(textBlock);
        }
예제 #8
0
 /// <summary>
 /// _chart_s the on draw circle.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 private void _chart_OnDrawCircle(object sender, Chart.DrawEventArgs <SingleDrawingData> e)
 {
     using (var g = UIGraphics.GetCurrentContext())
     {
         g.SetLineWidth(2);
         Colors[e.Data.SeriesNo].SetFill();
         Colors[e.Data.SeriesNo].SetStroke();
         g.AddArc((float)e.Data.X, (float)e.Data.Y, (float)e.Data.Size, START_ANGLE, END_ANGLE, true);
         g.DrawPath(CGPathDrawingMode.FillStroke);
     }
 }
예제 #9
0
        void _chart_OnDrawCircle(object sender, Chart.DrawEventArgs <Events.SingleDrawingData> e)
        {
            WPShapes.Ellipse ellipse = new WPShapes.Ellipse();
            ellipse.Fill   = new SolidColorBrush(Colors[e.Data.SeriesNo]);
            ellipse.Width  = e.Data.Size;
            ellipse.Height = e.Data.Size;

            Canvas.SetLeft(ellipse, e.Data.X - (e.Data.Size / 2));
            Canvas.SetTop(ellipse, e.Data.Y - (e.Data.Size / 2));

            this.Children.Add(ellipse);
        }
예제 #10
0
        void _chart_OnDrawBar(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
        {
            WPShapes.Rectangle rectangle = new WPShapes.Rectangle();
            rectangle.Fill   = new SolidColorBrush(Colors[e.Data.SeriesNo]);
            rectangle.Width  = e.Data.XTo - e.Data.XFrom;
            rectangle.Height = e.Data.YTo - e.Data.YFrom;

            Canvas.SetLeft(rectangle, e.Data.XFrom);
            Canvas.SetTop(rectangle, e.Data.YFrom);

            this.Children.Add(rectangle);
        }
예제 #11
0
        void _chart_OnDrawLine(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
        {
            WPShapes.Line line = new WPShapes.Line();
            line.Stroke          = new SolidColorBrush(Colors[e.Data.SeriesNo]);
            line.StrokeThickness = 2;

            line.X1 = e.Data.XFrom;
            line.Y1 = e.Data.YFrom;
            line.X2 = e.Data.XTo;
            line.Y2 = e.Data.YTo;

            this.Children.Add(line);
        }
예제 #12
0
        void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
        {
            WPShapes.Line line = new WPShapes.Line();
            line.Stroke          = _brush;
            line.StrokeThickness = 2;

            line.X1 = e.Data.XFrom;
            line.Y1 = e.Data.YFrom;
            line.X2 = e.Data.XTo;
            line.Y2 = e.Data.YTo;

            this.Children.Add(line);
        }
예제 #13
0
        /// <summary>
        /// _chart_s the on draw text.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawText(object sender, Chart.DrawEventArgs <TextDrawingData> e)
        {
            TextBlock textBlock = new TextBlock {
                Foreground = Brush, Text = e.Data.Text, RenderTransform = new RotateTransform {
                    Angle = e.Data.Rotation
                }
            };

            Canvas.SetLeft(textBlock, e.Data.X);
            Canvas.SetTop(textBlock, e.Data.Y);

            this.Children.Add(textBlock);
        }
예제 #14
0
        /// <summary>
        /// _chart_s the on draw bar.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void _chart_OnDrawBar(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
        {
            using (var g = UIGraphics.GetCurrentContext())
            {
                g.SetLineWidth(1);
                Colors[e.Data.SeriesNo].SetFill();
                Colors[e.Data.SeriesNo].SetStroke();

                var rect = new CGRect((float)e.Data.XFrom, (float)e.Data.YFrom, (float)(e.Data.XTo - e.Data.XFrom), (float)(e.Data.YTo - e.Data.YFrom));
                g.AddRect(rect);

                g.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }
예제 #15
0
        /// <summary>
        /// _chart_s the on draw line.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void _chart_OnDrawLine(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
        {
            using (var g = UIGraphics.GetCurrentContext())
            {
                g.SetLineWidth(2.5F);
                Colors[e.Data.SeriesNo].SetFill();
                Colors[e.Data.SeriesNo].SetStroke();

                g.MoveTo((float)e.Data.XFrom, (float)e.Data.YFrom);
                g.AddLineToPoint((float)e.Data.XTo, (float)e.Data.YTo);

                g.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }
예제 #16
0
        /// <summary>
        /// _chart_s the on draw circle.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawCircle(object sender, Chart.DrawEventArgs <SingleDrawingData> e)
        {
            Ellipse ellipse = new Ellipse
            {
                Fill   = new SolidColorBrush(Colors[e.Data.SeriesNo]),
                Width  = e.Data.Size,
                Height = e.Data.Size
            };

            Canvas.SetLeft(ellipse, e.Data.X - (e.Data.Size / 2));
            Canvas.SetTop(ellipse, e.Data.Y - (e.Data.Size / 2));

            this.Children.Add(ellipse);
        }
예제 #17
0
        /// <summary>
        /// _chart_s the on draw line.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawLine(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
        {
            Line line = new Line
            {
                Stroke          = new SolidColorBrush(Colors[e.Data.SeriesNo]),
                StrokeThickness = 3,
                X1 = e.Data.XFrom,
                Y1 = e.Data.YFrom,
                X2 = e.Data.XTo,
                Y2 = e.Data.YTo
            };


            this.Children.Add(line);
        }
예제 #18
0
        /// <summary>
        /// _chart_s the on draw grid line.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
        {
            Line line = new Line
            {
                Stroke          = Brush,
                StrokeThickness = 1,
                X1 = e.Data.XFrom,
                Y1 = e.Data.YFrom,
                X2 = e.Data.XTo,
                Y2 = e.Data.YTo
            };


            this.Children.Add(line);
        }
예제 #19
0
        /// <summary>
        /// _chart_s the on draw pie.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawPie(object sender, Chart.DrawEventArgs <PieDrawingData> e)
        {
            double pieDegrees = 360;
            double size       = ((e.Data.X > e.Data.Y) ? e.Data.Y * 2 : e.Data.X * 2);

            for (int i = 0; i < e.Data.Percentages.Length; i++)
            {
                double value = e.Data.Percentages[i];

                Canvas.DrawArc(new RectF(0, 0, (float)size, (float)size), 0, (float)pieDegrees, true, new Paint()
                {
                    Color = Colors[i]
                });
                pieDegrees -= value;
            }
        }
예제 #20
0
        /// <summary>
        /// _chart_s the on draw pie.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void _chart_OnDrawPie(object sender, Chart.DrawEventArgs <PieDrawingData> e)
        {
            double size          = ((e.Data.X > e.Data.Y) ? e.Data.Y * 2 : e.Data.X * 2);
            double halfSize      = size / 2;
            var    previousPoint = new Point(size, halfSize); // initial perimetric point (at 0 degrees)

            double totalDegrees = 0;

            for (int i = 0; i < e.Data.Percentages.Length; i++)
            {
                var path = new Path();

                var pathFigure = new PathFigure();
                pathFigure.IsClosed   = true;
                pathFigure.StartPoint = new Point(halfSize, halfSize);

                var degrees = e.Data.Percentages[i];
                totalDegrees += degrees;
                // calculate perimetric point at totalDegrees
                double coordinateX = halfSize * Math.Cos(MathHelper.Deg2Rad(360 - totalDegrees));
                double coordinateY = halfSize * Math.Sin(MathHelper.Deg2Rad(360 - totalDegrees));

                var lineSegment = new LineSegment();
                lineSegment.Point = previousPoint;
                pathFigure.Segments.Add(lineSegment);

                previousPoint = new Point(coordinateX + halfSize, coordinateY + halfSize); // actual perimetric point (will be the previous in the next iteration)

                var arcSegment = new ArcSegment();
                arcSegment.Size           = new Size(halfSize, halfSize);
                arcSegment.Point          = previousPoint;
                arcSegment.RotationAngle  = 0;
                arcSegment.IsLargeArc     = degrees > 180 ? true : false;
                arcSegment.SweepDirection = SweepDirection.Counterclockwise;
                pathFigure.Segments.Add(arcSegment);

                var pathGeometry = new PathGeometry();
                pathGeometry.Figures = new PathFigureCollection();

                pathGeometry.Figures.Add(pathFigure);

                path.Data = pathGeometry;
                path.Fill = new SolidColorBrush(Colors[i]);

                Children.Add(path);
            }
        }
예제 #21
0
        void _chart_OnDrawPie(object sender, Chart.DrawEventArgs <Events.PieDrawingData> e)
        {
            double  size          = ((e.Data.X > e.Data.Y) ? e.Data.Y * 2 : e.Data.X * 2);
            double  halfSize      = size / 2;
            WPPoint previousPoint = new WPPoint(halfSize, 0);

            for (int i = 0; i < e.Data.Percentages.Length; i++)
            {
                double value       = e.Data.Percentages[i];
                double coordinateX = halfSize * Math.Sin(value);
                double coordinateY = halfSize * Math.Cos(value);
                Path   path        = new Path();

                PathFigure pathFigure = new PathFigure();
                pathFigure.IsClosed = true;

                pathFigure.StartPoint = new WPPoint(halfSize, halfSize);

                LineSegment lineSegment = new LineSegment();
                lineSegment.Point = previousPoint;
                pathFigure.Segments.Add(lineSegment);

                previousPoint = new WPPoint(coordinateX + halfSize, coordinateY + halfSize);

                ArcSegment arcSegment = new ArcSegment();
                arcSegment.Size           = new WPSize(halfSize, halfSize);
                arcSegment.Point          = previousPoint;
                arcSegment.RotationAngle  = 0;
                arcSegment.IsLargeArc     = value > 180 ? true : false;
                arcSegment.SweepDirection = SweepDirection.Clockwise;
                pathFigure.Segments.Add(arcSegment);

                PathGeometry pathGeometry = new PathGeometry();
                pathGeometry.Figures = new PathFigureCollection();

                pathGeometry.Figures.Add(pathFigure);

                path.Data = pathGeometry;
                path.Fill = new SolidColorBrush(Colors[i]);
                this.Children.Add(path);
            }
        }
예제 #22
0
        /// <summary>
        /// _chart_s the on draw pie.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void _chart_OnDrawPie(object sender, Chart.DrawEventArgs <PieDrawingData> e)
        {
            double totalDegrees = 0;

            for (var i = 0; i < e.Data.Percentages.Length; i++)
            {
                var degrees = e.Data.Percentages[i];
                using (var g = UIGraphics.GetCurrentContext())
                {
                    g.SetLineWidth(2);
                    Colors[i].SetFill();
                    Colors[i].SetStroke();
                    g.MoveTo((float)e.Data.X, (float)e.Data.Y);
                    g.AddArc((float)e.Data.X, (float)e.Data.Y, (float)e.Data.Size,
                             (float)MathHelper.Deg2Rad(360 - totalDegrees - degrees), (float)MathHelper.Deg2Rad(360 - totalDegrees), false);
                    g.DrawPath(CGPathDrawingMode.FillStroke);
                }

                totalDegrees += degrees;
            }
        }
예제 #23
0
 void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs <Events.DoubleDrawingData> e)
 {
     _canvas.DrawLine(e.Data.XFrom, e.Data.YFrom, e.Data.XTo, e.Data.YTo, _paint);
 }
예제 #24
0
 /// <summary>
 /// _chart_s the on draw text.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void _chart_OnDrawText(object sender, Chart.DrawEventArgs <TextDrawingData> e)
 {
     Canvas.DrawText(e.Data.Text, (float)e.Data.X, (float)e.Data.Y, Paint);
 }
예제 #25
0
        /// <summary>
        /// _chart_s the on draw text.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private static void _chart_OnDrawText(object sender, Chart.DrawEventArgs <TextDrawingData> e)
        {
            var str = new NSString(e.Data.Text);

            str.DrawString(new CGPoint((float)e.Data.X, (float)e.Data.Y), UIFont.SystemFontOfSize(12));
        }
예제 #26
0
 /// <summary>
 /// _chart_s the on draw grid line.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs <DoubleDrawingData> e)
 {
     Canvas.DrawLine((float)e.Data.XFrom, (float)e.Data.YFrom, (float)e.Data.XTo, (float)e.Data.YTo, Paint);
 }
예제 #27
0
 void _chart_OnDrawText(object sender, Chart.DrawEventArgs <Events.TextDrawingData> e)
 {
     _canvas.DrawText(e.Data.Text, e.Data.X, e.Data.Y, _paint);
 }