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

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

1 Answer 49 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 23 Jun 2015, 05:11 PM

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();
                }
            }
        }

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 25 Jun 2015, 08:30 AM
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
Tags
ChartView
Asked by
Joshua
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or