create
[ class tree: create ] [ index: create ] [ all elements ]

example

  1. <?php
  2.  
  3. /**
  4.  * Insert a scatter chart into a Word document.
  5.  *
  6.  * @category   Phpdocx
  7.  * @package    examples
  8.  * @subpackage easy
  9.  * @copyright  Copyright (c) 2009-2013 Narcea Producciones Multimedia S.L.
  10.  *              (http://www.2mdc.com)
  11.  * @license    http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  12.  * @version    2012.12.26
  13.  * @link       http://www.phpdocx.com
  14.  * @since      2012.12.26
  15.  */
  16.  
  17. require_once '../../classes/CreateDocx.inc';
  18.  
  19. $docx new CreateDocx();
  20.  
  21. $completedData array(
  22.     array(100),
  23.     array(172),
  24.     array(184),
  25.     array(256),
  26.     array(307),
  27.     array(5010),
  28.     array(359),
  29. );
  30.  
  31. $paramsChart array(
  32.     'data' => $completedData,
  33.     'type' => 'scatterChart',    
  34.     'border' => 1,
  35.     'color' => 2,
  36.     'jc' => 'center',
  37.     'legendPos' => 'none',
  38.     'legendOverlay' => true,
  39.     'symbol' => 'line',//dot, line
  40.     'showValue' => true,
  41.     'hgrid' => 1,
  42.     'vgrid' => 1,
  43.     'smooth' => true
  44. );
  45. $docx->addChart($paramsChart);
  46.  
  47. $paramsChart array(
  48.     'data' => $completedData,
  49.     'type' => 'scatterChart',    
  50.     'border' => 2.25,
  51.     'jc' => 'left',
  52.     'color' => 3,
  53.     'legendPos' => 'l',
  54.     'font' => 'Calibri',
  55.     'symbol' => 'line',//dot, line
  56.     'smooth' => true,
  57.     'showCategory' => true,
  58.     'hgrid' => 2,
  59.     'vgrid' => 2,
  60. );
  61. $docx->addChart($paramsChart);
  62.  
  63. $paramsChart array(
  64.     'data' => $completedData,
  65.     'type' => 'scatterChart',    
  66.     'border' => 6,
  67.     'color' => 4,
  68.     'legendPos' => 't',
  69.     'font' => 'Arial',
  70.     'symbol' => 'dot',//dot, line
  71.     'showValue' => true,
  72.     'showCategory' => true,
  73.     'hgrid' => 3,
  74.     'vgrid' => 3,
  75. );
  76. $docx->addChart($paramsChart);
  77.  
  78. $paramsChart array(
  79.     'data' => $completedData,
  80.     'type' => 'scatterChart',    
  81.     'border' => 0,
  82.     'color' => 5,
  83.     'legendPos' => 'r',
  84.     'smooth' => true
  85. );
  86. $docx->addChart($paramsChart);
  87.  
  88. $paramsChart array(
  89.     'data' => $completedData,
  90.     'type' => 'scatterChart',    
  91.     'border' => 0,
  92.     'color' => 1,
  93.     'jc' => 'right',
  94.     'legendPos' => 'r',
  95.     'legendOverlay' => true,
  96.     'font' => 'Times New Roman',  
  97.     'haxLabel' => 'vertical label',
  98.     'vaxLabel' => 'horizontal label',
  99.     'haxLabelDisplay' => 'rotated',
  100.     'vaxLabelDisplay' => 'rotated',
  101.     'hgrid' => 0,
  102.     'symbol' => 'line',//dot, line
  103.     'vgrid' => 0,   
  104.     'showtable' => true
  105. );
  106. $docx->addChart($paramsChart);
  107.  
  108. $chart $docx->addElement('addGraphic'$paramsChart);
  109.  
  110. $valuesList array(
  111.     'Line 1',
  112.     $chart,
  113.     'Line 2',
  114.     'Line 3',
  115. );
  116. $paramsList array('val' => 1);
  117. $docx->addList($valuesList$paramsList);
  118.  
  119. $docx->createDocx('../docx/example_chart_scatter');

Documentation generated on Mon, 13 Jan 2014 13:44:04 +0100 by phpDocumentor 1.4.4