Forum


Replies: 6   Views: 2203
How to set up line chart without curve when created from a template
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 20-11-2019 - 11:01

Hello,

We have run the following script with phpdocx 9, phpdocx 8 and phpdocx 7.5:

$docx1 = new CreateDocx();

$data = array(
    'legend' => array('Series 1', 'Series 2', 'Series 3'),
    'data' => array(
        array(
            'name' => 'data 1',
            'values' => array(10, 7, 5),
        ),
        array(
            'name' => 'data 2',
            'values' => array(20, 60, 3),
        ),
        array(
            'name' => 'data 3',
            'values' => array(50, 33, 7),
        ),
        array(
            'name' => 'data 4',
            'values' => array(25, 0, 14),
        ),
    ),
);

$paramsChart = array(
    'data' => $data,
    'type' => 'lineChart',
    'color' => '2',
    'chartAlign' => 'center',
    'showTable' => 1,
    'sizeX' => '15',
    'sizeY' => '10',
    'legendPos' => 'b',
    'legendOverlay' => '0',
    'haxLabel' => 'Time',
    'vaxLabel' => 'Number',
    'haxLabelDisplay' => 'horizontal',
    'vaxLabelDisplay' => 'vertical',
    'hgrid' => '1',
    'vgrid' => '0',
    'symbol' => 'circle',
    'smooth' => false,
);

$docx1->addChart($paramsChart);
$docx1->createDocx('output_1.docx');

$docx2 = new CreateDocxFromTemplate('../../files/TemplateSimpleText.docx');

$paramsChart = array(
    'data' => $data,
    'type' => 'lineChart',
    'color' => '2',
    'chartAlign' => 'center',
    'showTable' => 1,
    'sizeX' => '15',
    'sizeY' => '10',
    'legendPos' => 'b',
    'legendOverlay' => '0',
    'haxLabel' => 'Time',
    'vaxLabel' => 'Number',
    'haxLabelDisplay' => 'horizontal',
    'vaxLabelDisplay' => 'vertical',
    'hgrid' => '1',
    'vgrid' => '0',
    'symbol' => 'circle',
    'smooth' => false,
);

$docx2->addChart($paramsChart);
$docx2->createDocx('output_2.docx');

And the chart output is the same in all cases. You can find the template (TemplateSimpleText.docx) in the package.

If you send to contact[at]phpdocx.com the DOCX you are using as template we'll check it; maybe some style is overwriting the styles added.

Regards.