ScaleView.minSize在轴上具有日期/时间的图表上无法正常工作

时间:2013-01-07 11:01:42

标签: c# winforms datetime charts scaling

我正在使用图表(system.windows.forms.datavisualization.Charting.ChartArea)构建winforms应用程序。此图表中的系列在AxisX上有日期/时间,并在AxisY上浮动。 无论我在ScaleView.MinSizeScaleView.MinSizeTypeAxisX尝试什么设置,它总是像设置为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 :(得分:1)

问题是由光标间隔引起的。默认设置为1,因此我无法选择小于1(天)的间隔。通过将间隔更改为0.01(14.4分钟),这不再是一个问题。

chartArea1.CursorX.Interval = 0.01D;