2017-09-22 1 views
0

Mon code est donné ci-dessous:Comment changer la police de titre de l'axe des x de l'axe PHPExcel Taille et couleur?

$xAxisTickValuesVS = array(
    new PHPExcel_Chart_DataSeriesValues('String', '\''.$wsname.'\'!$H$3:$H$'.($intwstartrow+count($arrscalevs)-1), NULL, count($arrscalevs)) // Vehicle Speed 
); 

$dataSeriesValuesVS = array(
    new PHPExcel_Chart_DataSeriesValues('Number', '\''.$wsname.'\'!$K$3:$K$'.($intwstartrow+count($arrscalevs)-1), NULL, count($arrscalevs))       
); 

$seriesVS = new PHPExcel_Chart_DataSeries(
    PHPExcel_Chart_DataSeries::TYPE_BARCHART,  // plotType 
    PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping 
    range(0, count($dataSeriesValuesVS)-1),   // plotOrder 
    NULL, 
    $xAxisTickValuesVS,        // plotCategory 
    $dataSeriesValuesVS        // plotValues 
); 

$seriesVS->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL); 
$layoutVS = new PHPExcel_Chart_Layout(); 
$layoutVS->setShowVal(TRUE);  // Initializing the data labels with Values 
$layoutVS->setShowPercent(TRUE); // Initializing the data labels with Percentages 
$plotAreaVS = new PHPExcel_Chart_PlotArea($layoutVS, array($seriesVS));     
$titleVS = new PHPExcel_Chart_Title('Vehicle Speed Utilization'); 
$xAxisLabelVS = new PHPExcel_Chart_Title('Speed (Kmph)');      
$yAxisLabelVS = new PHPExcel_Chart_Title('(%) Utlization'); 

$chartVS = new PHPExcel_Chart(
    'chartVS',  // name 
    $titleVS,   // title 
    NULL,  // legend 
    $plotAreaVS,  // plotArea 
    true,   // plotVisibleOnly 
    0,    // displayBlanksAs 
    $xAxisLabelVS,   // xAxisLabel 
    $yAxisLabelVS  // yAxisLabel 
); 

$chartVS->setTopLeftPosition('M3'); 
$chartVS->setBottomRightPosition('V17'); 

$objWorksheet->addChart($chartVS); 

Répondre

0

Malheureusement vous ne pouvez pas le faire pour le moment.

pull request Pour appliquer cette fonctionnalité de 2 ans (vous pouvez consulter l'implémentation proposée here).

+0

Actuellement, l'application d'un titre le montre avec la même taille de police que celle du titre du graphique car les deux utilisent la même classe de titre de graphique. Il semble surdimensionné pour le titre xaxis et avec Legends, il semble un peu étrange. –