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

Labeling the group

3 Answers 54 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Gifer
Top achievements
Rank 1
Gifer asked on 18 Nov 2010, 08:00 AM
I have a horizontal bar chart that is grouped by x-category. I would like to show the labels for the group and not for each bar repeating the label twice. See the attach for reference.

Thank you

3 Answers, 1 is accepted

Sort by
0
Evgeni "Zammy" Petrov
Telerik team
answered on 22 Nov 2010, 05:21 PM
Hello Gifer,

 I would suggest you to try using HorizontalStackedBarSeriesDefinition.
Creating two series mapping and StackGroupName to set a label. 
Here is a code snippet:

SeriesMapping seriesMapping = new SeriesMapping();
 
seriesMapping.ItemMappings.Add(new ItemMapping("AmountExport", DataPointMember.YValue));
seriesMapping.ItemMappings.Add(new ItemMapping("CategoryOfFruit", DataPointMember.XCategory));
 
seriesMapping.SeriesDefinition = new HorizontalStackedBarSeriesDefinition()
    {
        StackGroupName = "Export"
    };
RC1.SeriesMappings.Add(seriesMapping);
 
seriesMapping = new SeriesMapping();
seriesMapping.ItemMappings.Add(new ItemMapping("AmountImport", DataPointMember.YValue));
seriesMapping.ItemMappings.Add(new ItemMapping("CategoryOfFruit", DataPointMember.XCategory));
 
seriesMapping.SeriesDefinition = new HorizontalStackedBarSeriesDefinition()
{
    StackGroupName = "Import"
};
RC1.SeriesMappings.Add(seriesMapping);

This creates a similar effect to the one you are looking. Unfortunately the label is on the left side of the grouping. I have attached an image of the result.

Best wishes,
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Gifer
Top achievements
Rank 1
answered on 22 Nov 2010, 08:53 PM
Thank you. However I really need to show the group labels on the left side of the chart
0
Evgeni "Zammy" Petrov
Telerik team
answered on 26 Nov 2010, 07:40 AM
Hello Gifer,

At present, we do not support this case. 

I would suggest that you enable labels only on one of the series and hide for the other. This will not work very well if the data point for the series with a label has much smaller value compared to the one without label.

Kind regards,
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Gifer
Top achievements
Rank 1
Answers by
Evgeni "Zammy" Petrov
Telerik team
Gifer
Top achievements
Rank 1
Share this question
or