How to set the position of label


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Shweta,

You can use a point series in XY scatter mode for this purpose:

   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

    NPointSeries point = new NPointSeries();
    point.Size = new NLength(0);
    chart.Series.Add(point);
    point.DataLabelStyle.Visible = true;
    point.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Center;
    point.DataLabelStyle.TextStyle.StringFormatStyle.VertAlign = Nevron.VertAlign.Center;
    point.DataLabelStyle.VertAlign = Nevron.VertAlign.Center;
    point.DataLabelStyle.Format = "<label>";
    point.UseXValues = true;
    point.Values.Add(10);
    point.XValues.Add(10);
    point.Labels.Add("Some Label");

This will display a centered label at [10,10] - you can also display labels using annotations - check out example All Examples \ Panels \ Annotations for more information... Let us know if you meet any problems.



Best Regards,
Nevron Support Team


shweta jain
shweta jain
Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)
Group: Forum Members
Posts: 16, Visits: 192
Hi
Thank you for reply,
but I don't understand after finding center point of line, how to set that point in label for change the position of label.
shweta jain
shweta jain
Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)
Group: Forum Members
Posts: 16, Visits: 192
Thank you for reply,
After calculating center point of the line then how can we set that point in label position.
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Shweta,

How do you add that label to chart? In general you simply need to calculate the center point of the line which is very simple:
C.X  = (A.X + B.X) / 2
C.Y  = (A.Y + B.Y) / 2
where A and B are the begin/end points and C is the center.

Best Regards,
Nevron Support Team


shweta jain
shweta jain
Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)
Group: Forum Members
Posts: 16, Visits: 192
Hi
I want to set the position of label in the middle of the line. I have attached image of my chart where label name "label 2" is at the top of line, How can I set the position of that label in middle of the line.
https://www.nevron.com/forum/uploads/images/eff5af95-2d94-4b26-9221-f3ea.png 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search