I'm using the following code to allow my parts of chart to be selected and zoomed:
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
chart1.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;
chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
chart1.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = true;
It works for a chart with both x and y axes of the type Integer.
But when I set the series value type to series1.XValueType = ChartValueType.Time;
, I won't be able to zoom in the x-axis.
When I set both axes value types for auto and add points using, for example, chart1.Series[0].Points.AddXY(DateTime.Now.ToLongTimeString(), rand.Next(10, 20));
, then the zoom works.
How can I have my x-axis to be a Time and still be able to zoom?
: (of a person) to adjust the lens of a camera or (of a camera) to adjust its lens so that the image seems to be bigger and closer —often + on I zoomed in on her face to show her reaction. The TV cameras zoomed in on the winner's face.
(zum) 1. to move quickly or suddenly with a loud humming or buzzing sound. 2. to fly a plane suddenly and sharply upward at great speed for a short distance. 3. to move or go rapidly. 4. to bring a photographic subject, movie scene, etc., into closeup or cause it to recede by using a zoom lens (often fol.
to (cause a camera or computer to) make the image of something or someone appear much larger and nearer, or much smaller and further away: At the beginning of the film, the camera zooms in to show two people sitting by the side of a river. Click on a photo of any student, and it zooms out to full-size.
When zooming in, the narrator guides the reader in following a point of view. A conventional use of the technique might first create in the reader's mind a bird's eye view, or aerial shot, of the setting .
You need to set the Interval on the Cursor by default it is 1.0, I had the problem with percentages so I set my interval to 0.01 e.g 1% as shown below. You want want to set IntervalType on the Cursor as this accepts datetime types.
chart1.ChartAreas[0].CursorX.Interval = 0.01
More info at http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.cursor.interval%28v=vs.100%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With