asp.net 图表:在 X 轴上添加了额外的点(刻度线)

asp.net Charts : Extra point(Tick Mark) added on X Axis

我是 Asp.net 图表的新手,正在开发一个如下所示的折线图:

X轴部分代码为:(代码中添加注释)

    Chart1.ChartAreas(0).AxisX.Title = "Age"
    Chart1.ChartAreas(0).AxisX.LineWidth = 2
    Chart1.ChartAreas(0).AxisX.Interval = 1
    'Turn off X-axis lines
    Chart1.ChartAreas(0).AxisX.MajorGrid.Enabled = False
    ' Enable X axis margin
    Chart1.ChartAreas(0).AxisX.IsMarginVisible = True
    Chart1.ChartAreas(0).AxisX.IsStartedFromZero = True
    Chart1.ChartAreas(0).AxisX.IsStartedFromZero = False


    Chart1.ChartAreas(0).AxisX.LabelStyle.Angle = -60
    Chart1.ChartAreas(0).AxisX.LabelStyle.Font = New Drawing.Font("Arial", 8, Drawing.FontStyle.Bold)
    Chart1.ChartAreas(0).AxisX.MajorTickMark.Enabled = False
    Chart1.ChartAreas(0).AxisX.IsStartedFromZero = True


    'age() is array of Ages 
    'Estimated is array of estimated values in Dollars
    'Real is array of real values in Dollars
    s.ChartType = SeriesChartType.Line
    g.ChartType = SeriesChartType.Line
    s.BorderWidth = 2
    g.BorderWidth = 2

    Dim count As Integer = 0
    'Finding the interval for X Axis
    'Value of maxAge is 95 and myAge 55
    Dim interval = (maxAge - myAge) / 10 '
    Chart1.ChartAreas(0).AxisX.Minimum = myAge
    'interval value is 4
    Chart1.ChartAreas(0).AxisX.Interval = interval

    'To start the graph from origin

    g.Points.AddXY(Convert.ToInt32(myAge), 0)
    s.Points.AddXY(Convert.ToInt32(myAge), 0)
    'Adding the label for origin
    Chart1.ChartAreas(0).AxisX.CustomLabels.Add(myAge - 1, myAge + 1, "Age " & myAge & " ")
    count = 0
    'This loop runs from 55 to 95 of age() Array
    For i = 1 To 10
        count += interval
        s.Points.AddXY(age(count), Estimated(count))
        g.Points.AddXY(age(count), Real(count))
        Chart1.ChartAreas(0).AxisX.CustomLabels.Add(age(count) - 0.3, age(count), "Age " & age(count) & " ")
    Next i
    Chart1.Series.Add(s)
    Chart1.Series.Add(g)

这段代码的输出是

问题是,虽然我的循环正好运行了 10 次,但在 X 轴上添加了一个额外的刻度线。

所以我的问题是

有没有办法将图表限制在最后一个刻度线,而不是多跳几步?

提前致谢

我是 asp.net 图表的新手,因此犯了这个愚蠢的错误。

我只需要设置

 Chart1.ChartAreas(0).AxisX.Maximum = maxAge 

宾果游戏成功了!该图表仅限于 95 岁的刻度线。