Last active
November 20, 2020 16:57
-
-
Save brihter/d6c0cb9f62c91f4d4553fcda01a93b1b to your computer and use it in GitHub Desktop.
ExtJS 6 Echarts adapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: | |
// { | |
// xtype: 'ux_echart', | |
// echartCfg: { | |
// // ... | |
// } | |
// } | |
Ext.define('Ext.ux.Echart', { | |
extend: 'Ext.Container', | |
xtype: 'ux_echart', | |
_chart: null, | |
listeners: { | |
boxready: function () { | |
const target = `${this.id}-innerCt` | |
const cfg = this.initialConfig.echartCfg | |
this._chart = echarts.init(document.getElementById(target)) | |
this._chart.setOption(cfg) | |
}, | |
resize: function () { | |
this._chart.resize() | |
}, | |
beforedestroy: function () { | |
this._chart.dispose() | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment