affaz affaz - 4 years ago 104
PHP Question

Generate Excel file with chart with data from mysql database using PHP

I want to generate an excel file with chart based on the data from MySQL database using PHP with PHPExcel Library.
I searched a lot..but could not find a solution
Values are exported to the excel file.but the chart doesnt show up.

require_once 'includes/PHPExcel-1.8/Classes/PHPExcel.php';

//Data Series Labels
new PHPExcel_Chart_DataSeriesValues('String', 'Data!$C$1', NULL, 1),
new PHPExcel_Chart_DataSeriesValues('String', 'Data!$D$1', NULL, 1),

//X Axis Value Label
new PHPExcel_Chart_DataSeriesValues('String', 'Data!$C$2:$C$91', NULL, 90),
//Data Series Values
new PHPExcel_Chart_DataSeriesValues('Number', 'Data!$C$2:$C$91', NULL, 90),
new PHPExcel_Chart_DataSeriesValues('Number', 'Data!$D$2:$D$91', NULL, 90),
//set up Data Series
$ds=new PHPExcel_Chart_DataSeries(
range(0, count($dsv)-1),
//create the Plot Area and Legend
$pa=new PHPExcel_Chart_PlotArea(NULL, array($ds));
$legend=new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
//create chart
$chart= new PHPExcel_Chart(

//title of chart
$title=new PHPExcel_Chart_Title('Any literal string');

$writer = PHPExcel_IOFactory::createWriter($ea, 'Excel5');


Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download