Area chart
1
$config = ['path' => './tests'];
2
3
$fileObject = new \Vtiful\Kernel\Excel($config);
4
5
$fileObject = $fileObject->fileName('tutorial.xlsx');
6
$fileHandle = $fileObject->getHandle();
7
8
$chart = new \Vtiful\Kernel\Chart($fileHandle, \Vtiful\Kernel\Chart::CHART_AREA);
9
10
$chartResource = $chart
11
->series('=Sheet1!$B$2:$B$7', '=Sheet1!$A$2:$A$7')
12
->seriesName('=Sheet1!$B$1')
13
->series('=Sheet1!$C$2:$C$7', '=Sheet1!$A$2:$A$7')
14
->seriesName('=Sheet1!$C$1')
15
->style(11)// Values ​​1 - 48, refer to 48 styles in the Excel 2007 Design tab
16
->axisNameX('Test number') // Set the X axis name
17
->axisNameY('Sample length (mm)') // Set the Y axis name
18
->title('Results of sample analysis') // Set the chart Title
19
->toResource();
20
21
$filePath = $fileObject->header(['Number', 'Batch 1', 'Batch 2'])
22
->data([
23
[2, 40, 30],
24
[3, 40, 25],
25
[4, 50, 30],
26
[5, 30, 10],
27
[6, 25, 5],
28
[7, 50, 10],
29
])->insertChart(0, 3, $chartResource)->output();
Copied!
Last modified 2yr ago
Copy link