speixoto/yii2-amcharts

Chart js name feature

bariew opened this issue · 4 comments

Hi and thank you for your widget!
I would like to call the rendered chart javascript object to change its data dynamically - so i need its javascript name. Could you add $name attribute to the witdget?
So in Widget:96 it would look like
$js = $this->getChartName() . " = AmCharts.makeChart('{$this->chartDivId}', {$chartConfiguration});";

I added the name based on the chart id. You can check 5a3c12b

Thank you! But is the default chartId valid javascript variable name ('chart-' . $this->getId())? I'm afraid '-' is not allowed?

You are right. :) Changed to chart_

Thank you very much!