protected function registerClientScript()
    {
        $view = $this->getView();
        $asset = HighchartsAsset::register($view);

        if (!empty($this->modules)) {
            foreach ($this->modules as $module) {
                $asset->js[] = 'modules/'.$module.(YII_DEBUG ? '.src.js' : '.js');
            }
        }

        if ($this->enable3d) {
            $asset->js[] = YII_DEBUG ? 'highcharts-3d.src.js' : 'highcharts-3d.js';
        }
        if ($this->enableMore) {
            $asset->js[] = YII_DEBUG ? 'highcharts-more.src.js' : 'highcharts-more.js';
        }

        $clientOptions = $this->clientOptions;
        if (!empty($this->clientEvents)) {
            foreach ($this->clientEvents as $key=>$function) {
                $clientOptions['chart']['events'][$key] = $function;
            }
        }
        $jsonClientOptions = empty($clientOptions) ? '' : Json::encode($clientOptions);
        $js = "var {$this->chartVariable} = new Highcharts.Chart($jsonClientOptions);";
        $view->registerJs($js);
    }