0

Can anybody give me an example of how to create an Excel Scatter chart using OpenTBS/TinyButStrong? And are there any commercial/non-commercial PHP excel writers that support excel charts?

Will really appreciate your help.

Thank you for your time!

chums
  • 3
  • 2

1 Answers1

0

Create a basic XY chart using the wizard in Ms Word. Save the chart without changing it. Let the values and the design. Select the chart, and in the contextual menu, chose "Format of the zone" or something like this. In the "Alt Text" tab, in zone "Title", enter "a nice chart". Save the template.

At the PHP side:

$template = 'demo_ms_word.docx'; $TBS->LoadTemplate($template);

$ChartNameOrNum = 'a nice chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 1;
$NewValues = array( array( 1.5, 2.0, 3.2, 33), array(1.77, 2.88, 2.88, 2.99) );
$NewLegend = "OpenTBS is so strong";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);

$TBS->Show(OPENTBS_FILE+TBS_EXIT, 'result.docx');

After it works, change the chart properties and the data.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • is the same principal applied in creating an excel chart (.xlsx file)? I tried creating a .xlsx file that contains a scatter chart, somehow i'm not able to get the values from an array. Really appreciate your help. Thank you so much! – chums Jun 09 '13 at 06:55
  • According to the manual, OpenTBS cannot merge Charts in Ms Excel. This is because an Ms Excel Chart takes its data from a spreadsheet. Nevertheless, you can do Ms Excel Charts with OpenTBS in a different way : just create your Chart on a range of fake data ; make the series reference just more longer than your fake data (so it will cover the actual data after the merge) ; replace the fake data with a TBS block ; and then merge that block. – Skrol29 Jun 10 '13 at 10:01