关于vue.js:echart-的部分参数

35次阅读

共计 1715 个字符,预计需要花费 5 分钟才能阅读完成。

一些自主学习 echart 时用到的参数。

option = {
        title: {// 题目
          // text: '素质课报名人次分类统计',// 主题目文本
          subtext: '素质课报名人次分类统计',// 副标题文本,'\n' 指定换行
          x: 'center',// 程度安放地位,默认为 'left',可选为:'center' | 'left' | 'right' | {number}(x 坐标,单位 px)y: '250px',// 垂直安放地位,默认为 top,可选为:'top' | 'bottom' | 'center' | {number}(y 坐标,单位 px)textStyle: {// 主题目文本款式 {"fontSize": 18,"fontWeight": "bolder","color": "#333"}
            fontFamily: 'Arial, Verdana, sans...',
            fontSize: 12,
            fontStyle: 'normal',
            fontWeight: 'normal',
          },
          subtextStyle: {// 副标题文本款式 {"color": "#aaa"}
            fontFamily: 'Arial, Verdana, sans...',
            fontSize: 12,
            fontStyle: 'normal',
            fontWeight: 'normal',
          },
          zlevel: 0,// 一级层叠管制。默认 0, 每一个不同的 zlevel 将产生一个独立的 canvas,雷同 zlevel 的组件或图标将在同一个 canvas 上渲染。zlevel 越高越靠顶层,canvas 对象增多会耗费更多的内存和性能,并不倡议设置过多的 zlevel,大部分状况能够通过二级层叠管制 z 实现层叠管制。z: 6,// 二级层叠管制,默认 6, 同一个 canvas(雷同 zlevel)上 z 越高约靠顶层。},
        tooltip: {// 提示框,鼠标悬浮交互时的信息提醒
          show : 'true',// 可视
          trigger: 'item', // 依据 item 提示信息
          formatter : "{a} <br/>{b}: {c} ({d}%)", // 提醒内容
          trigger: 'item',// 默认值 'item',触发类型,默认数据触发,见下图,可选为:'item' | 'axis'
        },
        // legend: {// 图例,每个图表最多仅有一个图例
        //   orient: 'vertical',
        //   left: 'left',
        //   icon: 'circle',// 图标为圆形,默认是方形
        //   align:'auto',
        //   bottom: 'bottom',
        //   textStyle: {
        //     fontSize: 10,
        //     color: '#666'
        //   }
        // },
        series: [// 系列列表, 每个系列通过 type 决定本人的图表类型
          {
            name: '人数',
            type: 'pie',
            radius: '50%',
            label: {
              normal: {position: 'inside',//inside ( 自适应,柱状图外部地方),top(柱状外的正上方),left(柱状外的右边),right(柱状外的左边);// 坐标 [x,y] (以柱状图的顶部为原点)
                //insideTop,insideBottom,insideRight,insideLeft
                formatter: '{d}%',
                textStyle: {
                  color: '#fff',
                  // fontSize: '14px',
                  // fontWeight: '300',
                }
              }
            },
            data: [{ value: 1048, name: 'Search Engine'},
              {value: 735, name: 'Direct'},
              {value: 580, name: 'Email'},
              {value: 484, name: 'Union Ads'},
              {value: 300, name: 'Video Ads'}
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
    }

较为齐全的参数属性能够看这位大佬的博客:https://www.cnblogs.com/web52…

正文完
 0