Opne Lines in Polar View

2 posts, 0 answers
  1. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 18 Oct Link to this post

    Hi,

    is possible to draw open line serie in polar chart as wpf version?

    http://www.telerik.com/forums/polarseries-closed-line

     

    Thanks, marc.

  2. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 19 Oct Link to this post

    Hello Marcello,

    Thank you for writing.

    This can be achieved by using a custom renderer. It will allow you to override the function that creates the graphics path:
    class MyRenderer : PolarRenderer
    {
        public MyRenderer(PolarArea area) : base(area)
        { }
        protected override void Initialize()
        {
            base.Initialize();
            for (int i = 0; i < this.DrawParts.Count; i++)
            {
                PolarLineSeriesDrawPart linePart = this.DrawParts[i] as PolarLineSeriesDrawPart;
                if (linePart != null)
                {
                    this.DrawParts[i] = new CustomLineSeriesDrawPart((PolarLineSeries)linePart.Element, this);
                }
            }
        }
    }
     
    internal class CustomLineSeriesDrawPart : PolarLineSeriesDrawPart
    {
        public CustomLineSeriesDrawPart(PolarLineSeries series, IChartRenderer renderer) : base(series, renderer)
        { }
     
      
        protected override GraphicsPath GetLinePath()
        {
            PointF[] points = GetPointsPositionsArray();
            GraphicsPath path = new GraphicsPath();
            if (points.Length >2)
            {
                path.AddLines(points);
                return path;
            }
            return base.GetLinePath();
        }
    }

    To change the default renderer use the: 
    void radChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e)
    {
        e.Renderer = new MyRenderer(e.Area as PolarArea);
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top