Profile Picture

Changing color and width of Major Gridlines

Posted By Benjamin Haas 14 Years Ago
Author
Message
Benjamin Haas
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
Posts: 0, Visits: 1
Hello again, and thank you for your help yesterday with changing Legend size.

Today I am working with a Cartesian chart, and attempting to change the color and width of the major gridlines. I am attempting to follow the documentation (http://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_ScaleConfigurators_Major_and_Minor_Gridlines.html), but am not having any luck. Here is my code:

Dim yAxis As NAxis = chart7.Axis(StandardAxis.PrimaryY)
Dim scaleConfiguratorY As NStandardScaleConfigurator = yAxis.ScaleConfigurator
scaleConfiguratorY.MajorTickMode = MajorTickMode.AutoMaxCount
scaleConfiguratorY.AutoLabels = False
scaleConfiguratorY.MajorGridStyle.SetShowAtWall(ChartWallType.Back, True)
scaleConfiguratorY.MajorGridStyle.LineStyle.Color = Color.Red
scaleConfiguratorY.MajorGridStyle.LineStyle.Width = New NLength(5)

However, the color and width of the major gridlines do not change, no matter the values that I use. Note, these gridlines do not fall inside a scale section. Would you happen to have any suggestions?

Thanks,
Ben


Nevron Support
Posted 14 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 Ben,

The code works correctly - most likely you override the scale configurator later in the code. Placing your code in an empty form load works OK:

Imports Nevron.GraphicsCore
Imports Nevron.Chart

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim chart As NChart = NChartControl1.Charts(0)

        Dim yAxis As NAxis = chart.Axis(StandardAxis.PrimaryY)
        Dim scaleConfiguratorY As NStandardScaleConfigurator = yAxis.ScaleConfigurator
        scaleConfiguratorY.MajorTickMode = MajorTickMode.AutoMaxCount
        scaleConfiguratorY.AutoLabels = False
        scaleConfiguratorY.MajorGridStyle.SetShowAtWall(ChartWallType.Back, True)
        scaleConfiguratorY.MajorGridStyle.LineStyle.Color = Color.Red
        scaleConfiguratorY.MajorGridStyle.LineStyle.Width = New NLength(5)

        Dim bar As New NBarSeries
        bar.Values.Add(10)
        bar.Values.Add(20)
        chart.Series.Add(bar)
    End Sub
End Class

Please check whether you have code like:
yAxis=someScaleConfigurator

later in the code. Also is the axis itself visible?

 



Best Regards,
Nevron Support Team



Benjamin Haas
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
Posts: 0, Visits: 1
Thanks again for your help. You are indeed correct, I found code that was applying NStyleSheet code after the fact (debugging someone else's uncommented code is always such fun!).

Best regards,
Ben



Similar Topics


Reading This Topic