Answer the question
In order to leave comments, you need to log in
YII2 Highcharts how to build from model?
There is a graph with various data:
how to build such a graph from the model? Now it is formed from an array and not quite beautiful:
$resultData = [];
foreach ($tmpKeys as $key) {
$positions = [];
foreach ($tmpData as $val) {
$positions[] = val;
}
$resultData[] = [
'name' => $key,
'data' => $positions
];
}
echo <?= Highcharts::widget([
'options' => [
'title' => ['text' => 'Title'],
'xAxis' => [
'categories' => $resultDate
],
'yAxis' => [
'title' => ['text' => 'Position'],
'labels' => [
'step' => 1,
]
],
'series' => $resultData
]
]); ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question