I have a chart with dates (strings) as X values and decimals as Y values. I want to zoom in the chart but when setting:
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
it zooms up to interval 1 on the X axis.
I want to zoom-in gradually on the axis but when i set\
chart1.ChartAreas[0].CursorX.Interval = 0.1;
(anything except 1) the labes on the X axis disappear. Can somebody help me please, i am new to the chart controls. Please excuse my ignorance. Any advice would be very grateful
Here is a piece of my code so far:
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
chart1.Series[0].IsVisibleInLegend = false;
chart1.Series[0].ChartType = SeriesChartType.Area;
DateTime sday = Convert.ToDateTime(earnings1.dataGridView1[0, 0].Value.ToString());
chart1.Series[0].XValueType = ChartValueType.String;
int i = 0;
chart1.Series[0].SmartLabelStyle.Enabled = false;
foreach (DataGridViewRow dgvr in earnings1.dataGridView1.Rows)
{
decimal testing = Convert.ToDecimal(earnings1.dataGridView1[1, i].Value);
testing = decimal.Truncate(testing);
var point = new DataPoint(i + 1, Convert.ToDouble(testing));
point.Label = testing.ToString();
point.Font = new Font("Century Gothic", 8, FontStyle.Bold);
chart1.Series[0].Points.Add(point);
chart1.Series[0].LabelAngle = -90;
chart1.Series[0].Points[i].AxisLabel = sday.ToString("dd/MM/yyyy");
sday = sday.AddDays(1);
i++;
}
I found the way to do it:
and let Visual Studio do the job for you.