Skip to content

Commit

Permalink
Merge pull request #1 from amelkikh/master
Browse files Browse the repository at this point in the history
Added plugin for point labels
  • Loading branch information
sizeg authored Aug 11, 2016
2 parents 925a447 + 687ced1 commit 97f342c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
8 changes: 5 additions & 3 deletions JqPlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function registerJqPlotWidget()
*/
protected function registerJqPlotClientOptions($id)
{
$this->registerRenderersRecursively($this->clientOptions);
$this->registerDependenciesRecursively($this->clientOptions);

$data = Json::htmlEncode($this->data);
$options = !empty($this->clientOptions) ? Json::htmlEncode($this->clientOptions) : '{}';
Expand All @@ -113,14 +113,16 @@ protected function registerJqPlotClientOptions($id)
* Find renderers and register their JS plugins
* @param array $data
*/
public function registerRenderersRecursively($data)
public function registerDependenciesRecursively($data)
{
// Looking for renderers
foreach ($data as $k => $v) {
if ($k == 'renderer' || $k == 'tickRenderer') {
$this->registerRendererJsFile($v);
} elseif ($k == 'pointLabels' && isset($v['show']) && (boolean)$v['show']) {
Yii::$app->assetManager->bundles[JqPlotAsset::className()]->js[] = 'plugins/jqplot.pointLabels.js';
} elseif (is_array($v)) {
$this->registerRenderersRecursively($v);
$this->registerDependenciesRecursively($v);
}
}

Expand Down

0 comments on commit 97f342c

Please sign in to comment.