0

有没有办法设置我们的图表,让它看起来像这样.. http://www.epicstan.com/graf.jpg

我们不知道如何摆脱图表周围的数字。

这是生成的文件http://www.epicstan.com/export.xlsx在表 2 上,我们需要更改该图形的外观。

这是代码..

<?php
/* part of generater code */
/* charts */
$dataSeriesValues = array(  
    new \PHPExcel_Chart_DataSeriesValues('Number', 'sheet2!$I$'.(($i*5)+3).':$I$'.(($i*5)+5), NULL, 6),
);

//  Build the dataseries
$series = new \PHPExcel_Chart_DataSeries(
\PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D, // plotType
    NULL,
    range(0, count($dataSeriesValues)-1),
    NULL,
    NULL,
    $dataSeriesValues
);

$series->setPlotDirection(\PHPExcel_Chart_DataSeries::DIRECTION_BAR);

$layout = new \PHPExcel_Chart_Layout();
$layout->setManual3dAlign(true);
$layout->setXRotation(10);
$layout->setYRotation(20);
$layout->setRightAngleAxes(1);
$layout->setShowVal(true);

$plotarea = new \PHPExcel_Chart_PlotArea($layout, array($series));


$chart = new \PHPExcel_Chart(
    'chart1',
    NULL,
    NULL,
    $plotarea,
    true,
    0,
    NULL,
    NULL
);

$chart->setTopLeftPosition('I'.(($i*5)+2));
$chart->setBottomRightPosition('J'.(($i*5)+8));

$excel->getActiveSheet()->addChart($chart);

$excel->setActiveSheetIndex(0);


$objWriter = new \PHPExcel_Writer_Excel2007($excel);
$objWriter->setIncludeCharts(TRUE);
$file = DOWNLOAD_DIR . 'export.xlsx';
$objWriter->save($file);

谢谢你。

彼得

4

1 回答 1

0

更改 dataseries 构造函数的参数以设置一系列空的字符串 plotCategories:

//  Build the dataseries
$series = new \PHPExcel_Chart_DataSeries(
    \PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D, // plotType
    NULL,
    range(0, count($dataSeriesValues)-1),
    NULL,
    new \PHPExcel_Chart_DataSeriesValues(
        'String', 
        NULL, 
        NULL, 
        count($dataSeriesValues)
    ),
    $dataSeriesValues
);
于 2013-08-28T19:29:02.067 回答