src/ECharts.php
protected function registerClientScript()
    {
        $id = $this->options['id'];
        $view = $this->getView();
        $option = !empty($this->pluginOptions['option']) ? Json::encode($this->pluginOptions['option']) : '{}';

        if ($this->theme) {
            $js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'), " . $this->quote($this->theme) . ");";
        } else {
            $js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'));";
        }
        $js .= "{$this->clientId}.setOption({$option});";
        if (isset($this->pluginOptions['group'])) {
            $js .= "{$this->clientId}.group = " . $this->quote($this->pluginOptions['group']) . ";";
        }
        if ($this->responsive) {
            $js .= "$(window).resize(function () {{$this->clientId}.resize()});";
        }
        foreach ($this->pluginEvents as $name => $handlers) {
            $handlers = (array) $handlers;
            foreach ($handlers as $handler) {
                $js .= "{$this->clientId}.on(" . $this->quote($name) . ", $handler);";
            }
        }

        EChartsAsset::register($view);
        $view->registerJs($js);
    }
protected function registerClientScript()
    {
        $id = $this->options['id'];
        $view = $this->getView();
        $option = !empty($this->pluginOptions['option']) ? Json::encode($this->pluginOptions['option']) : '{}';

        if ($this->theme) {
            $js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'), " . $this->quote($this->theme) . ");";
        } else {
            $js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'));";
        }
        $js .= "{$this->clientId}.setOption({$option});";
        if (isset($this->pluginOptions['group'])) {
            $js .= "{$this->clientId}.group = " . $this->quote($this->pluginOptions['group']) . ";";
        }
        if ($this->responsive) {
            $js .= "$(window).resize(function () {{$this->clientId}.resize()});";
        }
        foreach ($this->pluginEvents as $name => $handlers) {
            $handlers = (array) $handlers;
            foreach ($handlers as $handler) {
                $js .= "{$this->clientId}.on(" . $this->quote($name) . ", $handler);";
            }
        }

        EChartsAsset::register($view);
        $view->registerJs($js);
    }
protected function registerClientScript ( ) { $ id = $ this -> options [ 'id' ] ; $ view = $ this -> getView ( ) ; $ option = ! empty ( $ this -> pluginOptions [ 'option' ] ) ? Json :: encode ( $ this -> pluginOptions [ 'option' ] ) : '{}' ; if ( $ this -> theme ) { $ js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'), " . $ this -> quote ( $ this -> theme ) . ");" ; } else { $ js = "var {$this->clientId} = echarts.init(document.getElementById('{$id}'));" ; } $ js .= "{$this->clientId}.setOption({$option});" ; if ( isset ( $ this -> pluginOptions [ 'group' ] ) ) { $ js .= "{$this->clientId}.group = " . $ this -> quote ( $ this -> pluginOptions [ 'group' ] ) . ";" ; } if ( $ this -> responsive ) { $ js .= "$(window).resize(function () {{$this->clientId}.resize()});" ; } foreach ( $ this -> pluginEvents as $ name => $ handlers ) { $ handlers = ( array ) $ handlers ; foreach ( $ handlers as $ handler ) { $ js .= "{$this->clientId}.on(" . $ this -> quote ( $ name ) . ", $handler);" ; } } EChartsAsset :: register ( $ view ) ; $ view -> registerJs ( $ js ) ; }
Registers the required js files and script to initialize echarts plugin.
Registers the required js files and script to initialize echarts plugin .