echarts添加背景图

790 阅读1分钟
  1. graphic内添加
graphic: {
            type: 'image',
            left: 'center', // 相对父元素居中
            top: '22%',  // 相对父元素位置
            z: 99,
            style: {
                image: '',
                width: 120,
                height: 123
            }
        }

其中type可以为文字或图形,根据echarts配置项可进行使用。

  1. echarts options中设置backgroundColor: 'transparent',将背景图加在外盒子上,但是会有覆盖的问题。
  2. 利用块级作用域,绝对定位一个图片。