Categories > OpenTBS general MsOffice >

Chart with dates

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: George
Date: 2013-12-19
Time: 15:08

Chart with dates

Dear friends

I had a problems with charts when I tried to add data in the form of date.

I would like to contribute by sharing the solution to the community and if you want it would be useful to add it to the documentation :

Dates have to be converted to number in excel before added to the charts by OPEN TBS
By: Skrol29
Date: 2013-12-20
Time: 01:23

Re: Chart with dates

Hi George,

Thanks for this tip.
Can you explain how you convert dates to numbers in Excel ?
By: George
Date: 2013-12-20
Time: 08:25

Re: Chart with dates

Hi Skrol29,

For example if you have a date in an excel cell (e.g. 2/3/2014) and you want to create a chart. You have to convert it to number by doing right click->Format cells->Number and the cell will be converted into something like 41700. This is the correct  for a diagram. If you put 2/3/2014 it does not work
By: Skrol29
Date: 2013-12-20
Time: 17:05

Re: Chart with dates

Do you mean date must be converted in the template, or at the PHP side when using $TBS->PlugIn(OPENTBS_CHART, ...) ?
By: George
Date: 2013-12-20
Time: 17:23

Re: Chart with dates

The template can have a chart drawn. And if you want to use data in the form of date there you can. But if you try to change the data displayed via php you will not be able to do it UNLESS you make the conversion to number. I did this conversion in excel but I believe that somehow this could also be done through php.
By: George
Date: 2013-12-22
Time: 16:51

Re: Chart with dates

Microsoft says that :

Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900

Consequently if you want to make the conversion to number through php you can write a function which calculates the days after 1/1/1990
By: Skrol29
Date: 2013-12-23
Time: 16:22

Re: Chart with dates

Hi George,

OpenTBS actually does such a conversion when you merge a date value into a cell that has "ope=tbs:date".
So it has to be able to do the same in charts ...
By: George
Date: 2014-01-02
Time: 22:44

Re: Chart with dates

Hi Skrol29

If I understand well in order to use this functionality  you have to write sth like this command  in word ([ope=tbs:date]).

If you want to keep word clear? (I have 150 dates..). I need to change the value of the chart internally with PHP , can I do it with opentbs?

Personally I would calculate the days with sth like this http://www.php.net/mktime but if there is embeded functionality even better.

Thanks

PS I like your scripts here www.skrol29.com :)