Reputation: 95
I am using lava charts and i need to loop some data into a chart. This is what each loop needs to look like.
->addRow([$date, $value1, $value2]);
This is what i have already tried , but i seem to get an error. :
->addRow([
foreach($data as $row){
echo $row->date;
echo $row->value1;
echo $row->value2;
}
]);
But i get an error, as i cannot use the foreach loop in an Array. How do i get these loop values into an array ?.
Upvotes: 1
Views: 499
Reputation: 1373
foreach($data as $row){
someObj->addRow([$row->date, $row->value1, $row->value2]);
}
Upvotes: 1
Reputation: 14269
foreach($data as $row){
$whatever->addRow([$row->date, $row->value1, $row->value2]);
}
Upvotes: 4