Echarts 与 Extjs4 集成

首先html中引用js





自定义组件


Ext.define("Ext.ux.EChartsComponent", {
    extend: "Ext.Component",
    alias: "widget.echartscmp",
    border: false,
    config: {
        option: null
    },
    initComponent: function () {
        var me = this;
        if (!me.height) {
            throw new Error("图表组件需显式设置高度!");
        }
 
        me.on("boxready", function () {
            me.echarts = echarts.init(me.getEl().dom);
            if (me.option) {
                me.echarts.setOption(me.option);
            }
        });
 
        me.callParent();
    }
});



你可能感兴趣的:(extjs)