I have a winform with charts in it, in my code I have already set:
//Enable range selection and zooming end user interface
this.chart1.ChartAreas["ChartArea1"].CursorX.IsUserEnabled = true;
this.chart1.ChartAreas["ChartArea1"].CursorY.IsUserEnabled = true;
this.chart1.ChartAreas["ChartArea1"].CursorX.IsUserSelectionEnabled = true;
this.chart1.ChartAreas["ChartArea1"].CursorY.IsUserSelectionEnabled = true;
this.chart1.ChartAreas["ChartArea1"].AxisX.ScaleView.Zoomable = true;
this.chart1.ChartAreas["ChartArea1"].AxisY.ScaleView.Zoomable = true;
this.chart1.ChartAreas["ChartArea1"].AxisX.ScrollBar.IsPositionedInside = true;
this.chart1.ChartAreas["ChartArea1"].AxisY.ScrollBar.IsPositionedInside = true;
It zooms upon selection. However, my selections are limited to the gridlines. Moreover, upon selection, there is a red cross, the cross only stays at a fixed x-axis value. How can I modify such the selection does not limit to gridlines/ specific fixed x-axis value?
I have also set the x-axis type to date time, ie
this.chart1.Series[chanName].XValueType = ChartValueType.DateTime;
However, the x-axis only shows the date, but not time. How can I show both date and time on the x-axis? Thanks!
You can show both date and time on the x-axis by setting the LabelStyle.Format Property.
this.chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "g";
You need to set the CursorX.Interval Property. Its default value is 1.0.
this.chart1.ChartAreas["ChartArea1"].CursorX.Interval = 1 / 24.0 / 60.0; // 1 minute
Also you can set the AxisX.ScaleView.MinSize Property to limit selection. Its default value is notset.
this.chart1.ChartAreas["ChartArea1"].AxisX.ScaleView.MinSize = 1 / 24.0 / 60.0;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.