Pie Chart render hangs when ShowSmartLables = true and all values in the series are 0

2 posts, 0 answers
  1. Joshua
    Joshua avatar
    3 posts
    Member since:
    Jul 2011

    Posted 23 Jun 2015 Link to this post

    I'm using v2015.1.331.40 and if the series I feed my pie chart has 0 for all values AND I have ShowSmartLables = true, then my code just hangs when it tries to render the chart. 

     

    private static void ThisChartHangs()
            {
                Telerik.WinControls.UI.RadChartView chart = null;

                try
                {
                    chart = new Telerik.WinControls.UI.RadChartView();
                    chart.AreaType = Telerik.WinControls.UI.ChartAreaType.Pie;

                    chart.Width = 360;
                    chart.Height = 360;
                    chart.ShowSmartLabels = true;

                    var series = new Telerik.WinControls.UI.PieSeries();
                    
                    for (int x = 0; x < 8; x++)
                    {
                        series.DataPoints.Add(new Telerik.Charting.PieDataPoint(0.0, "Type " + x.ToString()));
                    }

                    chart.Series.Add(series);

                    using (var bmp = new System.Drawing.Bitmap(chart.ClientSize.Width, chart.ClientSize.Height))
                    {
                        chart.DrawToBitmap(bmp, chart.Bounds);

                        using (var stream = new System.IO.FileStream(@"c:\temp\NeverRenders.png", System.IO.FileMode.Create, System.IO.FileAccess.Write))
                        {
                            bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
                finally
                {
                    if (chart != null)
                    {
                        foreach (var series in chart.Series)
                        {
                            series.DataPoints.Clear();
                        }

                        chart.Dispose();
                    }
                }
            }

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 25 Jun 2015 Link to this post

    Hello Joshua,

    Thank you for writing.

    Indeed this appears to be an issue within the rendering mechanism of RadChartView. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item. I have also updated your Telerik points.

    We are going to need additional time to completely investigate the issue and come up with a solution how such a scenario should be handled. For the time being you would need to set the ShowSmartLabels property to false if all of your data points have zero as value.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top