我正在用图表(system.windows.forms.datavisualization.Charting.ChartArea
)构建一个winforms应用程序。这个图表中的系列在AxisX
上有日期/时间,在AxisY
上有浮动。无论我在AxisX
上为ScaleView.MinSize
和ScaleView.MinSizeType
尝试什么设置,它总是像设置为1天一样工作
chartArea1.AxisX.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True;
chartArea1.AxisX.LabelStyle.Format = "dd MMMnHH:mm";
chartArea1.AxisX.ScaleView.MinSize = 0.001D;
chartArea1.AxisX.ScaleView.MinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Days;
chartArea1.AxisX.ScaleView.SizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
chartArea1.AxisX.ScaleView.SmallScrollMinSize = 15D;
chartArea1.AxisX.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea1.AxisX.ScaleView.SmallScrollSize = 15D;
chartArea1.AxisX.ScaleView.SmallScrollSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea1.AxisX2.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.False;
chartArea1.AxisX2.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Hours;
chartArea1.AxisX2.ScaleView.SmallScrollSize = 15D;
chartArea1.AxisX2.ScaleView.SmallScrollSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea1.AxisY.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True;
chartArea1.AxisY.ScaleView.MinSize = 1D;
chartArea1.AxisY.ScaleView.MinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY.ScaleView.SmallScrollSize = 1D;
chartArea1.AxisY.ScaleView.SmallScrollSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY2.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.False;
chartArea1.CursorX.IsUserEnabled = true;
chartArea1.CursorX.IsUserSelectionEnabled = true;
chartArea1.CursorY.IsUserEnabled = true;
chartArea1.CursorY.IsUserSelectionEnabled = true;
数据类型为float的 AxisY
工作正常。AxisX
上的SmallScrollSize
也工作正常。但是为什么ScaleView.MinSize
会困扰我?
光标间隔问题。默认设置为1,因此我不能选择小于1(天)的间隔。通过将间隔更改为0.01(14.4分钟),这就不再是问题了。
chartArea1.CursorX.Interval = 0.01D;