draw.js 362 Bytes
Newer Older
何虹's avatar
何虹 committed
1 2 3 4 5 6 7 8 9 10 11 12
import { EleResize } from './ezresize'
import echarts from 'echarts'
export default function drawEcharts(id, option) { // id: chart所在块id, option: 配置项
  const dom = document.getElementById(id)
  const chart = echarts.init(dom)
  chart.setOption(option)
  const listener = _ => {
    chart.resize()
  }
  EleResize.on(dom, listener)
  return chart
}