我正在使用图表(system.windows.forms.datavisualization.Charting.ChartArea
)构建Winforms应用程序。此图表中的系列在AxisX
上具有日期/时间,在AxisY
上具有浮动。
无论我尝试对ScaleView.MinSize
和ScaleView.MinSizeType
在AxisX
上进行什么设置,它始终可以像设置为1天一样工作
chartArea1.AxisX.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True;
chartArea1.AxisX.LabelStyle.Format = "dd MMM\nHH: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
正常工作。另外,SmallScrollSize
上的AxisX
正常工作。但是ScaleView.MinSize
为什么困扰着我? 最佳答案
该问题是由游标间隔引起的。默认情况下将其设置为1,因此我无法选择小于1(天)的时间间隔。通过将间隔更改为0.01(14.4分钟),这不再是问题。
chartArea1.CursorX.Interval = 0.01D;