Incubator-echarts: magicType可以手动触发切换吗

Created on 11 Aug 2016  ·  5Comments  ·  Source: apache/incubator-echarts

问题简述 (One-line summary)

magicType可以手动触发切换line, bar, stack, ...等模式吗

版本及环境 (Version & Environment)

  • ECharts 版本3.0:

    ECharts配置项 (ECharts option)

暂时写的是:定义控件lineChart。

        $("#lineChart").click(function() {
            myChart.dispatchAction({
                type: 'magictypechanged',
                currentType : "line"
            });
        });
inactive

Most helpful comment

可以的,mychart._componentsMap["-0_toolbox"]._features['magicType'].model.iconPaths.line.trigger('click');
这里的 "-0_toolbox" ,可能你需要通过 Object.getOwnPropertyNames(mychart._componentsMap) 来确定里面的特殊字符。

All 5 comments

切换成了
myChart.dispatchAction({ type: 'changeMagicType', currentType : "line" });
能探测到事件变化,
myChart.on('magictypechanged', ...

但是图没有被刷新诶

参数还需要传入 newOption

刚好刷源代码的时候也看到了newOption,仔细看了下这个函数,
image
不是特别理解newOption需要指定什么。外部复现整个处理流程也不太现实?

可以的,mychart._componentsMap["-0_toolbox"]._features['magicType'].model.iconPaths.line.trigger('click');
这里的 "-0_toolbox" ,可能你需要通过 Object.getOwnPropertyNames(mychart._componentsMap) 来确定里面的特殊字符。

This issue is closed due to not being active. Please feel free to open it again (for the author) or create a new one and reference this (for others) if you have further questions.

Was this page helpful?
0 / 5 - 0 ratings