Peter
Peter

Reputation: 41

ScaleView.minSize does not work properly on chart with date/time on axis

I'm building a winforms application with a chart (system.windows.forms.datavisualization.Charting.ChartArea). The series in this chart have date/time on the AxisX and float on the AxisY. No matter what settings I try for ScaleView.MinSize and ScaleView.MinSizeType on AxisX, it always works like it is set to 1 Days

        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;

AxisY with datatype float is working properly. Also SmallScrollSize on AxisX is working properly. But why is the ScaleView.MinSize troubeling me?

Upvotes: 2

Views: 2202

Answers (1)

Peter
Peter

Reputation: 41

The problem was caused by cursor interval. This is set to 1 by default, therefore I could not select a smaller interval than 1 (day). By changing the interval to 0.01 (14.4 minutes), this is no longer a problem.

chartArea1.CursorX.Interval = 0.01D;

Upvotes: 2

Related Questions