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

Pie chart legend location

3 Answers 170 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 17 May 2016, 03:16 PM

Hi,

I'm trying to create a winform with a few different charts. I'm starting with the pie chart and having a couple issues.

1) I want to have the legend on the left hand side. Under ChartElement, I can see the LegendPosition and have set that to "Left" and in design time I can see it on the left. However, when I run the app it moves back over to the right side.

2) I also want to move legend closer to the pie chart. I found under ChartElement, LegendElement, PositionOffset, I can set that to 100 and it moves it closer, however because of problem 1 above it moves it off the form durning run time (it looks fine at design time).

3) It's displaying the values as percent (%), but in this case I want a hard number. How can I remove/change it from percent base?

Attached is a screen showing how I would like the final look.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 May 2016, 10:42 AM
Hello Josh,

Thank you for writing.

When I set the ChartElement.LegendPosition property to LegendPosition.Left, it is displayed as expected on my end. The ChartElement.LegendElement.PositionOffset property is also respected. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem so I can investigate the precise case? Thank you in advance. 

As to the percentage value, note that each PieDataPoint is visualized as a pie slice with arc size directly proportional to the magnitude of the raw data point’s value. That is why the value is represented as a percentage of the whole part. The LabelFormatting event is appropriate for customizing the series labels:
private PieDataPoint pieDataPoint;
private PiePointElement piePointElement;
 
private void radChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e)
{
    pieDataPoint = e.LabelElement.DataPoint as PieDataPoint;
    if (pieDataPoint != null)
    {
        e.LabelElement.Text = "Value: " + string.Format("{0:###,##0.00}", pieDataPoint.Value);
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Thomas
Top achievements
Rank 1
answered on 30 Dec 2017, 07:23 PM

I have the same problem.  I looked at the designer.cs file and there were no entries for Legend position.  It seems that the Property dialog does not update the designer correctly, at least in this case.

I ended up manually editing the designer.cs file and it works now.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Jan 2018, 08:30 AM
Hello, Thomas, 

Thank you for writing.  

The provided information is not enough for me to replicate the issue locally. The ChartElement.LegendPosition property controls the position of the legend items. If you are experiencing any difficulties with it it would be greatly appreciated if you can specify the exact steps how to reproduce the problem. Alternatively, feel free to submit a support ticket where you can provide a sample project demonstrating the issue. Thus, we would be able to make an adequate analysis of the precise case and assist you further. Thank you in advance.

Should you have further questions I would be glad to help.
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ChartView
Asked by
Josh
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or