Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ApexchartsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ApexchartsWidget extends Widget
public $type = 'line';
public $width = '100%';
public $height = 350;
public $js = null;

public function init()
{
Expand Down Expand Up @@ -60,8 +61,9 @@ public function run()
$width = json_encode($this->width);
$height = json_encode((string)$this->height);
$timeout = $this->timeout;
$js = $this->js;

echo $this->render('index', compact('id', 'timeout', 'chartOptions', 'series', 'type', 'width', 'height'));
echo $this->render('index', compact('id', 'timeout', 'chartOptions', 'series', 'type', 'width', 'height', 'js'));
}


Expand Down
20 changes: 11 additions & 9 deletions views/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/** @var $width string */
/** @var $height string */
/** @var $timeout integer */
/** @var $js \yii\web\JsExpression */

?>

Expand All @@ -26,17 +27,18 @@

setTimeout(function(e) {
new Vue({
el: '#' + $id,
data: function() {
el: '#' + $id,
data: function() {
return {
chartOptions: $chartOptions,
series: $series,
type: $type,
width: $width,
height: $height
chartOptions: $chartOptions,
series: $series,
type: $type,
width: $width,
height: $height
}
}
});
}
});
$js
}, $timeout);


Expand Down