Location of the label at the center and above the point in Line Chart.

2 posts, 0 answers
  1. Yaroslav
    Yaroslav avatar
    3 posts
    Member since:
    Mar 2011

    Posted 26 Jan 2012 Link to this post

    How to place the label of Line chart top and center relative to the point?
  2. Petar Marchev
    Petar Marchev avatar
    968 posts

    Posted 31 Jan 2012 Link to this post


    Presently, there is no way to achieve this with out-of-the-box means.

    However, I can suggest a work-around for this. In a resume you will need to wait for the item labels to get populated into the chart and then you can adjust their margins. I have pasted some code below that should help you.

    public MainPage()
      this.radChart1.LayoutUpdated += this.radChart1_LayoutUpdated;
    void radChart1_LayoutUpdated(object sender, EventArgs e)
      var labelsPanel = Telerik.Windows.Controls.ChildrenOfTypeExtensions.FindChildByType<LabelsPanel>(this.radChart1);
      if (labelsPanel == null || labelsPanel.Children.Count == 0)
      this.radChart1.LayoutUpdated -= this.radChart1_LayoutUpdated;
      var first = labelsPanel.Children.First();
      var last = labelsPanel.Children.Last();
      foreach (SeriesItemLabel seriesItemLabel in labelsPanel.Children)
        if (seriesItemLabel == first || seriesItemLabel == last)
        double leftAdjustment = -(seriesItemLabel.ActualWidth / 2 + 5);
        seriesItemLabel.Margin = new Thickness(leftAdjustment, 0, 0, 0);

    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top