Left aligning the labels - Horizontal Stacked Bar chart

2 posts, 1 answers
  1. Arvind
    Arvind avatar
    6 posts
    Member since:
    Aug 2010

    Posted 10 Aug 2010 Link to this post

    Hi,
       I am able to display the labels outside the horizontal stacked bar.  I have attached the sceenshot of what I have developed.  The value 9000 is for the red portion and it is center aligned to it (center aligned to the red portion).  Is it possible to align it left?

    I tried the following code

    cs.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.

    StyleSeriesItemLabel.ItemLabelLocation.Outside;

     

    cs.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.

    AlignedPositions.Left;


    If I set the Aligned position as Left after setting the LabelLocation as Outside, it has no effect.

    Following is the code that I am using
    radChart1.Series.Clear();
    radChart1.IntelligentLabelsEnabled = true;
      
    ChartSeries cs = new ChartSeries(); 
    cs.Items.Add(new ChartSeriesItem(9000));
    cs.Appearance.BarWidthPercent = 30;
      
    cs.Appearance.FillStyle.MainColor = Color.Red;
    cs.Appearance.FillStyle.SecondColor = Color.Red;
    cs.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
    cs.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
    cs.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Green;
      
    cs.Type = ChartSeriesType.StackedBar100;
    radChart1.Series.Add(cs); 
    ChartSeries cs1 = new ChartSeries(); 
    cs1.Items.Add(new ChartSeriesItem(1000));
    cs1.Appearance.LabelAppearance.Visible = false;
    cs1.Appearance.FillStyle.MainColor = Color.Orange;
    cs1.Appearance.FillStyle.SecondColor = Color.Orange;
    cs1.Type = ChartSeriesType.StackedBar100;
    radChart1.Series.Add(cs1);
    radChart1.PlotArea.XAxis.Visible = Telerik.Charting.Styles.ChartAxisVisibility.False;
    radChart1.PlotArea.YAxis.Visible = Telerik.Charting.Styles.ChartAxisVisibility.False;
    radChart1.Legend.Visible = false;
    radChart1.ChartTitle.Visible = false;
    radChart1.Update();




    Regards,
    Arvind Robin Kumar.
  2. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 12 Aug 2010 Link to this post

    Hi Arvind,

    Please use TopLeft instead:

    cs.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.TopLeft
    ;

    Sincerely,
    Ves
    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top