Labeling the group

4 posts, 0 answers
  1. Gifer
    Gifer avatar
    11 posts
    Member since:
    Oct 2010

    Posted 18 Nov 2010 Link to this post

    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
  2. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 22 Nov 2010 Link to this post

    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
  3. Gifer
    Gifer avatar
    11 posts
    Member since:
    Oct 2010

    Posted 22 Nov 2010 Link to this post

    Thank you. However I really need to show the group labels on the left side of the chart
  4. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 26 Nov 2010 Link to this post

    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
Back to Top