Categories > TinyButStrong general >

How can I update a PPT with X series pie chart

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: X series pie chart
Date: 2016-06-09
Time: 14:33

How can I update a PPT with X series pie chart

Hi,

I have a presentation which I build dynamically.
I have no problem building a 2 series pie chart with the following code:
$NewValues = array( array('New and Open','Closed'), array($X_PANAYA_OTHER_STATUS_FT_TASKS, $X_PANAYA_CLOSED_FT_TASKS) );

But I have a pie chart which I do not know how many values it will have.

I built an array for the names and an array for the values and tried to update it in the following way:
$NewValues = array( $arr_step_execution_name, $arr_step_execution_value );

This is working if I am updating a bar chart but not if I am updating a pie chart.

Is it possible?
If yes how can I do it?

Appreciate your help!
MErav
By: Skrol29
Date: 2016-06-09
Time: 15:15

Re: How can I update a PPT with X series pie chart

Hi,

OpenTBS cannot add a new series in a chart. It can only modify or delete an existing series.
Some graphics can be « pivoted » so that series become categories and categories come series. May be you can try this.
Otherwise, you can created a large number of series in the template, then merge the first series and deleted those who are not merged.
By: X series pie chart
Date: 2016-06-09
Time: 16:02

Re: How can I update a PPT with X series pie chart

Hi,

Thanks for the quick response.
I do not want to add a new series. I am creating the pie chart from scratch.
How can I create a large number of series in the template, then merge the first series and deleted those who are not merged?

Thanks,
Merav
By: Skrol29
Date: 2016-06-11
Time: 01:20

Re: How can I update a PPT with X series pie chart

In the PPT template, create your pie chart with let's say 10 series. For example named series_1, series_2, series_3, .... with any value you want, let's say 10.
AT the PHP side, first make a loop upon all the series you have, and change their data an name using $TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesName, $NewValues, $NewLegend).
Let's say you have 7 series to merge. For all the 3 series laft, make a loop to delete those series using $TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, false).
By: X series pie chart
Date: 2016-06-13
Time: 14:42

Re: How can I update a PPT with X series pie chart

Thanks. I will try this. Haven't done it before ...
Do you have any link to documentation or full example with this?
By: Merav
Date: 2016-06-24
Time: 08:09

Re: How can I update a PPT with X series pie chart

Hi,
Well I got back to it and it is still not working for me.
Maybe you can see what I am doing wrong ...
I have only 1 series in the pie chart and I have 4 categories (maybe I mislead in my original message when I wrote X series, it is actually 1 series with 4 categories).
This is the code in the PPT. I am running on a query result. I set the legend and the value for each.
When I run it the chart in the PPT is empty:

                         for ( $i = 0 ; $i < mysqli_num_rows($ft_test_tasks_results_q) ; $i++ ) {
                $details_row = mysqli_fetch_row($ft_test_tasks_results_q);
                for ( $j = 0 ; $j < mysqli_num_fields($ft_test_tasks_results_q) ; $j++ ) {
                    $status = $details_row[$j];
                    switch($status){
                        case($status == $status_not_run): {
                            $NewLegend = 'Not Run';
                            break;
                        }
                        case($status == $status_failed): {
                            $NewLegend = 'Failed';
                            break;
                        }
                        case($status == $status_passed): {
                            $NewLegend = 'Passed';
                            break;
                        }
                        case($status == $status_in_progress): {
                            $NewLegend = 'In Progress';
                            break;
                        }
                }
                    $j++;
                    $NewValues = $details_row[$j];
                    $TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
                }
            }

If I use the following code for the same chart.
The chart is being updated correctly but then I have 2 additional empty categories in the pie chart which I can't delete ...

                       for ( $i = 0 ; $i < mysqli_num_rows($ft_test_tasks_results_q) ; $i++ ) {
                $details_row = mysqli_fetch_row($ft_test_tasks_results_q);
                for ( $j = 0 ; $j < mysqli_num_fields($ft_test_tasks_results_q) ; $j++ ) {
                    $status = $details_row[$j];
                    switch($status){
                        case($status == $status_not_run): $arr_task_result_name[] = 'Not Run'; break;
                        case($status == $status_failed): $arr_task_result_name[] = 'Failed'; break;
                        case($status == $status_passed): $arr_task_result_name[] = 'Passed'; break;
                        case($status == $status_in_progress): $arr_task_result_name[] = 'In Progress'; break;
                }
                    $j++;
                    $arr_task_result_value[] = $details_row[$j];
                }
            }
           
            //*** update the Project Execution - Testing graph in the PPT
            $ChartRef = 'ft_test_results'; // Title of the shape that embeds the chart
            $SeriesNameOrNum = 1;
            $NewValues = array( $arr_task_result_name, $arr_task_result_value );
            $NewLegend = "Test Results";
            $TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
            $TBS->PlugIn(OPENTBS_CHART, $ChartRef, 1, false);


Can you see what I am doing wrong???

Thanks a lot,
Merav
By: Merav
Date: 2016-06-24
Time: 08:47

Re: How can I update a PPT with X series pie chart

Hi,

You can ignore my question above. I managed to find the problem.
Thanks!

Merav
By: peter
Date: 2016-07-28
Time: 11:23

Re: How can I update a PPT with X series pie chart

If for you no matter use just your schedule you can use these templates http://charts.poweredtemplate.com/powerpoint-diagrams-charts/index.html . With them I never had problems