How to properly set font for x and y axis


Author
Message
Devin Ellis
Devin Ellis
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 9, Visits: 87
I have two methods used on my charts for setting the fonts
Most of the charts use SetupChartAxes and some use 
SetXAxisLabels (sorry but you have no code insert 
and when I pasted the code formatting was remove). The SetXAxisLabels is set to bold and the chart below uses that
but the labels do not come out bold. Why is that?


Images

https://www.nevron.com/forum/uploads/images/ac25ea03-b296-41eb-93c5-4582.png






Code


Snippetpublic virtual void SetupChartAxes ( NChart chart Wink{    if ( chart == null Wink        throw new ArgumentNullException ( "chart required" Wink;     var scaleY = new NLinearScaleConfigurator ();    if ( scaleY == null Wink        throw new NullReferenceException ( "Failed to create y axis" Wink;     scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;    scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType [] { ChartWallType.Back };    scaleY.InnerMajorTickStyle.Visible = false;     scaleY.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleY.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleY.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName;     chart.Axis ( StandardAxis.PrimaryY Wink.ScaleConfigurator = scaleY;     var scaleX = new NLinearScaleConfigurator ();    if ( scaleX == null Wink        throw new NullReferenceException ( "Failed to create x axis" Wink;     scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;    scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType [] { ChartWallType.Back };    scaleX.InnerMajorTickStyle.Visible = false;     scaleX.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleX.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleX.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName;     chart.Axis ( StandardAxis.PrimaryX Wink.ScaleConfigurator = scaleX;} public virtual void SetXAxisLabels ( NChart chart Wink{    if ( chart == null Wink        throw new ArgumentNullException ( "chart required" Wink;     // add scale to chart    // hide axis ruler, ticks and automatic labels    var scaleX = new NDateTimeScaleConfigurator ();    if ( scaleX == null Wink        throw new NullReferenceException ( "Failed to create x axis" Wink;     chart.Axis ( StandardAxis.PrimaryX Wink.ScaleConfigurator = scaleX;     scaleX.AutoLabels = false;    scaleX.UseOrigin = false;     scaleX.RulerStyle.BorderStyle.Width = new NLength ( 1 Wink;    scaleX.OuterMajorTickStyle.Length = new NLength ( 5 Wink;    scaleX.InnerMajorTickStyle.Length = new NLength ( 0 Wink;     scaleX.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleX.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleX.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName; }



Reply
Devin Ellis
Devin Ellis
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 9, Visits: 87
I had this in my original message:

(sorry but you have no code insert 
and when I pasted the code formatting was remove).

So I guess we just hit the cancel button to not format.
I thought the cancel would cancel the insert.

Snippet
public virtual void SetupChartAxes ( NChart chart Wink{    if ( chart == null Wink        throw new ArgumentNullException ( "chart required" Wink;      var scaleY = new NLinearScaleConfigurator ();    if ( scaleY == null Wink        throw new NullReferenceException ( "Failed to create y axis" Wink;     scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;    scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType [] { ChartWallType.Back };    scaleY.InnerMajorTickStyle.Visible = false;     scaleY.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleY.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleY.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName;     chart.Axis ( StandardAxis.PrimaryY Wink.ScaleConfigurator = scaleY;      var scaleX = new NLinearScaleConfigurator ();    if ( scaleX == null Wink        throw new NullReferenceException ( "Failed to create x axis" Wink;      scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;    scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType [] { ChartWallType.Back };    scaleX.InnerMajorTickStyle.Visible = false;     scaleX.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleX.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleX.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName;      chart.Axis ( StandardAxis.PrimaryX Wink.ScaleConfigurator = scaleX;}  public virtual void SetXAxisLabels ( NChart chart Wink{    if ( chart == null Wink        throw new ArgumentNullException ( "chart required" Wink;      // add scale to chart    // hide axis ruler, ticks and automatic labels    var scaleX = new NDateTimeScaleConfigurator ();    if ( scaleX == null Wink        throw new NullReferenceException ( "Failed to create x axis" Wink;     chart.Axis ( StandardAxis.PrimaryX Wink.ScaleConfigurator = scaleX;     scaleX.AutoLabels = false;    scaleX.UseOrigin = false;     scaleX.RulerStyle.BorderStyle.Width = new NLength ( 1 Wink;    scaleX.OuterMajorTickStyle.Length = new NLength ( 5 Wink;    scaleX.InnerMajorTickStyle.Length = new NLength ( 0 Wink;     scaleX.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold;    scaleX.LabelStyle.TextStyle.FontStyle.EmSize = new NLength ( DefaultFontSize, NGraphicsUnit.Point Wink;    scaleX.LabelStyle.TextStyle.FontStyle.Name = DefaultFontName; }
With the Cancel its just one line. Can you add a code insert to the "+ Insert".
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