Vb.net MSCharts最后一个轴标签隐藏

Vb.net MSCharts最后一个轴标签隐藏,vb.net,charts,asp.net-charts,Vb.net,Charts,Asp.net Charts,我正在使用MSCharts,并且正在使用轴的日期,我不禁注意到轴标签对于最后一条网格线是隐藏的。下图显示了这一点 我使用的代码是: Public Function buildXAxis(ByVal chartArea As ChartArea, ByVal min As DateTime, ByVal max As DateTime) As Axis Dim xAxis As New Axis(chartArea, AxisName.X) 'Chart Area is pass

我正在使用MSCharts,并且正在使用轴的日期,我不禁注意到轴标签对于最后一条网格线是隐藏的。下图显示了这一点

我使用的代码是:

Public Function buildXAxis(ByVal chartArea As ChartArea, ByVal min As DateTime, ByVal max As DateTime) As Axis
        Dim xAxis As New Axis(chartArea, AxisName.X) 'Chart Area is passed into the function
        With xAxis
            .Interval = 3 'This is the interval, so the next visible label should be 7/1/2013
            .IntervalType = DateTimeIntervalType.Months 
            .IntervalAutoMode = IntervalAutoMode.FixedCount
            .Maximum = max.ToOADate 'In this instance, it is 7/29/2013
            .Minimum = min.ToOADate 'In this instance, it is 1/29/2013
            .TitleAlignment = Drawing.StringAlignment.Center
            .TitleForeColor = Drawing.Color.FromArgb(129, 127, 124)
            .TextOrientation = TextOrientation.Auto
            .LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep45
            Dim xLabelStyle As New LabelStyle
            xLabelStyle.TruncatedLabels = False
            xLabelStyle.IsStaggered = False
            xLabelStyle.Format = "d"
            .LabelStyle = xLabelStyle
            .MajorGrid.LineColor = Drawing.Color.FromArgb(129, 127, 124)
            .MinorGrid.LineColor = Drawing.Color.FromArgb(129, 127, 124)
            .MajorTickMark.LineColor = Drawing.Color.FromArgb(129, 127, 124)
            .MinorTickMark.LineColor = Drawing.Color.FromArgb(129, 127, 124)
        End With
        Return xAxis
    End Function

有人知道为什么这些标签是隐藏的吗?根据代码,网格线位于正确的位置(每3个月一次),但轴标签根本不显示,事实上,这是修改此代码的唯一位置。IsEndLabelStyle.IsEndLabelVisible控制是否显示第一个和最后一个标签

我猜在你没有发布的代码中有这样的东西:

Dim chartingArea As New ChartArea
chartingArea.AxisX.LabelStyle.IsEndLabelVisible = False
您需要将其更改为true或完全删除,因为它默认为true