Click here to Skip to main content
11,578,524 members (60,111 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Excel General
Hello all, In a project I'm working currently, I have to plot a graph against time.
The time is in the format : hh:mm:ss like 21:00:05, 21:03:09, 21:15:06, 21:15:55, 22:15:06, 22:15:55

Now my manager wants me to start the time at a whole number, that is make the initial time to start at 21:00:00 , and increment it in such a way that the next number is a whole number 21:05:00.

ex: 21:00:00, 21:15:00, 21:30:00, 21:45:00, 22:00:00

Also not always the time will start at 21:03:05. What ever time it starts, I must make that in an order.

Need help please..


I have included C++ in tags, because I can change these values pro grammatically before displaying in excel. I'm not sure weather to use the number representation of time to calculate or the general or the time itself...
Posted 28-Jun-12 22:03pm
Edited 28-Jun-12 22:34pm
v5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use various formulae to extract just the hours or minutes from the time and use that as the starting point for your sequence. You did not make it clear how much of this you are implementing by C++ program and how much will be done directly in the spreadsheet.
  Permalink  
Comments
Member 8446342 at 29-Jun-12 6:01am
   
I display the time from my C++ programming into an excel sheet. Now I work with this to produce the excel graph. I do not get much response if its excel. should I take off the c++ tag ?
Richard MacCutchan at 29-Jun-12 6:06am
   
Creating graphs in Excel is more or less automatic; I'm not sure what help you are asking for, but it does not sound like it's C++.

Member 8446342 at 29-Jun-12 6:14am
   
But v can always format the axis. An that is what I'm trying to do..formatting the x-axis containing the time...
Richard MacCutchan at 29-Jun-12 6:17am
   
Sorry that is still not clear. As I said this is mostly automatic in Excel, you just create a set of values and the chart wizard puts them in the right place. Try a Google search for "excel chart" and see if you can get some samples that will help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In the chart under Axis option, change the time format to general.

1)Make minimum value equal to 0.041666667 (Actual representation of the time hour:01)If the time starts at some other time say 3 or 5 'o clock, then multiply this 3 or 5 with the minimum value to get the starting value.

2)Make major value to be 0.03472222 , this is the 5 minutes interval.
(1 sec = 0.006944444)

this gives the series with defined interval.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Peter Leow 135
1 OriginalGriff 113
2 Richard MacCutchan 85
3 Afzaal Ahmad Zeeshan 75
4 Frankie-C 75
0 OriginalGriff 933
1 Sergey Alexandrovich Kryukov 740
2 Abhinav S 573
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 403


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 29 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100