Register Lost your password?
Full api documentation: full api documentation FREE version full api documentation PRO version

public function addTemplateChart(string variable, array chart)

Parameters

variable : variable to replace with chart
chart : chart to add

Variables in Word document must be $CHART$. The variable is replaced with the assigned chart.

Examples

Example Version Pro


require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();

$docx->addTemplate('TemplateChart.docx');

$legends = array(
    'legend1' => array(10, 11, 12),
    'legend2' => array(30, 21, 12),
    'legend3' => array(40, 41, 42)
);

$paramsChart =
    array(
        'data' => $legends,
        'type' => 'pie3DChart',
        'title' => 'Title',
        'cornerX' => 20,
        'cornerY' => 20,
        'cornerP' => 30,
        'color' => 2,
        'textWrap' => 0,
        'sizeX' => 10,
        'sizeY' => 10,
        'jc' => 'right',
        'showPercent' => 1,
        'font' => 'Times New Roman'
    );

$docx->addTemplateChart('PIECHART', $paramsChart);

$docx->createDocx('template_chart.docx');

Comments are closed.