Skip to content

Instantly share code, notes, and snippets.

@brihter
Last active November 20, 2020 16:57
Show Gist options
  • Save brihter/d6c0cb9f62c91f4d4553fcda01a93b1b to your computer and use it in GitHub Desktop.
Save brihter/d6c0cb9f62c91f4d4553fcda01a93b1b to your computer and use it in GitHub Desktop.
ExtJS 6 Echarts adapter
// 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