Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 条形线已添加到图表区域,但从未显示在图表上_.net_Mschart - Fatal编程技术网

.net 条形线已添加到图表区域,但从未显示在图表上

.net 条形线已添加到图表区域,但从未显示在图表上,.net,mschart,.net,Mschart,我试着让带状线显示在一张我放在一起的图表上,但到目前为止,我根本不喜欢让它们显示出来 Public Sub AddExtraChartData(ByVal fromTime As DateTime, ByVal toTime As DateTime) ' create a background strip line for any records held within here Dim sl As New Charting.StripLine() sl.Int

我试着让带状线显示在一张我放在一起的图表上,但到目前为止,我根本不喜欢让它们显示出来

    Public Sub AddExtraChartData(ByVal fromTime As DateTime, ByVal toTime As DateTime)
    ' create a background strip line for any records held within here
    Dim sl As New Charting.StripLine()

    sl.IntervalOffset = fromTime.ToOADate()
    sl.IntervalOffsetType = Charting.DateTimeIntervalType.Minutes
    Console.WriteLine("strip_interval_offset: " + sl.IntervalOffset.ToString())

    sl.BackColor = Color.Red
    sl.StripWidth = toTime.ToOADate() - fromTime.ToOADate()

    Console.WriteLine("Length of downtime: " + sl.StripWidth.ToString())
    sl.StripWidthType = Charting.DateTimeIntervalType.Minutes

    Chart1.ChartAreas(0).AxisX.StripLines.Add(sl)

    Console.WriteLine("Strip Line Count in Chart1.ChartAreas(0): ?" + Chart1.ChartAreas(0).AxisX.StripLines.Count.ToString())

    Chart1.Invalidate()
End Sub
它应该以机器停机报告的“时间段”为单位,以经过的时间间隔显示它们,但除了图形本身之外,什么也不会显示。我的想法正确吗?如果在原始边界之外添加带状线,图表将重新缩放以显示它?还是会丢失

根据我的VS调试:

strip_interval_offset: 41493.4617361111
Length of downtime: 0.0181250000023283
Strip Line Count in Chart1.ChartAreas(0): ?5
所以他们被添加了。因为我可以删除。添加并以0结束。但是为什么它们不显示呢

其他信息。我的图表是DateTime格式的,每隔10分钟一次,XValue被编入索引以显示活动的时间间隔

非常感谢您的帮助,谢谢