Forum


Replies: 2   Views: 3074
Axis labels overlay on top of axis values - which parameter is wrong
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 andrzej.morun  · 18-12-2016 - 17:53

I use Advanced Version of phpdocx 6.5.

I have sam problem with layouting charts.

1) I'm adding a 2D column chart to my document but the axis labels always seem to overlay on top of the values display along on the X and Y axis.

2) Inspite of I set parametr  'legendpos' => 'none' the legend on the chart stiil is displayed

What I'm doing wrong?

Sample code:

$docx = new CreateDocxFromTemplate ( 'template.docx' );
$data = array(
    'legend' => array(''),
    'January' => array(10),
    'February' => array(17),
    'March' => array(25),
    'April' => array(9)
);

    $paramsChart = array (
            'data' => $data,
            'type' => 'colChart',
            'title' => 'Sales',
            'color' => 2,
            'sizeX' => 10,
            'sizeY' => 6,
            'font' => 'Times New Roman',
            'legendpos' => 'none',
            'border' => 'none',
            'haxLabel' => 'Months',
            'haxLabelDisplay' => 'horizontal',
            'vaxLabel' => 'Sales [$]',
            'vaxLabelDisplay' => 'rotated',
            'hgrid' => 1,
            'vgrid' => 0,
            'chartAlign' => 'center',
            'showCategory' => false
            
    );

    $chart = new WordFragment ( $docx, 'document' );
    $chart->addChart ( $paramsChart );
$variables = array (
         'CHART1' => $chart
);
$docx->replaceVariableByWordFragment ( $variables, array (
        'type' => 'inline'
) );

$docx->addText('And now the same chart addChartMethod on $docx');
$docx->addChart($paramsChart);