This is a migrated thread and some comments may be shown as answers.

Opne Lines in Polar View

1 Answer 63 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Marcello
Top achievements
Rank 1
Iron
Marcello asked on 18 Oct 2016, 11:20 AM

Hi,

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

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

 

Thanks, marc.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 19 Oct 2016, 09:19 AM
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.
Tags
ChartView
Asked by
Marcello
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Share this question
or