Reputation: 257
Every minute, I get a temperature from 6 sensors in my greenhouse. I store this values in a multidimensional array. grh1[x,0],grh1[x,1],grh1[x,2],grh1[x,3],grh1[x,4],grh1[x,5] My quetion is: how use this array to put every minute data in the Chart Control Line and the X axis in HH:mm format like this 00:00 00:01 00:02 (this is running time, not system time). Thank in advance, ocaccy
Upvotes: 0
Views: 603
Reputation: 965
Do you store the "start date/time" somewhere to use it together with the array index X as offset? For example, if you store DateTime dateStart = DateTime.Now, before starting to read the sensor every minute, you know that x=0 means dateStart, x=1 means dateStart.AddMinutes(1), x=2 means dateStart.AddMinutes(2), etc.
Then when binding the values you simply take the index "x" and convert it back into date time and then format it like this:
string labelX = dateStart.AddMinutes(x).ToString("HH:mm");
Upvotes: 1