gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 02:50:10 25 4
gpt4 key购买 nike

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

Broken Chart Axis

我为此使用的代码是:

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 个月)但轴标签根本不显示,实际上这是唯一修改此代码的地方

最佳答案

LabelStyle.IsEndLabelVisible 控制是否显示第一个和最后一个标签。

Here is the MSDN entry.

我猜你没有发布的代码中的某处是这样的:

Dim chartingArea As New ChartArea
chartingArea.AxisX.LabelStyle.IsEndLabelVisible = False

您需要将其更改为 true 或完全删除它,因为它默认为 true。

关于vb.net - MSCharts 最后一个轴标签隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17926401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com