Reputation:
Code snippet:
for (int i = 0; i < vals.Length -1; i++)
{
series1.Points.Add(Convert.ToDouble(vals[i]));
series1.AxisLabel = date[i];
}
This is what I have:
Whereas this is what I want (estimation of dates):
Ideally I would like the axis to start on the first day of a month and end on the last. The arrays are both the same length, and both contain strings. Anyone succeeded with this before?
The data range may be a few days, a week, several months or a year, but I need to plot a months worth of data.
I am using .net 4 charts, the kind that come bundled with visual studio.
Upvotes: 1
Views: 6083
Reputation:
for (int i = 0; i < vals.Length -1; i++)
{
series1.Points.Add(Convert.ToDouble(vals[i]));
series1.AxisLabel = date[i];
}
//replace this
for (int i = 0; i < vals.Length -1; i++)
{
series1.Points.AddXY(Convert.ToString(date[i]), Convert.ToDouble(vals[i]));
}
series1.AxisLabel = date[0];
//with this
This plots a chart with points placed above (although slightly off centre) the relevant date points. Hope it helps someone.
Upvotes: 2