1

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 ?.

2 Answers 2

4
foreach($data as $row){    
    $whatever->addRow([$row->date, $row->value1, $row->value2]);
}
Sign up to request clarification or add additional context in comments.

Comments

1
foreach($data as $row){ 
    someObj->addRow([$row->date, $row->value1, $row->value2]);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.