chart_line.phpt 795 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php if (!extension_loaded("xlswriter")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $config = [
  8. 'path' => './tests'
  9. ];
  10. $fileObject = new \Vtiful\Kernel\Excel($config);
  11. $fileObject = $fileObject->fileName('tutorial.xlsx');
  12. $fileHandle = $fileObject->getHandle();
  13. $chart = new \Vtiful\Kernel\Chart($fileHandle, \Vtiful\Kernel\Chart::CHART_LINE);
  14. $chartResource = $chart->series('Sheet1!$A$2:$A$7')->toResource();
  15. $filePath = $fileObject->header(['number'])
  16. ->data([
  17. [10],
  18. [40],
  19. [50],
  20. [20],
  21. [10],
  22. [50],
  23. ])
  24. ->insertChart(0, 3, $chartResource)
  25. ->output();
  26. var_dump($filePath);
  27. ?>
  28. --CLEAN--
  29. <?php
  30. @unlink(__DIR__ . '/tutorial.xlsx');
  31. ?>
  32. --EXPECT--
  33. string(21) "./tests/tutorial.xlsx"