0
Answer

time as X axis of graph, visual studio 2012

eagle canete

eagle canete

11y
1.7k
1
Good day everyone.

I am having little problems in my windows form program in visual studio.
I want to generate a graph where the x axis is in terms of minutes or hours, because I want to have 
readings every 5 mins. I am able to generate the graph but its x axis is in terms of date, and no matter
what I do, I was still not able to change it to minutes. 
As a summary, I want a program where my readings will be inputted first, then my graph will be 
displayed after all the readings have been inputted, and the x axis of the graph should be in minutes and should
have intervals of 5 mins. please HELP me. PLEASE. 

for experimenting, i made this program for just a few input so that it wont be tiring when i run it. Here's my code. I am just a beginner and I don't fully understand the c# language .

public void button1_Click(object sender, EventArgs e)
{
int[] dataInputs = new int[5];
dataInputs[0] = int.parse(textbox4.text);
dataInputs[1] = int.parse(textbox5.text)
dataInputs[2] = int.parse(textbox6.text);
dataInputs[3] = int.parse(textbox7.text);
dataInputs[4] = int.parse(textbox8.text);
chart1.Series["Series1"].Charttype = System.Windows. . .  SeriesChartType.Spline;
chart1.chartArea[0].AxisX.IntervalType = System.Windows . . . DateTimeIntervalType.Days;
chart1.chartArea[0].AxisX.Interval =  1;
chart1.chartArea[0].AxisX.Maximum = dataInputs.Length;
chart1.Series["Series1"].XValueType = System.Windows . . . chartValueType.Date;
chart1.Series["Series1"].Points.AddY(dataInputs[0]);
chart1.Series["Series1"].Points.AddY(dataInputs[1]);
chart1.Series["Series1"].Points.AddY(dataInputs[2]);
chart1.Series["Series1"].Points.AddY(dataInputs[3);
chart1.Series["Series1"].Points.AddY(dataInputs[4]);

}

the output of this code is a graph where the x axis is in days. I would like to have the minutes. where there is 5 min interval.