面积图
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)// 值为 1 - 48,可参考 Excel 2007 "设计" 选项卡中的 48 种样式
16
->axisNameX('Test number') // 设置 X 轴名称
17
->axisNameY('Sample length (mm)') // 设置 Y 轴名称
18
->title('Results of sample analysis') // 设置图表 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