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

Legend Labeling

3 Answers 82 Views
Chart
This is a migrated thread and some comments may be shown as answers.
cmr
Top achievements
Rank 1
cmr asked on 18 Jun 2010, 04:00 PM
Within the chart legend, I would like to add a summary total for all the series mapping totals such as Girls [SeriesMapping 1], Boys [SeriesMapping 2], and Total.  The total should be positioned below all the legend labels. 

  1. The first attempt was to create a Total SeriesMapping; however, the chart plot sets aside space to occupy this data for the BarSeriesDefinition chart type, which is not being set, and the label within the legend was erratically being placed in different positions.
  2. The second attempt was to add a ChartLegendItem with the "Total" label to the radChart1.DefaultView.ChartLegend.Items which results in the "Total" summary displayed above the rest of the legend labels.

Any ideas?

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 24 Jun 2010, 01:07 PM
Hi cmr,

If you need to explicitly create legend items, set the value of the property UseAutoGeneratedItems to False and manually add the items which you need to the chart legend, as in the following sample :

<chart:ChartDefaultView.ChartLegend>
                    <chart:ChartLegend x:Name="chartLegend"                                         
                                            UseAutoGeneratedItems="False">
                        <chart:ChartLegend.Items>
                            <chart:ChartLegendItem Background="Red"
                                                        Label="Girls" />
                            <chart:ChartLegendItem Background="Blue"
                                                        Label="Boys" />
                            <chart:ChartLegendItem Background="Green"
                                                        Label="Total" />
                        </chart:ChartLegend.Items>
                    </chart:ChartLegend>
                </chart:ChartDefaultView.ChartLegend>

For more information on Chart Legend, please, refer to this help topic. Perhaps this blogpost would also be useful for you.

Sincerely yours,
Nikolay
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Przemyslaw
Top achievements
Rank 1
answered on 20 Jul 2010, 02:49 PM
Hi,

My problem is similar. I display a number of series. I want to override the legend names and preserve the default coloring. When I set the UseAutoGeneratedItems to False and add ChartLegendItems then the colors for my series stop matching the colors in the legend. How to programatically just change the legend names?

Przemek
0
Giuseppe
Telerik team
answered on 21 Jul 2010, 03:56 PM
Hi Przemyslaw,

You can set the desired legend label for each series via the respective DataSeries.LegendLabel property (if you are building your series manually) or via the respective SeriesMapping.LegendLabel property (if you are using the chart databinding feature).

Hope this helps.


All the best,
Freddie
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
cmr
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Przemyslaw
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or