2amigos / yii2-chartjs-widget

ChartJs Widget For Yii2
https://2amigos.us
Other
109 stars 67 forks source link

moment.js not found, when using scales type "time" #38

Closed matteo-cerioni closed 4 years ago

jgalley commented 5 years ago

I'm seeing the same error, it appears to be due to the inclusion of Chart.js rather than Chart.bundle.js (which includes moment.js).

There appears to have been a change to src/ChartJsAsset.php, where the 'bundled' version of the file in no longer included, rather the standard version of Chart.js is included.

https://github.com/2amigos/yii2-chartjs-widget/blob/master/src/ChartJsAsset.php

class ChartJsAsset extends AssetBundle
{
    public $sourcePath = '@bower/chartjs/dist';

    public $js = [
        'Chart.js' // No longer included bundle file Chart.bundle.js or Chart.bundle.min.js
    ];

    public $depends = [
        'yii\web\JqueryAsset',
    ];
}

Is there a way to choose to load the bundle file instead, perhaps via the config when instantiating the widget?

tonydspaniard commented 4 years ago

sure thing