PhpWord雷达图,将轴比例更改为从0开始

时间:2019-07-16 17:32:59

标签: phpword phpoffice

我正在使用PHPWord生成Radar Chart,需要强制轴从0开始,但是从最小值开始

$categories = $series = [];
foreach ($groups as $gId => $score) {
  $series[] = round($score, 2);
  $categories[] = $groups[$gId]->getName();
}
$section->addPageBreak();
$section->addText('Radar Chart', 'chartTitle', ['alignment' => 'center']);
$chart = $section->addChart('radar', $categories, $series, [
  'width' => Converter::cmToEmu(17.7), 
  'height' => Converter::cmToEmu(10.8), 
  'dataLabelOptions' => [
    'showVal'     => true,
    'showCatName' => false,
    'showPercent' => true
  ],
  'colors' => ['dc3545']
]);
$chart->getStyle()->setShowGridY(true);
$chart->getStyle()->setShowGridX(true);
$chart->getStyle()->setShowAxisLabels(true);

Attachment: Axe value start from 7.6

0 个答案:

没有答案