美文网首页前端之路
echarts图表option配置项

echarts图表option配置项

作者: 星星藏进黑夜 | 来源:发表于2020-11-14 16:48 被阅读0次
  1. x轴字体倾斜
option = {
  xAxis: [{
    axisLabel: {
      interval: 0,//防止文字过多时隐藏
      rotate: 40//字体倾斜度数
    }
  }]
}
  1. 图形上显示数值
option = {
    series: [{
        label: {
            show: true,//图形上显示数值
            position: ''//数值显示方向 top|right|bottom|left|''
        },
        data: [1, 2, 3, 4, 5, 6],
        type: 'line'
    }]
}
  1. 颜色配置
option = {
    legend: {//说明标签
        type: 'scroll',
        data: ['name1'],
        textStyle: {
            color: 'pink'
        }
    },
    xAxis: [{//x轴
        axisLabel: {//文字
            formatter: '{value}',
            textStyle: {
                color: 'pink'
            }
        },
        axisLine: {//线条
            lineStyle: {
                color: 'pink'
            },
        },
        axisTick: {//刻度
            lineStyle: {
                color: 'pink'
            }
        }
    }],
    yAxis: [],//与x轴设置方法一致
    series: [{
        name: 'name1',
        type: 'bar',
        data: [1,2,3],
        label: {//图形上的文字
            show: true,
            position: 'top',
            textStyle:{
                color: 'pink'
            }
        }
    }]
}
  1. 折线图线条断开效果
series: [{
    data: [82, 93, null, 93, 128, 133, 132],//插入空值即可[null]
    type: 'line'
}]
  1. 滑过图形时,tooltip提示框超出容器问题
    tooltip = {
    trigger: 'item',
    formatter: '{b}: {c}%',
    confine: true //禁止超出容器
    }
>死亡不是终点, 被遗忘才是.

已更新4/100个配置

相关文章

网友评论

    本文标题:echarts图表option配置项

    本文链接:https://www.haomeiwen.com/subject/zxjwbktx.html