We have a windows form project which used Microsoft Chart Control. The Axis X is DateTime type, Axis Y are double values.

We need zoom in/out feature and scroll feature, so we have already the following initial code:

chartAreaTrending.CursorX.Interval = 0;
chartAreaTrending.CursorY.Interval = 0;
chartAreaTrending.CursorX.IsUserSelectionEnabled = true;
chartAreaTrending.CursorY.IsUserSelectionEnabled = true;
chartAreaTrending.AxisX.ScaleView.Zoomable = true;
chartAreaTrending.AxisY.ScaleView.Zoomable = true;
chartAreaTrending.CursorX.SelectionColor = Color.DarkGray;
chartAreaTrending.CursorY.SelectionColor = Color.DarkGray;
chartAreaTrending.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
this.chartAreaTrending.AxisX.IntervalType = DateTimeIntervalType.Minutes;
this.chartAreaTrending.AxisX.LabelStyle.Format = "yyyy-MM-dd HH:mm";


But later we found the scrolling function on Axis X stuck, we could not scroll but just sometimes jumped very long step.

mschartScroll00

The problem should be from the chart area zoom, firstly we tried to add the following code about ScaleView of AxisX:

this.chartAreaTrending.AxisX.ScaleView.MinSize = 0;
this.chartAreaTrending.AxisX.ScaleView.MinSizeType = DateTimeIntervalType.Minutes;
this.chartAreaTrending.AxisY.ScaleView.MinSize = 0;

But it still did not work.

Finally we featured out we should set value for SmallScrollSize and SmallScrollSizeType.

mschartScroll01

So we need to add the following code to implement:

this.chartAreaTrending.AxisX.ScaleView.SmallScrollMinSizeType = DateTimeIntervalType.Minutes;
this.chartAreaTrending.AxisX.ScaleView.SmallScrollSizeType = DateTimeIntervalType.Minutes;
this.chartAreaTrending.AxisY.ScaleView.SmallScrollMinSize = 0.01;
this.chartAreaTrending.AxisY.ScaleView.SmallScrollSize = 0.01;

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2013 CodeEase.com Suffusion theme by Sayontan Sinha