Modifying 33chartcreate-multiple-charts.php for multiple worksheets

Topics: Developer Forum, User Forum
Mar 26, 2013 at 1:19 PM
Hi all,

can anyone provide a sample code for creating the same chart from different data, each worksheet containing one chart? I tried to modify 33chartcreate-multiple-charts.php but I couldn't get that working.
Mar 27, 2013 at 7:08 AM
Edited Mar 27, 2013 at 7:09 AM
Got it:

I inserted
$s_n1="'".$t_User_Name."'!B$1";   # notice the missing "$" between "!" and the cell identifier.
$s_n2="'".$t_User_Name."'!C$1";
$s_n3="'".$t_User_Name."'!D$1";
$s_n4="'".$t_User_Name."'!A$2:A$13";
$s_n5="'".$t_User_Name."'!B$2:B$13";
$s_n6="'".$t_User_Name."'!C$2:C$13";
$s_n7="'".$t_User_Name."'!D$2:D$13";
and changed
$dataseriesLabels2 = array(
    new PHPExcel_Chart_DataSeriesValues('String', $s_n1, null, 1),
    new PHPExcel_Chart_DataSeriesValues('String', $s_n2, null, 1),
    new PHPExcel_Chart_DataSeriesValues('String', $s_n3, null, 1),
);

$xAxisTickValues2 = array(
    new PHPExcel_Chart_DataSeriesValues('String', $s_n4, null, 12),);

$dataSeriesValues2 = array(
    new PHPExcel_Chart_DataSeriesValues('Number', $s_n5, null, 12),
    new PHPExcel_Chart_DataSeriesValues('Number', $s_n6, null, 12),
    new PHPExcel_Chart_DataSeriesValues('Number', $s_n7, null, 12)
);
Thanks to daserato for the hint (though I think he isn't aware of that :) )

Regards
Christian