I have searched now very long for this but no answers, please help me. I'm using the highchart-widget from 2amigos in yii2. When I'm creating a view in my controller via "render" the chart shows
and as you can see on the picture on the right the asset is included in the source of the network -> "b732256a - highcharts.src.js"
BUT NOW COMES THE PROBLEM, when I'm rendering the view with "renderAjax" and insert the view in an existing HTML document with ajax -> take a look at my javascript code: the the asset "b732256a - highcharts.src.js" is missing take a look at this foto
But when i access the action direct via browser:
index.php?r=bewt/ladeauswertung&standort=&datum=
it works with renderAjax and render, there is just a problem when i bind the view in an existing html document. im using this routine, to bind the view in an existing html document
document.getElementById("auswertungdetail").innerHTML = jsondata;
What you need to know about my code. on a html-page there is a button, when the user press this button im calling the following javascript code, and the chart should show up without reloading the whole page
$(document).on('click', '#ladeauswertung', function ()
{
var ausgewaehlterstandort = document.getElementById("standorte").value;
var datum = document.getElementById("datum").value;
$.get("index.php?r=voti/ladeauswertung&standort=" + ausgewaehlterstandort + "&datum=" + datum,
function (jsondata)
{
document.getElementById("auswertungdetail").innerHTML = jsondata;
}
);
});
in my controller im rendering the view:
function actionLadeauswertung($standort, $datum)
{
//some algorithm that do smth with $standort and $datum, not important
$auswertung = 5;
$gesamtauswertung = 10;
return $this->renderAjax('auswertungdetail', ["auswertung" => $auswertung, "gesamtauswertung" => $gesamtauswertung]);
}
and here ist the view which i render in the controller above:
<?php
use dosamigos\highcharts\HighCharts;
?>
<?php echo
HighCharts::widget([
'clientOptions' => [
'chart' => [
'type' => 'bar'
],
'title' => [
'text' => 'Fruit Consumption'
],
'xAxis' => [
'categories' => [
'Apples',
'Bananas',
]
],
'yAxis' => [
'title' => [
'text' => 'Fruit eaten'
]
],
'series' => [
['name' => 'Jane', 'data' => [1, 0, 4]],
['name' => 'John', 'data' => [5, 7, 3]]
]
]
]);
?>
and in my view im calling the 2amigos highchart, it works perfectly with "render" but i wanted to add the view where the highchart is included dynamically when a button is pressed so have to use renderAjax.
PLEASE HELP!!!!!