Nevron Forum

How to align Data label to the right of chart?

https://www.nevron.com/Forum/Topic5012.aspx

By Jacky zhang - Friday, March 18, 2011

My problem is that the data label is variable length. but I want to keep it in the bottom right of the chart. How to align Data label to just  the right of chart?

thanks,

-Jacky

 

By Nevron Support - Friday, March 25, 2011

Is this a series data label or a NLabel panel? Usually there are more than one data labels in a chart, so this is a little bit confusing.
By Jacky zhang - Monday, March 28, 2011

It is a NLabel.
By Nevron Support - Monday, March 28, 2011

Hi Jacky,

You have to change the content alignment of the label - in this case you need top left alignment. The following code shows a label positioned at the bottom right side of the control, 5 points from the chart right and bottom edges.

NLabel label = new NLabel();
label.Text =
"Some Label Text";
label.ContentAlignment =
ContentAlignment.TopLeft;
label.Location =
new NPointL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
label.UseAutomaticSize =
true;
label.Margins =
new NMarginsL(5, 5, 5, 5);
nChartControl1.Document.RootPanel.ChildPanels.Add(label);

Hope this helps - let us know if you have any questions or comments.