本文整理汇总了PHP中CreateDocx::addChart方法的典型用法代码示例。如果您正苦于以下问题:PHP CreateDocx::addChart方法的具体用法?PHP CreateDocx::addChart怎么用?PHP CreateDocx::addChart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreateDocx
的用法示例。
在下文中一共展示了CreateDocx::addChart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateDocx
<?php
//path to the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('We will now add a 3D line chart with a title to the Word document:');
$data = array('legend' => array('Series 1', 'Series 2', 'Series 3'), 'data 1' => array(10, 7, 5), 'data 2' => array(20, 60, 3), 'data 3' => array(50, 33, 7), 'data 4' => array(25, 0, 14));
$paramsChart = array('data' => $data, 'type' => 'line3DChart', 'title' => 'Three dimensional line chart', 'color' => '2', 'perspective' => '30', 'rotX' => '30', 'rotY' => '30', 'font' => 'Arial', 'chartAlign' => 'center', 'showTable' => 0, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 't', 'legendOverlay' => '0', 'haxLabel' => 'Horizontal label', 'vaxLabel' => 'Vertical label', 'haxLabelDisplay' => 'horizontal', 'vaxLabelDisplay' => 'horizontal', 'hgrid' => '3', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->addText('And now the same chart in 2D with a different color schem and options:');
$data = array('legend' => array('Series 1', 'Series 2', 'Series 3'), 'data 1' => array(10, 7, 5), 'data 2' => array(20, 60, 3), 'data 3' => array(50, 33, 7), 'data 4' => array(25, 0, 14));
$paramsChart = array('data' => $data, 'type' => 'lineChart', 'color' => '5', 'chartAlign' => 'center', 'showTable' => 0, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'b', 'legendOverlay' => '0', 'haxLabel' => 'X Axis', 'vaxLabel' => 'Y Axis', 'haxLabelDisplay' => 'horizontal', 'vaxLabelDisplay' => 'vertical', 'hgrid' => '3', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_4');
示例2: array
<td>cell_1_4</td>
</tr>
<tr>
<td>cell_2_3</td>
<td>cell_2_4</td>
</tr>
<tr>
<td>cell_3_1</td>
<td>cell_3_2</td>
<td>cell_3_3</td>
<td>cell_3_4</td>
</tr>
</table>';
$docx->embedHTML($myHTML, array('tableStyle' => 'MediumGrid3-accent5PHPDOCX'));
$docx->addBreak();
$text = 'We are going to locate three pictures in a row just below this text. And we are going to use Trebuchet MS font to change a little bit :-)';
$paramsText = array('font' => 'Trebuchet MS');
$docx->addText($text, $paramsText);
$images = array('../img/image.png', '../img/image.png', '../img/image.png');
$wordImages = array();
foreach ($images as $image) {
$paramsImg = array('name' => $image, 'dpi' => 120, 'scaling' => 90, 'spacingTop' => 10, 'spacingBottom' => 10, 'spacingLeft' => 10, 'spacingRight' => 10, 'textWrap' => 1);
array_push($wordImages, $docx->addElement('addImage', $paramsImg));
}
$paramsTable = array('TBLSTYLEval' => 'NormalTablePHPDOCX');
$valuesTable = array($wordImages);
$docx->addTable($valuesTable, $paramsTable);
$legends = array('legend' => array('sequence 1', 'sequence 2', 'sequence 3'), 'Category 1' => array(9.300000000000001, 2.4, 2), 'Category 2' => array(8.5, 4.4, 1), 'Category 3' => array(6.5, 1.8, 0.5), 'Category 4' => array(8.5, 3, 1), 'Category 5' => array(6, 5, 2.6));
$args = array('data' => $legends, 'type' => 'colBar', 'title' => 'Chart with table', 'sizeX' => 15, 'sizeY' => 15, 'legendPos' => 't', 'border' => 1, 'vgrid' => 1, 'showtable' => 1);
$docx->addChart($args);
$docx->createDocx('../word_documents/example_chart_showtable');