TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Displaying chart data as numerical rather than percentage values

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Jonathan Hill
Date: 2017-03-10
Time: 11:07

Displaying chart data as numerical rather than percentage values

Hello,

I am using the $tbs->plugin(OPENTBS_CHART... function to generate charts. It's working well but it appears to render the numerical data keys as a percentage rather than a straight numerical which is what I need. Can I configure it to render straight numerical values as opposed to percentages? I can't seem to find a reference to it in the docks.

Also can you dynamically change the title of a chart whilst using the chart title as a reference to edit the chart?

Thanks
By: Jonathan Hill
Date: 2017-03-10
Time: 15:03

Re: Displaying chart data as numerical rather than percentage values

Correction.

re the title. Basically what I'm asking is how do I dynamically change the display title of each chart?
By: Skrol29
Date: 2017-03-11
Time: 23:53

Re: Displaying chart data as numerical rather than percentage values

Hello,

The command OPENTBS_CHART can only modify series, and not the tile in a chart.

There is a hard solution for modifying the title of a chart: open the sub-file corresponding to the chart, and do a str_replace() on $TBS->Source.

The command OPENTBS_CHART_INFO can help you to find the sub-file corresponding to the chart.
By: Jonathan Hill
Date: 2017-03-12
Time: 18:31

Re: Displaying chart data as numerical rather than percentage values

Thanks for that. i will try.
By: Jonathan Hill
Date: 2017-04-10
Time: 17:58

Re: Displaying chart data as numerical rather than percentage values

I have outputted OPENTBS_CHART_INFO. I get an array of values relating to the chart. I'm not sure what you mean by 'sub-file'. Do you mean the embedded excel files associated with each chart? If so how would I access it? what path would I have to use to get to the file etc? Not clear what you mean? thanks.
By: Skrol29
Date: 2017-04-14
Time: 01:34

Re: Displaying chart data as numerical rather than percentage values

Hi,

A sub-file is and XML file stored in the document.
You can load it using command OPENTBS_SELECT_FILE.
Then you can read and edit the content using $TBS->Source.
By: Jonathan Hill
Date: 2017-05-02
Time: 12:47

Re: Displaying chart data as numerical rather than percentage values

So I run the following code:

$subFile = 'word/embeddings/Microsoft_Excel_Worksheet3.xlsx';
$TBS->PlugIn(OPENTBS_SELECT_FILE, $subFile);
str_replace('$CLIENT_NAME$', 'Test String', $TBS->Source);
$TBS->LoadTemplate(false);

'$CLIENT_NAME$' is still there as the chart title. Am I doing it correctly? I have tried unzipping the docx file first. I'm obviously targeting the Microsoft_Excel_Worksheet3.xlsx file which contains the data for the chart I am targeting.

Am I missing something?

Thanks