Link to home
Start Free TrialLog in
Avatar of BROOKLYN1950
BROOKLYN1950Flag for United States of America

asked on

Graphing Time Values

Hello,

      I am using Visual Studio Express 2012 and am trying to develop something using the chart control in combination with an Access 2007 database.
      Basically I am having someone enter time values in ‘h:mm’ format (the hours do not reset at 12 or 24, they continue to as high as the data type will allow). I’m storing this data in the database. The table that keeps this data also keeps normal integer/decimal values, so I have it formatted as a ‘Double’ number field.
      The way I store time in the database is I convert ‘1:24’ to ‘1.24’. I basically use this formula ‘Decimal = Hours + (Minutes / 100)’. When I want to display the numbers as text, I have a special custom function convert it back to ‘h:mm’ format.
      The problem comes in when I need to graph the time. I need it to be scaled by number of hours, (i.e. 1:01 can’t be graphed as 61) and I need to be able to read the value back off the chart and convert it into a string again. Because of this, I can’t use the actual decimal for of the number (i.e. 1:01 = 1.01666…) since the number ends up being cut off or rounded automatically by VB, and so when I try to convert it back, 1:01 becomes 1:00 (or was it 1:02, either way you should get the point).
      So I need a way to be able to put data on the chart which will graph correctly, which can also be read of the chart and converted back to a string in ‘h:mm’ format. Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4913559
Member_2_4913559
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BROOKLYN1950

ASKER

That might be the best option, but is there anyway I can get the Y axis to to display the number of hours as the unit instead of the number of minutes?
I have made it so that the database stores the time values as minutes, but I still need to know how I can get the Y axis to display the number of hours instead of minutes, even if I half to make the axis labels manualy
Though this wasn't the solution to the entire problem, I ended up leaving the axis to display minutes anyway (since I couldn't figure out how to do it any other way). So since this is what I actually ended up doing in the end, I figured it deserved to be given credit.