1

I have started using PHPExcel 1.7.9 for creating different types of charts. I want to hide Legend. I have tried many possible solutions but coudn't be able to find the exact way. First I tried to empty the first parameter of PHPExcel_Chart_Legend like this

$legend = new PHPExcel_Chart_Legend('', NULL, false);

It started to show my Legend at right side in vertical position. Then I tried to empty the Legend parameter of PHPExcel_Chart but it generated an error like follow

  // Create the chart
    $chart = new PHPExcel_Chart(
                    'chart1', // name
                    $title, // title
                    '', // legend
                    $plotarea, // plotArea
                    true, // plotVisibleOnly
                    0, // displayBlanksAs
                    $xAxisLabel, // xAxisLabel
                    $yAxisLabel // yAxisLabel
    );

I have tried to search it out but still not succeeded. Please advice a way so that I can hide legends in my charts.

Best Regards

Awais Qarni
  • 17,492
  • 24
  • 75
  • 137

1 Answers1

1

To suppress the legend, simply set it to NULL

// Create the chart
$chart = new PHPExcel_Chart(
    'chart1',      // name
    $title,        // title
    NULL,          // legend
    $plotarea,     // plotArea
    true,          // plotVisibleOnly
    0,             // displayBlanksAs
    $xAxisLabel,   // xAxisLabel
    $yAxisLabel    // yAxisLabel
);
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • This is what I was needed. +1 . I have asked an other question related to it at http://stackoverflow.com/questions/19086646/create-multi-color-bar-in-phpexcel-charts . Kindly response there too. – Awais Qarni Sep 30 '13 at 04:55
  • Please have a look on this question too. http://stackoverflow.com/questions/19094890/some-questions-about-phpexcel-charts – Awais Qarni Oct 01 '13 at 04:38