Profile Picture

Alter font on Axis Labels

Posted By Michael Lane 13 Years Ago
Author
Message
Michael Lane
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 3, Visits: 1
I would like to increase the font size used to draw labels on the X-Axis, and perhaps make it bold as well. What properties can I use to achieve this? I have not been able to find this in the samples or documentation. Thank you.

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Michael,

You can easily modify the labels font, color etc. from the text style property which is common for all elements that display text. The following code snippet shows how to add custom labels with altered font name, size, color and additional XML formatting:

NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
chart.Series.Add(bar);

NOrdinalScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
scale.LabelStyle.TextStyle.FontStyle.Style =
FontStyle.Italic;
scale.LabelStyle.TextStyle.FontStyle.EmSize =
new NLength(13, NGraphicsUnit.Point);
scale.LabelStyle.TextStyle.FontStyle.Name =
"Tahoma";
scale.LabelStyle.TextStyle.FillStyle =
new NColorFillStyle(Color.Red);
scale.LabelStyle.TextStyle.TextFormat =
TextFormat.XML;
scale.Labels.Add(
"Label <font color = 'black'><b>One</b></font>");
scale.Labels.Add(
"Label <font color = 'black'><b>Two</b></font>");
scale.Labels.Add(
"Label <font color = 'black'><b>Three</b></font>");
scale.AutoLabels =
false;

The following links in the documentation discuss the properties of the NTextStyle object:

http://helpdotnetvision.nevron.com/Presentation_Graphics_AppearanceStyles_TextStyle_Text_Style.html

Rich text formatting is explained here:

http://helpdotnetvision.nevron.com/Presentation_Graphics_AppearanceStyles_TextStyle_XML_Formatted_Texts.html

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



Best Regards,
Nevron Support Team



Michael Lane
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 3, Visits: 1
That worked perfectly, thank you!



Similar Topics


Reading This Topic