Forum


Replies: 2   Views: 2738
Lower border clipping off for charts?
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 dev@ram  · 12-10-2017 - 17:00

Hi ,

When I generate a chart its lower border is clipped. This is happening for all charts. Any idea why? Its not overlapping the next chart and if I drag and adjust any one chart in the page, then the others clipping is removed. Please see https://photos.app.goo.gl/i2x5geDc43zwHIyH2.

The array used for generation is given below. Any suggestion guys ?

$args = array(
                    'data' => $data,
                    'type' => 'barChart',
                    'color' => $chartcolor,
                    'title' => $group->title,
                    'sizeX' => 17, 
                    'legendPos' => 'none',
                    'border' => 1,
                    'vgrid' => 0,
                    'hgrid' => 1,
                    'scalingMin' => '0.0',
                    'scalingMax' => $account->ratingMax,
                    'majorUnit' => 1.0,
                    'minorUnit' => 0.0,
                    'showValue' => true,
                    'chartAlign' => 'left',
                    'showTable' => false,
                    'font' => "Arial",
                    'groupBar' => 'clustered'
                );

 

Posted by admin  · 13-10-2017 - 07:06

Hello,

We have tested it and we see all borders opening the DOCX with MS Word 2007, MS Word 2010, MS Word 2013, MS Word 2016 and LibreOffice 5 (https://s1.postimg.org/5d3tcr2q67/chart_borders.jpg).

What program and version are you using to open the DOCX? Maybe you can do a break line after each chart to add a line to separate each chart.

This is the code we have run, please check and test it:

<?php

require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();

$data = array(
    'legend' => array('Legend 1', 'Legend 2', 'Legend 3'),
    'data 1' => array(9, 7, 5),
    'data 2' => array(2, 6, 3),
    'data 3' => array(5, 3, 7)
);
$paramsChart = array(
    'data' => $data,
    'type' => 'barChart',
    'color' => '5',
    'title' => 'my title',
    'sizeX' => '17',
    'legendPos' => 'none',
    'border' => '1',
    'vgrid' => 0,
    'hgrid' => 1,
    'scalingMin' => '0.0',
    'scalingMax' => '10',
    'majorUnit' => 1.0,
    'minorUnit' => 0.0,
    'showValue' => true,
    'chartAlign' => 'left',
    'showTable' => false,
    'font' => "Arial",
    'groupBar' => 'clustered',
);
$docx->addChart($paramsChart);

$data = array(
    'legend' => array('Legend 1', 'Legend 2', 'Legend 3'),
    'data 1' => array(7, 5, 8),
    'data 2' => array(3, 1, 4),
    'data 3' => array(3, 3, 5)
);
$paramsChart = array(
    'data' => $data,
    'type' => 'barChart',
    'color' => '5',
    'title' => 'my title',
    'sizeX' => '17',
    'legendPos' => 'none',
    'border' => '1',
    'vgrid' => 0,
    'hgrid' => 1,
    'scalingMin' => '0.0',
    'scalingMax' => '10',
    'majorUnit' => 1.0,
    'minorUnit' => 0.0,
    'showValue' => true,
    'chartAlign' => 'left',
    'showTable' => false,
    'font' => "Arial",
    'groupBar' => 'clustered',
);
$docx->addChart($paramsChart);

$docx->createDocx('output');

Regards.

Posted by dev@ram  · 26-10-2017 - 16:32

Thank you for your help. I'm not sure what was causing it but I finally got it fixed. There was a linebreak at the end of the graph addGraph(). I made it twice.

 $docx->addBreak(array('type' => 'line'));
 $docx->addBreak(array('type' => 'line'));

the weird part is that if you use the one below it does not work :)

$docx->addBreak(array('type' => 'line', 'number' => 2));

anyway, thought I'll share.