CreateGraphic.inc 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746
  1. <?php
  2. /**
  3. * Create graphics (charts)
  4. *
  5. * @category Phpdocx
  6. * @package elements
  7. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  8. * (http://www.2mdc.com)
  9. * @license LGPL
  10. * @version 1.0
  11. * @link http://www.phpdocx.com
  12. * @since File available since Release 1.0
  13. */
  14. include_once dirname(__FILE__) . '/CreateElement.inc';
  15. /**
  16. * Create graphics (charts)
  17. *
  18. * @category Phpdocx
  19. * @package elements
  20. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  21. * (http://www.2mdc.com)
  22. * @license http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  23. * @version 1.0
  24. * @link http://www.phpdocx.com
  25. * @since Class available since Release 1.0
  26. */
  27. class CreateGraphic extends CreateElement
  28. {
  29. const NAMESPACEWORD = 'c';
  30. /**
  31. *
  32. * @access protected
  33. * @var <type>
  34. */
  35. protected $_xmlChart;
  36. /**
  37. * @access private
  38. * @var CreateGraphic
  39. * @static
  40. */
  41. private static $_instance = null;
  42. /**
  43. *
  44. * @access private
  45. * @var <type>
  46. */
  47. private $_rId;
  48. /**
  49. *
  50. * @access private
  51. * @var <type>
  52. */
  53. private $_textalign;
  54. /**
  55. *
  56. * @access private
  57. * @var <type>
  58. */
  59. private $_jc;
  60. /**
  61. *
  62. * @access private
  63. * @var <type>
  64. */
  65. private $_sizeX;
  66. /**
  67. *
  68. * @access private
  69. * @var <type>
  70. */
  71. private $_sizeY;
  72. /**
  73. *
  74. * @access private
  75. * @var <type>
  76. */
  77. private $_type;
  78. /**
  79. *
  80. * @access private
  81. * @var <type>
  82. */
  83. private $_showPercent;
  84. /**
  85. *
  86. * @access private
  87. * @var <type>
  88. */
  89. private $_data;
  90. /**
  91. *
  92. * @access private
  93. * @var <type>
  94. */
  95. private $_cornerX;
  96. /**
  97. *
  98. * @access private
  99. * @var <type>
  100. */
  101. private $_cornerY;
  102. /**
  103. *
  104. * @access private
  105. * @var <type>
  106. */
  107. private $_cornerP;
  108. /**
  109. *
  110. * @access private
  111. * @var <type>
  112. */
  113. private $_color;
  114. /**
  115. *
  116. * @access private
  117. * @var <type>
  118. */
  119. private $_groupBar;
  120. /**
  121. *
  122. * @access private
  123. * @var <type>
  124. */
  125. private $_title;
  126. /**
  127. *
  128. * @access private
  129. * @var <type>
  130. */
  131. private $_name;
  132. /**
  133. * @access private
  134. * @var string
  135. */
  136. private $_font;
  137. /**
  138. * Construct
  139. *
  140. * @access public
  141. */
  142. public function __construct()
  143. {
  144. $this->_rId = '';
  145. $this->_textalign = '';
  146. $this->_jc = '';
  147. $this->_sizeX = '';
  148. $this->_sizeY = '';
  149. $this->_type = '';
  150. $this->_showPercent = '';
  151. $this->_data = '';
  152. $this->_cornerX = '';
  153. $this->_cornerY = '';
  154. $this->_cornerP = '';
  155. $this->_color = '';
  156. $this->_groupBar = '';
  157. $this->_title = '';
  158. $this->_font = '';
  159. $this->_xml = '';
  160. $this->_name = '';
  161. }
  162. /**
  163. * Destruct
  164. *
  165. * @access public
  166. */
  167. public function __destruct()
  168. {
  169. }
  170. /**
  171. *
  172. * @access public
  173. * @return string
  174. */
  175. public function __toString()
  176. {
  177. return $this->_xml;
  178. }
  179. /**
  180. *
  181. * @access public
  182. * @return CreateGraphic
  183. * @static
  184. */
  185. public static function getInstance()
  186. {
  187. if (self::$_instance == NULL) {
  188. self::$_instance = new CreateGraphic();
  189. }
  190. return self::$_instance;
  191. }
  192. /**
  193. * Setter. Rid
  194. *
  195. * @access public
  196. * @param string $rId
  197. */
  198. public function setRId($rId)
  199. {
  200. $this->_rId = $rId;
  201. }
  202. /**
  203. * Getter. Rid
  204. *
  205. * @access public
  206. * @return string
  207. */
  208. public function getRId()
  209. {
  210. return $this->_rId;
  211. }
  212. /**
  213. * Setter. Name
  214. *
  215. * @access public
  216. * @param string $name
  217. */
  218. public function setName($name)
  219. {
  220. $this->_name = $name;
  221. }
  222. /**
  223. * Getter. Name
  224. *
  225. * @access public
  226. * @return string
  227. */
  228. public function getName()
  229. {
  230. return $this->_name;
  231. }
  232. /**
  233. * Setter. Xml chart
  234. *
  235. * @access public
  236. * @param string $xmlChart
  237. */
  238. public function setXmlChart($xmlChart)
  239. {
  240. $this->_xmlChart = $xmlChart;
  241. }
  242. /**
  243. * Getter. Xml chart
  244. *
  245. * @access public
  246. * @return string
  247. */
  248. public function getXmlChart()
  249. {
  250. return $this->_xmlChart;
  251. }
  252. /**
  253. * Create graphic
  254. *
  255. * @access public
  256. * @param array $args[0]
  257. * @param array $args[1]
  258. * @return boolean
  259. */
  260. public function createGraphic()
  261. {
  262. $this->_xmlChart = '';
  263. $args = func_get_args();
  264. if (!empty($args[1]['type']) && !empty($args[0])) {
  265. if ($this->createCHARTXML($args) == false) {
  266. echo 'You haven`t added legends';
  267. return false;
  268. }
  269. $this->createDOCUEMNTXML($args);
  270. return true;
  271. } else {
  272. echo 'You haven`t added a chart type';
  273. return false;
  274. }
  275. }
  276. /**
  277. * Generate chartspace XML
  278. *
  279. * @access protected
  280. */
  281. protected function generateCHARTSPACE()
  282. {
  283. $this->_xmlChart = '<?xml version="1.0" encoding="UTF-8" ' .
  284. 'standalone="yes" ?><' . CreateGraphic::NAMESPACEWORD .
  285. ':chartSpace xmlns:c="http://schemas.openxmlformats.o' .
  286. 'rg/drawingml/2006/chart" xmlns:a="http://schemas.open' .
  287. 'xmlformats.org/drawingml/2006/main" xmlns:r="http://s' .
  288. 'chemas.openxmlformats.org/officeDocument/2006/relatio' .
  289. 'nships">__GENERATECHARTSPACE__</' .
  290. CreateGraphic::NAMESPACEWORD . ':chartSpace>';
  291. }
  292. /**
  293. * Generate w:date1904
  294. *
  295. * @access protected
  296. * @param string $val
  297. */
  298. protected function generateDATE1904($val = '1')
  299. {
  300. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':date1904 val="' .
  301. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  302. ':date1904>__GENERATECHARTSPACE__';
  303. $this->_xmlChart = str_replace(
  304. '__GENERATECHARTSPACE__',
  305. $xml,
  306. $this->_xmlChart
  307. );
  308. }
  309. /**
  310. * Generate w:lang
  311. *
  312. * @access protected
  313. * @param string $val
  314. */
  315. protected function generateLANG($val = 'es-ES')
  316. {
  317. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':lang val="' .
  318. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  319. ':lang>__GENERATECHARTSPACE__';
  320. $this->_xmlChart = str_replace(
  321. '__GENERATECHARTSPACE__',
  322. $xml,
  323. $this->_xmlChart
  324. );
  325. }
  326. /**
  327. * Generate w:style
  328. *
  329. * @access protected
  330. * @param string $val
  331. */
  332. protected function generateSTYLE($val = '2')
  333. {
  334. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':style val="' .
  335. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  336. ':style>__GENERATECHARTSPACE__';
  337. $this->_xmlChart = str_replace(
  338. '__GENERATECHARTSPACE__',
  339. $xml,
  340. $this->_xmlChart
  341. );
  342. }
  343. /**
  344. * Generate w:title
  345. *
  346. * @access protected
  347. */
  348. protected function generateTITLE()
  349. {
  350. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  351. ':title>__GENERATETITLE__</' . CreateGraphic::NAMESPACEWORD .
  352. ':title>__GENERATECHART__';
  353. $this->_xmlChart = str_replace(
  354. '__GENERATECHART__', $xml, $this->_xmlChart
  355. );
  356. }
  357. /**
  358. * Generate w:titletx
  359. *
  360. * @access protected
  361. */
  362. protected function generateTITLETX()
  363. {
  364. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  365. ':tx>__GENERATETITLETX__</' . CreateGraphic::NAMESPACEWORD .
  366. ':tx>__GENERATETITLE__';
  367. $this->_xmlChart = str_replace(
  368. '__GENERATETITLE__', $xml, $this->_xmlChart
  369. );
  370. }
  371. /**
  372. * Generate w:rich
  373. *
  374. * @access protected
  375. */
  376. protected function generateRICH()
  377. {
  378. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  379. ':rich>__GENERATERICH__</' . CreateGraphic::NAMESPACEWORD .
  380. ':rich>__GENERATETITLETX__';
  381. $this->_xmlChart = str_replace(
  382. '__GENERATETITLETX__', $xml, $this->_xmlChart
  383. );
  384. }
  385. /**
  386. * Generate w:bodypr
  387. *
  388. * @access protected
  389. */
  390. protected function generateBODYPR()
  391. {
  392. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':bodyPr></' .
  393. CreateImage::NAMESPACEWORD1 . ':bodyPr>__GENERATERICH__';
  394. $this->_xmlChart = str_replace(
  395. '__GENERATERICH__', $xml, $this->_xmlChart
  396. );
  397. }
  398. /**
  399. * Generate w:lststyle
  400. *
  401. * @access protected
  402. */
  403. protected function generateLSTSTYLE()
  404. {
  405. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  406. ':lstStyle></' . CreateImage::NAMESPACEWORD1 .
  407. ':lstStyle>__GENERATERICH__';
  408. $this->_xmlChart = str_replace(
  409. '__GENERATERICH__', $xml, $this->_xmlChart
  410. );
  411. }
  412. /**
  413. * Generate w:titlep
  414. *
  415. * @access protected
  416. */
  417. protected function generateTITLEP()
  418. {
  419. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  420. ':p>__GENERATETITLEP__</' . CreateImage::NAMESPACEWORD1 .
  421. ':p>__GENERATERICH__';
  422. $this->_xmlChart = str_replace(
  423. '__GENERATERICH__', $xml, $this->_xmlChart
  424. );
  425. }
  426. /**
  427. * Generate w:titleppr
  428. *
  429. * @access protected
  430. */
  431. protected function generateTITLEPPR()
  432. {
  433. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  434. ':pPr>__GENERATETITLEPPR__</' . CreateImage::NAMESPACEWORD1 .
  435. ':pPr>__GENERATETITLEP__';
  436. $this->_xmlChart = str_replace(
  437. '__GENERATETITLEP__', $xml, $this->_xmlChart
  438. );
  439. }
  440. /**
  441. * Generate w:titlerfonts
  442. *
  443. * @access protected
  444. * @param string $font
  445. */
  446. protected function generateTITLERFONTS($font = '')
  447. {
  448. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':latin typeface="' .
  449. $font . '" pitchFamily="34" charset="0"></' .
  450. CreateImage::NAMESPACEWORD1 . ':latin ><' .
  451. CreateImage::NAMESPACEWORD1 .
  452. ':cs typeface="' . $font . '" pitchFamily="34" charset="0"></' .
  453. CreateImage::NAMESPACEWORD1 . ':cs>';
  454. $this->_xmlChart = str_replace(
  455. '__GENERATETITLERPR__', $xml, $this->_xmlChart
  456. );
  457. }
  458. /**
  459. * Generate w:defrpr
  460. *
  461. * @access protected
  462. */
  463. protected function generateDEFRPR()
  464. {
  465. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  466. ':defRPr>__GENERATEDEFRPR__</' . CreateImage::NAMESPACEWORD1 .
  467. ':defRPr>__GENERATETITLEPPR__';
  468. $this->_xmlChart = str_replace(
  469. '__GENERATETITLEPPR__', $xml, $this->_xmlChart
  470. );
  471. }
  472. /**
  473. * Generate w:titler
  474. *
  475. * @access protected
  476. */
  477. protected function generateTITLER()
  478. {
  479. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  480. ':r>__GENERATETITLER__</' . CreateImage::NAMESPACEWORD1 .
  481. ':r>__GENERATETITLEP__';
  482. $this->_xmlChart = str_replace(
  483. '__GENERATETITLEP__', $xml, $this->_xmlChart
  484. );
  485. }
  486. /**
  487. * Generate w:titlerpr
  488. *
  489. * @access protected
  490. */
  491. protected function generateTITLERPR($lang = 'es-ES')
  492. {
  493. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':rPr lang="' .
  494. $lang . '">__GENERATETITLERPR__</' . CreateImage::NAMESPACEWORD1 .
  495. ':rPr>__GENERATETITLER__';
  496. $this->_xmlChart = str_replace(
  497. '__GENERATETITLER__', $xml, $this->_xmlChart
  498. );
  499. }
  500. /**
  501. * Generate w:titlet
  502. *
  503. * @access protected
  504. * @param string $nombre
  505. */
  506. protected function generateTITLET($nombre = '')
  507. {
  508. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':t>' .
  509. $nombre . '</' . CreateImage::NAMESPACEWORD1 .
  510. ':t>__GENERATETITLER__';
  511. $this->_xmlChart = str_replace(
  512. '__GENERATETITLER__', $xml, $this->_xmlChart
  513. );
  514. }
  515. /**
  516. * Generate w:titlelayout
  517. *
  518. * @access protected
  519. * @param string $nombre
  520. */
  521. protected function generateTITLELAYOUT($nombre = '')
  522. {
  523. $xml = '<' . CreateImage::NAMESPACEWORD1 .
  524. ':layout></' . CreateImage::NAMESPACEWORD1 .
  525. ':layout>';
  526. $this->_xmlChart = str_replace(
  527. '__GENERATETITLE__', $xml, $this->_xmlChart
  528. );
  529. }
  530. /**
  531. * Generate w:autotitledeleted
  532. *
  533. * @access protected
  534. * @param string $val
  535. */
  536. protected function generateAUTOTITLEDELETED($val = '1')
  537. {
  538. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  539. ':autoTitleDeleted val="' . $val .
  540. '"></' . CreateGraphic::NAMESPACEWORD .
  541. ':autoTitleDeleted>__GENERATECHART__';
  542. $this->_xmlChart = str_replace(
  543. '__GENERATECHART__', $xml, $this->_xmlChart
  544. );
  545. }
  546. /**
  547. * Generate w:chart
  548. *
  549. * @access protected
  550. */
  551. protected function generateCHART()
  552. {
  553. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  554. ':chart>__GENERATECHART__</' . CreateGraphic::NAMESPACEWORD .
  555. ':chart>__GENERATECHARTSPACE__';
  556. $this->_xmlChart = str_replace(
  557. '__GENERATECHARTSPACE__', $xml, $this->_xmlChart
  558. );
  559. }
  560. /**
  561. * Generate w:plotarea
  562. *
  563. * @access protected
  564. */
  565. protected function generatePLOTAREA()
  566. {
  567. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  568. ':plotArea>__GENERATEPLOTAREA__</' . CreateGraphic::NAMESPACEWORD .
  569. ':plotArea>__GENERATECHART__';
  570. $this->_xmlChart = str_replace(
  571. '__GENERATECHART__', $xml, $this->_xmlChart
  572. );
  573. }
  574. /**
  575. * Generate w:layout
  576. *
  577. * @access protected
  578. */
  579. protected function generateLAYOUT()
  580. {
  581. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  582. ':layout></' . CreateGraphic::NAMESPACEWORD .
  583. ':layout>__GENERATEPLOTAREA__';
  584. $this->_xmlChart = str_replace(
  585. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  586. );
  587. }
  588. /**
  589. * Generate w:piechart
  590. *
  591. * @access protected
  592. */
  593. protected function generatePIECHART()
  594. {
  595. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  596. ':pieChart>__GENERATETYPECHART__</' .
  597. CreateGraphic::NAMESPACEWORD .
  598. ':pieChart>__GENERATEPLOTAREA__';
  599. $this->_xmlChart = str_replace(
  600. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  601. );
  602. }
  603. /**
  604. * Generate w:barChart
  605. *
  606. * @access protected
  607. */
  608. protected function generateBARCHART()
  609. {
  610. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  611. ':barChart>__GENERATETYPECHART__</' .
  612. CreateGraphic::NAMESPACEWORD .
  613. ':barChart>__GENERATEPLOTAREA__';
  614. $this->_xmlChart = str_replace(
  615. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  616. );
  617. }
  618. /**
  619. * Generate w:lineChart
  620. *
  621. * @access protected
  622. */
  623. protected function generateLINECHART()
  624. {
  625. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  626. ':lineChart>__GENERATETYPECHART__</' .
  627. CreateGraphic::NAMESPACEWORD .
  628. ':lineChart>__GENERATEPLOTAREA__';
  629. $this->_xmlChart = str_replace(
  630. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  631. );
  632. }
  633. /**
  634. * Generate w:varyColors
  635. *
  636. * @access protected
  637. * @param string $val
  638. */
  639. protected function generateVARYCOLORS($val = '1')
  640. {
  641. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':varyColors val="' .
  642. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  643. ':varyColors>__GENERATETYPECHART__';
  644. $this->_xmlChart = str_replace(
  645. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  646. );
  647. }
  648. /**
  649. * Generate w:barDir
  650. *
  651. * @access protected
  652. * @param string $val
  653. */
  654. protected function generateBARDIR($val = 'bar')
  655. {
  656. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':barDir val="' .
  657. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  658. ':barDir>__GENERATETYPECHART__';
  659. $this->_xmlChart = str_replace(
  660. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  661. );
  662. }
  663. /**
  664. * Generate w:grouping
  665. *
  666. * @access protected
  667. * @param string $val
  668. */
  669. protected function generateGROUPING($val = 'stacked')
  670. {
  671. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  672. ':grouping val="' . $val . '"></' . CreateGraphic::NAMESPACEWORD .
  673. ':grouping>__GENERATETYPECHART__';
  674. $this->_xmlChart = str_replace(
  675. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  676. );
  677. }
  678. /**
  679. * Generate w:ser
  680. *
  681. * @access protected
  682. */
  683. protected function generateSER()
  684. {
  685. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  686. ':ser>__GENERATESER__</' . CreateGraphic::NAMESPACEWORD .
  687. ':ser>__GENERATETYPECHART__';
  688. $this->_xmlChart = str_replace(
  689. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  690. );
  691. }
  692. /**
  693. * Generate w:idx
  694. *
  695. * @access protected
  696. * @param string $val
  697. */
  698. protected function generateIDX($val = '0')
  699. {
  700. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  701. ':idx val="' . $val . '"></' . CreateGraphic::NAMESPACEWORD .
  702. ':idx>__GENERATESER__';
  703. $this->_xmlChart = str_replace(
  704. '__GENERATESER__', $xml, $this->_xmlChart
  705. );
  706. }
  707. /**
  708. * Generate w:order
  709. *
  710. * @access protected
  711. * @param string $val
  712. */
  713. protected function generateORDER($val = '0')
  714. {
  715. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  716. ':order val="' . $val . '"></' . CreateGraphic::NAMESPACEWORD .
  717. ':order>__GENERATESER__';
  718. $this->_xml = str_replace(
  719. '__GENERATESER__', $xml, $this->_xmlChart
  720. );
  721. }
  722. /**
  723. * Generate w:tx
  724. *
  725. * @access protected
  726. */
  727. protected function generateTX()
  728. {
  729. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  730. ':tx>__GENERATETX__</' . CreateGraphic::NAMESPACEWORD .
  731. ':tx>__GENERATESER__';
  732. $this->_xmlChart = str_replace(
  733. '__GENERATESER__', $xml, $this->_xmlChart
  734. );
  735. }
  736. /**
  737. * Generate w:strref
  738. *
  739. * @access protected
  740. */
  741. protected function generateSTRREF()
  742. {
  743. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  744. ':strRef>__GENERATESTRREF__</' . CreateGraphic::NAMESPACEWORD .
  745. ':strRef>__GENERATETX__';
  746. $this->_xmlChart = str_replace(
  747. '__GENERATETX__', $xml, $this->_xmlChart
  748. );
  749. }
  750. /**
  751. * Generate w:f
  752. *
  753. * @access protected
  754. * @param string $val
  755. */
  756. protected function generateF($val = 'Hoja1!$B$1')
  757. {
  758. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':f>' .
  759. $val . '</' . CreateGraphic::NAMESPACEWORD .
  760. ':f>__GENERATESTRREF__';
  761. $this->_xmlChart = str_replace(
  762. '__GENERATESTRREF__', $xml, $this->_xmlChart
  763. );
  764. }
  765. /**
  766. * Generate w:strcache
  767. *
  768. * @access protected
  769. */
  770. protected function generateSTRCACHE()
  771. {
  772. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  773. ':strCache>__GENERATESTRCACHE__</' . CreateGraphic::NAMESPACEWORD .
  774. ':strCache>__GENERATESTRREF__';
  775. $this->_xmlChart = str_replace(
  776. '__GENERATESTRREF__', $xml, $this->_xmlChart
  777. );
  778. }
  779. /**
  780. * Generate w:ptcount
  781. *
  782. * @access protected
  783. * @param string $val
  784. */
  785. protected function generatePTCOUNT($val = '1')
  786. {
  787. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':ptCount val="' .
  788. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  789. ':ptCount>__GENERATESTRCACHE__';
  790. $this->_xmlChart = str_replace(
  791. '__GENERATESTRCACHE__', $xml, $this->_xmlChart
  792. );
  793. }
  794. /**
  795. * Generate w:pt
  796. *
  797. * @access protected
  798. * @param string $idx
  799. */
  800. protected function generatePT($idx = '0')
  801. {
  802. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':pt idx="' .
  803. $idx . '">__GENERATEPT__</' . CreateGraphic::NAMESPACEWORD .
  804. ':pt>__GENERATESTRCACHE__';
  805. $this->_xmlChart = str_replace(
  806. '__GENERATESTRCACHE__', $xml, $this->_xmlChart
  807. );
  808. }
  809. /**
  810. * Generate w:v
  811. *
  812. * @access protected
  813. * @param string $idx
  814. */
  815. protected function generateV($idx = 'Ventas')
  816. {
  817. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':v>' .
  818. $idx . '</' . CreateGraphic::NAMESPACEWORD . ':v>';
  819. $this->_xmlChart = str_replace(
  820. '__GENERATEPT__', $xml, $this->_xmlChart
  821. );
  822. }
  823. /**
  824. * Generate w:cat
  825. *
  826. * @access protected
  827. */
  828. protected function generateCAT()
  829. {
  830. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  831. ':cat>__GENERATETX__</' . CreateGraphic::NAMESPACEWORD .
  832. ':cat>__GENERATESER__';
  833. $this->_xmlChart = str_replace(
  834. '__GENERATESER__', $xml, $this->_xmlChart
  835. );
  836. }
  837. /**
  838. * Generate w:val
  839. *
  840. * @access protected
  841. */
  842. protected function generateVAL()
  843. {
  844. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  845. ':val>__GENERATETX__</' . CreateGraphic::NAMESPACEWORD .
  846. ':val>__GENERATESER__';
  847. $this->_xmlChart = str_replace(
  848. '__GENERATESER__', $xml, $this->_xmlChart
  849. );
  850. }
  851. /**
  852. * Generate w:numcache
  853. *
  854. * @access protected
  855. */
  856. protected function generateNUMCACHE()
  857. {
  858. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  859. ':numCache>__GENERATESTRCACHE__</' .
  860. CreateGraphic::NAMESPACEWORD . ':numCache>__GENERATESTRREF__';
  861. $this->_xmlChart = str_replace(
  862. '__GENERATESTRREF__', $xml, $this->_xmlChart
  863. );
  864. }
  865. /**
  866. * Generate w:numRef
  867. *
  868. * @access protected
  869. */
  870. protected function generateNUMREF()
  871. {
  872. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  873. ':numRef>__GENERATESTRREF__</' . CreateGraphic::NAMESPACEWORD .
  874. ':numRef>__GENERATETX__';
  875. $this->_xmlChart = str_replace(
  876. '__GENERATETX__', $xml, $this->_xmlChart
  877. );
  878. }
  879. /**
  880. * Generate w:formatCode
  881. *
  882. * @access protected
  883. * @param string $val
  884. */
  885. protected function generateFORMATCODE($val = 'General')
  886. {
  887. $this->_xmlChart = str_replace(
  888. '__GENERATESTRCACHE__',
  889. '<' . CreateGraphic::NAMESPACEWORD . ':formatCode>' . $val .
  890. '</' . CreateGraphic::NAMESPACEWORD .
  891. ':formatCode>__GENERATESTRCACHE__',
  892. $this->_xmlChart
  893. );
  894. }
  895. /**
  896. * Generate w:legend
  897. *
  898. * @access protected
  899. */
  900. protected function generateLEGEND()
  901. {
  902. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  903. ':legend>__GENERATELEGEND__</' .
  904. CreateGraphic::NAMESPACEWORD . ':legend>__GENERATECHART__';
  905. $this->_xmlChart = str_replace(
  906. '__GENERATECHART__',
  907. $xml,
  908. $this->_xmlChart
  909. );
  910. }
  911. /**
  912. * Generate w:legendPos
  913. *
  914. * @access protected
  915. * @param string $val
  916. */
  917. protected function generateLEGENDPOS($val = 'r')
  918. {
  919. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':legendPos val="' .
  920. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  921. ':legendPos>__GENERATELEGEND__';
  922. $this->_xmlChart = str_replace(
  923. '__GENERATELEGEND__', $xml, $this->_xmlChart
  924. );
  925. }
  926. /**
  927. * Generate c:layout
  928. *
  929. * @access protected
  930. * @param string $font
  931. */
  932. protected function generateLEGENDFONT($font = '')
  933. {
  934. $xml = '<c:layout /><c:txPr><a:bodyPr /><a:lstStyle />' .
  935. '<a:p><a:pPr><a:defRPr><a:latin typeface="' . $font .
  936. '" pitchFamily="34" charset="0" /><a:cs typeface="' .
  937. $font . '" pitchFamily="34" charset="0" /></a:defRPr>' .
  938. '</a:pPr><a:endParaRPr lang="es-ES" /></a:p></c:txPr>';
  939. $this->_xmlChart = str_replace(
  940. '__GENERATELEGEND__', $xml, $this->_xmlChart
  941. );
  942. }
  943. /**
  944. * Generate w:poltVisOnly
  945. *
  946. * @access protected
  947. * @param string $val
  948. */
  949. protected function generatePLOTVISONLY($val = '1')
  950. {
  951. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':plotVisOnly val="' .
  952. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  953. ':plotVisOnly>__GENERATECHART__';
  954. $this->_xmlChart = str_replace(
  955. '__GENERATECHART__', $xml, $this->_xmlChart
  956. );
  957. }
  958. /**
  959. * Generate w:externalData
  960. *
  961. * @access protected
  962. * @param string $val
  963. */
  964. protected function generateEXTERNALDATA($val = 'rId1')
  965. {
  966. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  967. ':externalData r:id="' . $val . '"></' .
  968. CreateGraphic::NAMESPACEWORD . ':externalData>';
  969. $this->_xmlChart = str_replace(
  970. '__GENERATECHARTSPACE__', $xml, $this->_xmlChart
  971. );
  972. }
  973. /**
  974. * Generate w:spPr
  975. *
  976. * @access protected
  977. */
  978. protected function generateSPPR()
  979. {
  980. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  981. ':spPr>__GENERATESPPR__</' . CreateGraphic::NAMESPACEWORD .
  982. ':spPr>__GENERATECHARTSPACE__';
  983. $this->_xmlChart = str_replace(
  984. '__GENERATECHARTSPACE__', $xml, $this->_xmlChart
  985. );
  986. }
  987. /**
  988. * Generate w:ln
  989. *
  990. * @access protected
  991. */
  992. protected function generateLN()
  993. {
  994. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':ln>__GENERATELN__</' .
  995. CreateImage::NAMESPACEWORD1 . ':ln>';
  996. $this->_xmlChart = str_replace(
  997. '__GENERATESPPR__', $xml, $this->_xmlChart
  998. );
  999. }
  1000. /**
  1001. * Generate w:noFill
  1002. *
  1003. * @access protected
  1004. */
  1005. protected function generateNOFILL()
  1006. {
  1007. $xml = '<' . CreateImage::NAMESPACEWORD1 . ':noFill></' .
  1008. CreateImage::NAMESPACEWORD1 . ':noFill>';
  1009. $this->_xmlChart = str_replace(
  1010. '__GENERATELN__', $xml, $this->_xmlChart
  1011. );
  1012. }
  1013. /**
  1014. * Generate w:overlap
  1015. *
  1016. * @access protected
  1017. * @param string $val
  1018. */
  1019. protected function generateOVERLAP($val = '100')
  1020. {
  1021. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':overlap val="' .
  1022. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1023. ':overlap>__GENERATETYPECHART__';
  1024. $this->_xmlChart = str_replace(
  1025. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  1026. );
  1027. }
  1028. /**
  1029. * Generate w:shape
  1030. *
  1031. * @access protected
  1032. * @param string $val
  1033. */
  1034. protected function generateSHAPE($val = 'box')
  1035. {
  1036. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':shape val="' .
  1037. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1038. ':shape>__GENERATETYPECHART__';
  1039. $this->_xmlChart = str_replace(
  1040. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  1041. );
  1042. }
  1043. /**
  1044. * Generate w:axid
  1045. *
  1046. * @access protected
  1047. * @param string $val
  1048. */
  1049. protected function generateAXID($val = '59034624')
  1050. {
  1051. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':axId val="' .
  1052. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1053. ':axId>__GENERATETYPECHART__';
  1054. $this->_xmlChart = str_replace(
  1055. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  1056. );
  1057. }
  1058. /**
  1059. * Generate w:firstSliceAng
  1060. *
  1061. * @access protected
  1062. * @param string $val
  1063. */
  1064. protected function generateFIRSTSLICEANG($val = '0')
  1065. {
  1066. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1067. ':firstSliceAng val="' . $val . '"></' .
  1068. CreateGraphic::NAMESPACEWORD . ':firstSliceAng>';
  1069. $this->_xmlChart = str_replace(
  1070. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  1071. );
  1072. }
  1073. /**
  1074. * Generate w:dLbls
  1075. *
  1076. * @access protected
  1077. */
  1078. protected function generateDLBLS()
  1079. {
  1080. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1081. ':dLbls>__GENERATEDLBLS__</' . CreateGraphic::NAMESPACEWORD .
  1082. ':dLbls>__GENERATETYPECHART__';
  1083. $this->_xmlChart = str_replace(
  1084. '__GENERATETYPECHART__', $xml, $this->_xmlChart
  1085. );
  1086. }
  1087. /**
  1088. * Generate w:showPercent
  1089. *
  1090. * @access protected
  1091. * @param string $val
  1092. */
  1093. protected function generateSHOWPERCENT($val = '0')
  1094. {
  1095. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1096. ':showPercent val="' . $val . '"></' .
  1097. CreateGraphic::NAMESPACEWORD . ':showPercent>';
  1098. $this->_xmlChart = str_replace(
  1099. '__GENERATEDLBLS__', $xml, $this->_xmlChart
  1100. );
  1101. }
  1102. /**
  1103. * Generate w:chart
  1104. *
  1105. * @access protected
  1106. */
  1107. protected function generateDOCUMENTCHART()
  1108. {
  1109. $this->_xml = str_replace(
  1110. '__GENERATEGRAPHICDATA__',
  1111. '<' . CreateGraphic::NAMESPACEWORD .
  1112. ':chart xmlns:c="http://schemas.openxmlformats.org/drawingml/' .
  1113. '2006/chart" xmlns:r="http://schemas.openxmlformats.org/offic' .
  1114. 'eDocument/2006/relationships" r:id="rId' . $this->getRId() .
  1115. '"></' . CreateGraphic::NAMESPACEWORD .
  1116. ':chart>',
  1117. $this->_xml
  1118. );
  1119. }
  1120. /**
  1121. * Generate w:catAx
  1122. *
  1123. * @access protected
  1124. */
  1125. protected function generateCATAX()
  1126. {
  1127. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1128. ':catAx>__GENERATEAX__</' . CreateGraphic::NAMESPACEWORD .
  1129. ':catAx>__GENERATEPLOTAREA__';
  1130. $this->_xmlChart = str_replace(
  1131. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  1132. );
  1133. }
  1134. /**
  1135. * Generate w:valAx
  1136. *
  1137. * @access protected
  1138. */
  1139. protected function generateVALAX()
  1140. {
  1141. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1142. ':valAx>__GENERATEAX__</' .
  1143. CreateGraphic::NAMESPACEWORD .
  1144. ':valAx>';
  1145. $this->_xmlChart = str_replace(
  1146. '__GENERATEPLOTAREA__', $xml, $this->_xmlChart
  1147. );
  1148. }
  1149. /**
  1150. * Generate w:axId
  1151. *
  1152. * @access protected
  1153. * @param <type> $val
  1154. */
  1155. protected function generateAXAXID($val = '59034624')
  1156. {
  1157. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':axId val="' .
  1158. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1159. ':axId>__GENERATEAX__';
  1160. $this->_xmlChart = str_replace(
  1161. '__GENERATEAX__', $xml, $this->_xmlChart
  1162. );
  1163. }
  1164. /**
  1165. * Generate w:scaling
  1166. *
  1167. * @access protected
  1168. */
  1169. protected function generateSCALING()
  1170. {
  1171. $xml = '<' . CreateGraphic::NAMESPACEWORD .
  1172. ':scaling>__GENERATESCALING__</' . CreateGraphic::NAMESPACEWORD .
  1173. ':scaling>__GENERATEAX__';
  1174. $this->_xmlChart = str_replace(
  1175. '__GENERATEAX__', $xml, $this->_xmlChart
  1176. );
  1177. }
  1178. /**
  1179. * Generate w:orientation
  1180. *
  1181. * @access protected
  1182. * @param string $val
  1183. */
  1184. protected function generateORIENTATION($val = 'minMax')
  1185. {
  1186. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':orientation val="' .
  1187. $val . '"></' . CreateGraphic::NAMESPACEWORD . ':orientation>';
  1188. $this->_xmlChart = str_replace(
  1189. '__GENERATESCALING__', $xml, $this->_xmlChart
  1190. );
  1191. }
  1192. /**
  1193. * Generate w:axPos
  1194. *
  1195. * @access protected
  1196. * @param string $val
  1197. */
  1198. protected function generateAXPOS($val = 'b')
  1199. {
  1200. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':axPos val="' . $val .
  1201. '"></' . CreateGraphic::NAMESPACEWORD . ':axPos>__GENERATEAX__';
  1202. $this->_xmlChart = str_replace(
  1203. '__GENERATEAX__', $xml, $this->_xmlChart
  1204. );
  1205. }
  1206. /**
  1207. * Generate w:tickLblPos
  1208. *
  1209. * @access protected
  1210. * @param string $val
  1211. */
  1212. protected function generateTICKLBLPOS($val = 'nextTo')
  1213. {
  1214. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':tickLblPos val="' .
  1215. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1216. ':tickLblPos>__GENERATEAX__';
  1217. $this->_xmlChart = str_replace(
  1218. '__GENERATEAX__', $xml, $this->_xmlChart
  1219. );
  1220. }
  1221. /**
  1222. * Generate w:crossAx
  1223. *
  1224. * @access protected
  1225. * @param string $val
  1226. */
  1227. protected function generateCROSSAX($val = '59040512')
  1228. {
  1229. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':crossAx val="' .
  1230. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1231. ':crossAx >__GENERATEAX__';
  1232. $this->_xmlChart = str_replace(
  1233. '__GENERATEAX__', $xml, $this->_xmlChart
  1234. );
  1235. }
  1236. /**
  1237. * Generate w:crosses
  1238. *
  1239. * @access protected
  1240. * @param string $val
  1241. */
  1242. protected function generateCROSSES($val = 'autoZero')
  1243. {
  1244. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':crosses val="' .
  1245. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1246. ':crosses>__GENERATEAX__';
  1247. $this->_xmlChart = str_replace(
  1248. '__GENERATEAX__', $xml, $this->_xmlChart
  1249. );
  1250. }
  1251. /**
  1252. * Generate w:auto
  1253. *
  1254. * @access protected
  1255. * @param string $val
  1256. */
  1257. protected function generateAUTO($val = '1')
  1258. {
  1259. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':auto val="' .
  1260. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1261. ':auto>__GENERATEAX__';
  1262. $this->_xmlChart = str_replace(
  1263. '__GENERATEAX__', $xml, $this->_xmlChart
  1264. );
  1265. }
  1266. /**
  1267. * Generate w:lblAlgn
  1268. *
  1269. * @access protected
  1270. * @param string $val
  1271. */
  1272. protected function generateLBLALGN($val = 'ctr')
  1273. {
  1274. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':lblAlgn val="' .
  1275. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1276. ':lblAlgn>__GENERATEAX__';
  1277. $this->_xmlChart = str_replace(
  1278. '__GENERATEAX__', $xml, $this->_xmlChart
  1279. );
  1280. }
  1281. /**
  1282. * Generate w:lblOffset
  1283. *
  1284. * @access protected
  1285. * @param string $val
  1286. */
  1287. protected function generateLBLOFFSET($val = '100')
  1288. {
  1289. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':lblOffset val="' .
  1290. $val . '"></' . CreateGraphic::NAMESPACEWORD . ':lblOffset>';
  1291. $this->_xmlChart = str_replace(
  1292. '__GENERATEAX__', $xml, $this->_xmlChart
  1293. );
  1294. }
  1295. /**
  1296. * Generate w:majorGridlines
  1297. *
  1298. * @access protected
  1299. */
  1300. protected function generateMAJORGRIDLINES()
  1301. {
  1302. $xml = '<' . CreateGraphic::NAMESPACEWORD . ':majorGridlines></' .
  1303. CreateGraphic::NAMESPACEWORD . ':majorGridlines>__GENERATEAX__';
  1304. $this->_xmlChart = str_replace(
  1305. '__GENERATEAX__', $xml, $this->_xmlChart
  1306. );
  1307. }
  1308. /**
  1309. * Generate w:numFmt
  1310. *
  1311. * @access protected
  1312. * @param string $formatCode
  1313. * @param string $sourceLinked
  1314. */
  1315. protected function generateNUMFMT($formatCode='General',
  1316. $sourceLinked = '1')
  1317. {
  1318. $this->_xmlChart = str_replace(
  1319. '__GENERATEAX__', '<' .
  1320. CreateGraphic::NAMESPACEWORD .
  1321. ':numFmt formatCode="' . $formatCode .
  1322. '" sourceLinked="' . $sourceLinked . '"></' .
  1323. CreateGraphic::NAMESPACEWORD . ':numFmt>__GENERATEAX__',
  1324. $this->_xmlChart
  1325. );
  1326. }
  1327. /**
  1328. * Generate w:crossBetween
  1329. *
  1330. * @access protected
  1331. * @param string $val
  1332. */
  1333. protected function generateCROSSBETWEEN($val = 'between')
  1334. {
  1335. $this->_xmlChart = str_replace(
  1336. '__GENERATEAX__', '<' .
  1337. CreateGraphic::NAMESPACEWORD . ':crossBetween val="' .
  1338. $val . '"></' . CreateGraphic::NAMESPACEWORD .
  1339. ':crossBetween>',
  1340. $this->_xmlChart
  1341. );
  1342. }
  1343. /**
  1344. * Create chart xml
  1345. *
  1346. * @access protected
  1347. * @param array $args[0]
  1348. */
  1349. protected function createCHARTXML()
  1350. {
  1351. $this->_xmlChart = '';
  1352. $args = func_get_args();
  1353. $type = $args[0][1]['type'];
  1354. $this->setRId($args[0][0]);
  1355. $this->generateCHARTSPACE();
  1356. $this->generateDATE1904(1);
  1357. $this->generateLANG();
  1358. $this->generateSTYLE();
  1359. $this->generateCHART();
  1360. if (!empty($args[0][1]['title'])) {
  1361. $this->generateTITLE();
  1362. $title = $args[0][1]['title'];
  1363. $this->generateTITLETX();
  1364. $this->generateRICH();
  1365. $this->generateBODYPR();
  1366. $this->generateLSTSTYLE();
  1367. $this->generateTITLEP();
  1368. $this->generateTITLEPPR();
  1369. $this->generateDEFRPR();
  1370. if (!empty($args[0][1]['font'])) {
  1371. $this->generateRFONTS($args[0][1]['font']);
  1372. }
  1373. $this->generateTITLER();
  1374. $this->generateTITLERPR();
  1375. if (!empty($args[0][1]['font'])) {
  1376. $this->generateTITLERFONTS($args[0][1]['font']);
  1377. }
  1378. $this->generateTITLET($title);
  1379. $this->generateTITLELAYOUT();
  1380. } else {
  1381. $this->generateAUTOTITLEDELETED();
  1382. $title = '';
  1383. }
  1384. if (empty($args[0][1]['data'])) {
  1385. exit('You haven`t added data');
  1386. }
  1387. $dats = $args[0][1]['data'];
  1388. $this->generatePLOTAREA();
  1389. $this->generateLAYOUT();
  1390. if (strpos($type, 'pie') !== false) {
  1391. $this->generatePIECHART();
  1392. $this->generateVARYCOLORS();
  1393. if (isset($dats[0])) {
  1394. $legends = $dats[0];
  1395. } else {
  1396. $legends = array($title);
  1397. }
  1398. $sizeDats = count($dats);
  1399. } elseif (
  1400. (strpos($type, 'bar') !== false) ||
  1401. (strpos($type, 'col') !== false)
  1402. ) {
  1403. $this->generateBARCHART();
  1404. $typeBar = 'bar';
  1405. if (strpos($type, 'col') !== false) {
  1406. $typeBar = 'col';
  1407. }
  1408. $this->generateBARDIR($typeBar);
  1409. $groupBar = 'clustered';
  1410. $this->generateGROUPING($groupBar);
  1411. if (isset($dats[0])) {
  1412. $legends = $dats[0];
  1413. } else {
  1414. echo('You must write a legend');
  1415. return false;
  1416. }
  1417. $sizeDats = count($dats) - 1;
  1418. } elseif (strpos($type, 'line') !== false) {
  1419. $this->generateLINECHART();
  1420. $this->generateGROUPING('standard');
  1421. if (isset($dats[0])) $legends = $dats[0];
  1422. else {
  1423. echo('You must write a legend');
  1424. return false;
  1425. }
  1426. $sizeDats = count($dats) - 1;
  1427. } else {
  1428. echo('The graphic is not available');
  1429. return false;
  1430. }
  1431. $chart = 'A';
  1432. for ($i = 0; $i < count($legends); $i++) {
  1433. $this->generateSER();
  1434. $this->generateIDX($i);
  1435. $this->generateORDER($i);
  1436. $chart++;
  1437. $this->generateTX();
  1438. $this->generateSTRREF();
  1439. $this->generateF(' Hoja1!$' . $chart . '$1');
  1440. $this->generateSTRCACHE();
  1441. $this->generatePTCOUNT();
  1442. $this->generatePT();
  1443. if (strpos($args[0][1]['type'], 'pie') !== false) {
  1444. $this->generateV($title);
  1445. } else {
  1446. $this->generateV($legends[$i]);
  1447. }
  1448. $this->cleanTemplate2();
  1449. $this->generateCAT();
  1450. $this->generateSTRREF();
  1451. $this->generateF('Hoja1!$A$2:$A$' . ($sizeDats + 1));
  1452. $this->generateSTRCACHE();
  1453. $this->generatePTCOUNT($sizeDats);
  1454. $num = 0;
  1455. foreach ($dats as $legend => $dat) {
  1456. if ($legend == '0') continue;
  1457. $this->generatePT($num);
  1458. $this->generateV($legend);
  1459. $num++;
  1460. }
  1461. $this->cleanTemplate2();
  1462. $this->generateVAL();
  1463. $this->generateNUMREF();
  1464. $this->generateF('Hoja1!$' . $chart . '$2:$B$' . ($sizeDats + 1));
  1465. $this->generateNUMCACHE();
  1466. $this->generateFORMATCODE();
  1467. $this->generatePTCOUNT($sizeDats);
  1468. $num = 0;
  1469. foreach ($dats as $legend => $dat) {
  1470. if ($legend == '0') continue;
  1471. $this->generatePT($num);
  1472. $this->generateV($dat[$i]);
  1473. $num++;
  1474. }
  1475. $this->cleanTemplate3();
  1476. }
  1477. if (strpos($args[0][1]['type'], 'pie') !== false) {
  1478. $this->generateDLBLS();
  1479. $this->generateSHOWPERCENT();
  1480. $this->generateFIRSTSLICEANG();
  1481. } else {
  1482. $this->generateSHAPE();
  1483. $this->generateAXID();
  1484. $this->generateAXID(59040512);
  1485. $this->generateCATAX();
  1486. $this->generateAXAXID(59034624);
  1487. $this->generateSCALING();
  1488. $this->generateORIENTATION();
  1489. $this->generateAXPOS();
  1490. $this->generateTICKLBLPOS();
  1491. $this->generateCROSSAX();
  1492. $this->generateCROSSES();
  1493. $this->generateAUTO();
  1494. $this->generateLBLALGN();
  1495. $this->generateLBLOFFSET();
  1496. $this->generateVALAX();
  1497. $this->generateAXAXID(59040512);
  1498. $this->generateSCALING();
  1499. $this->generateORIENTATION();
  1500. $this->generateAXPOS('l');
  1501. $this->generateMAJORGRIDLINES();
  1502. $this->generateNUMFMT();
  1503. $this->generateTICKLBLPOS();
  1504. if (!empty($args[0][1]['font'])) {
  1505. $this->generateRFONTS2($args[0][1]['font']);
  1506. }
  1507. $this->generateCROSSAX(59034624);
  1508. $this->generateCROSSES();
  1509. $this->generateCROSSBETWEEN();
  1510. }
  1511. $this->generateLEGEND();
  1512. $this->generateLEGENDPOS();
  1513. if (!empty($args[0][1]['font'])) {
  1514. $this->generateLEGENDFONT($args[0][1]['font']);
  1515. }
  1516. $this->generatePLOTVISONLY();
  1517. if (strpos($args[0][1]['type'], 'pieChart') === false) {
  1518. $this->generateSPPR();
  1519. $this->generateLN();
  1520. $this->generateNOFILL();
  1521. }
  1522. $this->generateEXTERNALDATA();
  1523. $this->cleanTemplateDocument();
  1524. return true;
  1525. }
  1526. /**
  1527. * Create document xml
  1528. *
  1529. * @access protected
  1530. * @param array $args[0]
  1531. */
  1532. protected function createDOCUEMNTXML()
  1533. {
  1534. $args = func_get_args();
  1535. $ajusteTexto = 0;
  1536. if (isset($args[0][1]['sizeX']))
  1537. $sizeX = $args[0][1]['sizeX'] * CreateImage::CONSTWORD;
  1538. else {
  1539. $sizeX = 2993296;
  1540. }
  1541. if (isset($args[0][1]['sizeY']))
  1542. $sizeY = $args[0][1]['sizeY'] * CreateImage::CONSTWORD;
  1543. else {
  1544. $sizeY = 2238233;
  1545. }
  1546. $this->_xml = '';
  1547. $this->generateP();
  1548. $this->generateR();
  1549. $this->generateRPR();
  1550. $this->generateNOPROOF();
  1551. $this->generateDRAWING();
  1552. $this->generateINLINE();
  1553. $this->generateEXTENT($sizeX, $sizeY);
  1554. $this->generateEFFECTEXTENT();
  1555. $this->generateDOCPR();
  1556. $this->generateCNVGRAPHICFRAMEPR();
  1557. $this->generateGRAPHIC();
  1558. $this->generateGRAPHICDATA(
  1559. 'http://schemas.openxmlformats.org/'.
  1560. 'drawingml/2006/chart'
  1561. );
  1562. $this->generateDOCUMENTCHART();
  1563. $this->cleanTemplate();
  1564. return true;
  1565. }
  1566. /**
  1567. * Clean tags in template document
  1568. *
  1569. * @access protected
  1570. */
  1571. private function cleanTemplateDocument()
  1572. {
  1573. $this->_xmlChart = preg_replace('/__[A-Z]+__/', '', $this->_xmlChart);
  1574. }
  1575. /**
  1576. * Clean tags in template document
  1577. *
  1578. * @access protected
  1579. */
  1580. private function cleanTemplate2()
  1581. {
  1582. $this->_xmlChart = preg_replace(
  1583. array(
  1584. '/__GENERATE[A-B,D-O,Q-R,U-Z][A-Z]+__/',
  1585. '/__GENERATES[A-D,F-Z][A-Z]+__/', '/__GENERATETX__/'),
  1586. '',
  1587. $this->_xmlChart
  1588. );
  1589. }
  1590. /**
  1591. * Clean tags in template document
  1592. *
  1593. * @access protected
  1594. */
  1595. private function cleanTemplate3()
  1596. {
  1597. $this->_xmlChart = preg_replace(
  1598. array(
  1599. '/__GENERATE[A-B,D-O,Q-S,U-Z][A-Z]+__/',
  1600. '/__GENERATES[A-D,F-Z][A-Z]+__/',
  1601. '/__GENERATETX__/'
  1602. ),
  1603. '',
  1604. $this->_xmlChart
  1605. );
  1606. }
  1607. /**
  1608. * Generate c:txPr
  1609. *
  1610. * @access protected
  1611. * @param string $font
  1612. */
  1613. private function generateRFONTS2($font)
  1614. {
  1615. $this->_xmlChart = str_replace(
  1616. '__GENERATEAX__',
  1617. '<c:txPr><a:bodyPr /><a:lstStyle /><a:p>' .
  1618. '<a:pPr><a:defRPr><a:latin typeface="' .
  1619. $font . '" pitchFamily="34" charset="0" /><a:cs typeface="' .
  1620. $font . '" pitchFamily="34" charset="0" /></a:defRPr>' .
  1621. '</a:pPr><a:endParaRPr lang="es-ES" /></a:p></c:txPr>' .
  1622. '__GENERATEAX__', $this->_xmlChart
  1623. );
  1624. }
  1625. }