【发布时间】:2013-07-29 14:16:18
【问题描述】:
我正在使用 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 个月)但轴标签根本不显示,这实际上是唯一修改此代码的地方
【问题讨论】:
标签: vb.net charts asp.net-charts