echart样式属性设置

本文详细探讨了如何使用Echarts库进行图表样式的个性化设置,涵盖了颜色、边框、背景等多个方面,帮助开发者实现美观的数据可视化效果。
摘要由CSDN通过智能技术生成

// 预设柱状图颜色3种颜色
export const barColorList = [
  '#1875F0',
  '#68CFA0',
];

// 预设图表颜色3种颜色
export const colorList = [
  '#1875F0',  
  '#68CFA0',
  '#FDB336'
];

export const fontColor = '#6C7E8E';

// 条状图
let clickIndex = {};
export function echartOptionForShadow(nameList, valueList) {
  return {
    color: barColorList,
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      },
      position: function (point, params, dom, rect, size) {
        return [10, point[1] + 20];
      },
      // formatter: function (params) {
      //   clickIndex = params;
      //   return params[0].axisValueLabel + ':' + params[0].data.value + '%';
      // }
    },
    grid: {
      left: '3%',
      right: '8%',
      bottom: '20px',
      top: '20px',
      containLabel: true
    },
    xAxis: {
      type: 'value',
      scale: true,
      // max: 120,
      min: 0,
      minInterval: 1, // 设置分割线最小间隔为1
      boundaryGap: [0, 0.01],
      show: true,
      axisLine: { // 设置主轴线的样式
        show: true,
        lineStyle: {
          color: fontColor
        }
      },
      axisLabel: { // 设置主轴的文字样式
        fontSize: 14,
        color: fontColor
      },
      splitLine: { // 设置分割线样式
        show: true,
        lineStyle: {
          type: 'dashed'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值