the following is working code:
$openchart->type("BarChart");
$openchart->options(array('title' => "Opens Stats"));
$openchart->columns(array(
'Date' => array(
'type' => 'string',
'label' => 'Date'
),
'yahoo.com' => array(
'type' => 'number',
'label' => 'yahoo.com'
)
));
$openchart->addRow(array('Date' => "Today", 'yahoo.com'=> $chart['yahoo.com']['opentoday']));
what I want to be able to do is like the following, but not sure how to accomplish.
$openchart->type("BarChart");
$openchart->options(array('title' => "Opens Stats"));
$openchart->columns(array(
'Date' => array(
'type' => 'string',
'label' => 'Date'
),
foreach($chart[$name])
'$name' => array(
'type' => 'number',
'label' => '$name'
)
));
$openchart->addRow(array('Date' => "Today", '$name'=> $chart['$name']['opentoday']));
is this possible? still very new to PHP. am also using CakePHP (and learning a TON by just trial and error!)
Originally I just tried
$openchart->columnts( array(
'$name' => array(
'type' => 'number',
'label' => '$name'
));
but that overwrote the array. also checked out array_merge, but that wasn't working, and not sure why.
so now at the end of my first foreach (not shown), I have an array of all the values I want, in $chart[$name]
and figured that might be best route to then do the 'columns' all at once.
love that this site exists, getting so much accomplished. thank you!