欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

js教程

echarts柱状图样式参数

js教程 我的站长站 2024-09-06 共6人阅读

1:线条/节点颜色

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF'
            }
        }
    },
  }
]

2:线条粗细

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
                width: 3
            }
        }
    },
  }
]

3:线条样式

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
                width: 3,
                type: 'dashed'
            }
        }
    },
  }
]

4:线条阴影

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
                width: 3,
                type: 'dashed',
                shadowColor: 'rgba(0, 0, 0, 0.5)',
                shadowBlur: 10,
                shadowOffsetY: 10
            }
        }
    },
  }
]

5:线条平滑

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    smooth: true,
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
                width: 3,
                type: 'dashed',
                shadowColor: 'rgba(0, 0, 0, 0.5)',
                shadowBlur: 10,
                shadowOffsetY: 10
            }
        }
    },
  }
]

6:线条节点大小

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    symbol: 'circle',
    symbolSize: 20,
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            }
        }
    },
  }
]

7:线条节点阴影

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    symbol: 'circle',
    symbolSize: 20,
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
            areaStyle: {
                color: 'rgba(0, 0, 0, 0.5)'
            }
        }
    },
  }
 ]

8:线条节点边框

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    symbol: 'circle',
    symbolSize: 20,
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
            borderColor: '#409EFF',
            borderWidth: 5
        }
    },
  }
]

9:线条节点边框阴影

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    symbol: 'circle',
    symbolSize: 20,
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
            borderColor: '#409EFF',
            borderWidth: 5,
            shadowColor: 'rgba(0, 0, 0, 0.5)',

            shadowBlur: 10,
            shadowOffsetY: 10
        }
    },
  }
]

10:工具提醒

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis'
    },
  }
]

11:工具提醒样式

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      formatter: '{b}<br />{a}: {c}'
    },
  }
]

12:工具自定义提醒

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      formatter: function (params) {
        return params[0].name + '<br /><span style="color:#409EFF">hello world<span>'
      }
    },
  }
]

13:工具提醒背景

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      backgroundColor: '#E6A23C'
    },
  }
]

14:工具提醒边框

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      borderColor: '#409EFF',
      borderWidth: 15
    },
  }
]

15:工具提醒阴影

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      shadowColor: 'rgba(0, 0, 0, 0.5)',
      shadowBlur: 10,
      shadowOffsetY: 10
    },
  }
]

16:工具提醒文字样式

series: [
  {
    data: [150, 230, 224, 218, 135, 147, 260],
    type: 'line',
    itemStyle: {
        normal: {
            color: '#E6A23C',
            lineStyle: {
                color: '#409EFF',
            },
        }
    },
    tooltip: {
      trigger: 'axis',
      textStyle: {
        color: '#409EFF',
        fontSize: 20
      }
    },
  }
]

17:工具箱

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

18:工具箱图标

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  toolbox: {
    feature: {
      saveAsImage: {
        icon: 'image://https://img.88icon.com/download/jpg/202001/388cc11b509232e7b5a2340742aba2ef.jpg!88con'
      }
    }
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

19:工具箱标题

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  toolbox: {
    feature: {
      saveAsImage: {
        title: '保存为图片'
      }
    }
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

20:工具箱功能

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  toolbox: {
    feature: {
      dataZoom: {},
      dataView: {readOnly: false},
      magicType: {type: ['line', 'bar']},
      restore: {},
      saveAsImage: {}
    }
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

21:类别显示

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

22:类别显示位置

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    left: 'right'
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

23:类别显示图标

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    icon: 'circle'
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

24:类别显示图标大小

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    icon: 'circle',
    itemWidth: 20,
    itemHeight: 20
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

25:类别显示图标间距

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    icon: 'circle',
    itemGap: 20
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

26:类别显示图标文字大小

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    icon: 'circle',
    textStyle: {
      fontSize: 20
    }
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

27:类别显示图标文字颜色

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    icon: 'circle',
    textStyle: {
      color: 'red'
    }
  },
  series: [
    {
      name:'Mon',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
    {
      name:'Tue',
      data: [50, 30, 24, 18, 35, 47, 60],
      type: 'line'
    }
  ]
};

28:轴方向(同其他,如柱状图等)

option = {
  xAxis: {
    type: 'value'
  },
  yAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

29:坐标轴名称

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value',
    name: '我是Y轴名称'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

30:坐标轴名称位置

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value',
    name: '我是Y轴名称',
    nameLocation: 'middle'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

31:坐标轴名称文字样式

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value',
    name: '我是Y轴名称',
    nameTextStyle: {
      color: 'red',
      fontSize: 20
    }
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

32:坐标轴名称与轴线之间的距离

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value',
    name: '我是Y轴名称',
    nameGap: 20
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

33:显示标签

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true
      }
    }
  ]
};

34:标签位置

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        position: 'left'
      }
    }
  ]
};

35:标签文字样式

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        position: 'left',
        textStyle: {
          color: 'red',
          fontSize: 20
        }
      }
    }
  ]
};

36:标签背景色

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        textStyle: {
          color: 'red',
          fontSize: 20
        },
        backgroundColor: 'yellow'
      }
    }
  ]
};

37:标签边框

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        borderColor: 'blue',
        borderWidth: 2
      }
    }
  ]
};

38:标签边框圆角

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        borderRadius: 10
      }
    }
  ]
};

39:标签内边距

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        borderColor: 'blue',
        borderWidth: 5,
        borderRadius: 10,
        padding: 10
      }
    }
  ]
};

40:标签阴影

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        borderColor: 'blue',
        borderWidth: 1,
        padding: 10,
        shadowColor: 'red',
        shadowBlur: 10,
        shadowOffsetX: 1,
        shadowOffsetY: 1
      }
    }
  ]
};

41:标签旋转

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      label: {
        show: true,
        rotate: 45
      }
    }
  ]
};

42:x轴内容偏移

xAxis: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisLabel: {
      interval: 0,
      rotate: 40
    }
  }
43:x轴内容样式
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisLabel: {
      textStyle: {
        color: 'red'
      }
    }
  },


相关推荐
  • echarts
  • 柱状图
  • echarts柱状图样式参数

    1:线条/节点颜色series: [ { data: [150, 230, 224, 218, 135, 147, 260], type: &#39;line&#39;, itemStyle: { normal: { color: &#39;#E6A23C&#39;, lineStyle: { color: &#39;#409EFF&#39...

    js教程 6 1周前
  • 百度echarts柱状图使用教程
    百度echarts柱状图使用教程

    echarts简介echarts是百度出品的一款开源JS柱状图框架,目前市面柱状图大部分都是使用这款echarts。作为前端开发者不得不学好echarts框架,echarts文档太复杂,我的站长站精简了使用方法,不看原理,只给...

    js教程 5 1周前
  • echarts柱状图样式参数

    1:线条/节点颜色series: [ { data: [150, 230, 224, 218, 135, 147, 260], type: &#39;line&#39;, itemStyle: { normal: { color: &#39;#E6A23C&#39;, lineStyle: { color: &#39;#409EFF&#39...

    js教程 6 1周前
  • 百度echarts柱状图使用教程
    百度echarts柱状图使用教程

    echarts简介echarts是百度出品的一款开源JS柱状图框架,目前市面柱状图大部分都是使用这款echarts。作为前端开发者不得不学好echarts框架,echarts文档太复杂,我的站长站精简了使用方法,不看原理,只给...

    js教程 5 1周前