Placing a bel with a no in line chart

4 posts, 0 answers
  1. harini
    harini avatar
    5 posts
    Member since:
    Oct 2008

    Posted 07 Oct 2008 Link to this post

    Hi,

    I am using a line chart. I need to place a label at the right or the left of the points in the lines of the chart. I need the label to carry some numeric values like 10, 20 etc. I wrote the foll lines of code for it.

    painChart.Series[0].Appearance.LabelAppearance.Position.AlignedPosition =

    AlignedPositions.Right;

     

    painChart.Series[0].Appearance.LabelAppearance.LabelLocation =

    StyleSeriesItemLabel.ItemLabelLocation.Inside;

    But no labels appear and I dont know how to set the numeric value to the label.

    Kindly let me know the code as to how to place the labels with the numeric values at the right or left of the points in a line chart.



    Thanks in advance,
    Harini

     

  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 08 Oct 2008 Link to this post

    Hi Harini,

    Here is a sample code, that customizes the labels and places them using the code provided in your post.
    I've created a new project and added a single RadChart to the form, that is why I'm providing only the necessary code (from the Form1.cs file):
    Evtim
  3. UI for WinForms is Visual Studio 2017 Ready
  4. harini
    harini avatar
    5 posts
    Member since:
    Oct 2008

    Posted 10 Oct 2008 Link to this post

    thanks.

    But I am unable to see ur sample code. hv u attached them somewhere? kindly guide me as to how I can view ur sample code coz i dont seem to be able to see them.

    Thanks,
    Harini
  5. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 13 Oct 2008 Link to this post

    Hi harini,

    Sorry for the inconvinience, there seems to be some issues with our supporting system. Here is the code:

    public Form3() 
        InitializeComponent(); 
     
        this.radChart1.Series.Add(new ChartSeries()); 
        this.radChart1.Series[0].Type = Telerik.Charting.ChartSeriesType.Line; 
        this.radChart1.Series[0].Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Right; 
        this.radChart1.Series[0].Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside; 
     
        Random r = new Random(); 
     
        for (int i = 0; i < 20; i++) 
        { 
            ChartSeriesItem item = new ChartSeriesItem(); 
            item.YValue = r.Next(0, 100); 
     
            this.radChart1.Series[0].Items.Add(item); 
        } 
     

    Best regards,
    Evtim
Back to Top