Skip to content

Commit

Permalink
Supports register extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
daixianceng committed Nov 4, 2017
1 parent c9f6784 commit f0fb3f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ECharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class ECharts extends Widget
*/
public static $dist = self::DIST_COMMON;

/**
* @var array the extensions of echarts.
*/
public static $extensions = [];

/**
* @var boolean whether resize the chart when the container size is changed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/EChartsAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public function init()
default:
throw new InvalidConfigException('The "dist" is not valid.');
}

// Registers echarts extensions
foreach (ECharts::$extensions as $extension) {
$this->js[] = YII_DEBUG ? "extension/{$extension}.js" : "extension/{$extension}.min.js";
}
}

parent::init();
Expand Down

0 comments on commit f0fb3f6

Please sign in to comment.