Echarts设置参数

8 篇文章 0 订阅
3 篇文章 0 订阅

经常根据设计图来调整Echarts的样式图,设置参数太多每次都需要调整,为了方便后续使用,特写此文章。

汽车仪表盘

option= {
  series: [
    {
      name: "Pressure",
      type: "gauge",
      startAngle: 90,
      endAngle: -360,
      axisLine: {
        lineStyle: {
          width: 30,
          color: [
            [0.1, "#FF9796"],
            [0.3, "#FBC32A"],
            [0.5, "#50C687"],
            [0.7, "#43A9E0"],
            [1, "#3F5CAD"],
          ],
        },
      },
      pointer: {
        show: false,
          },
     
      splitLine: {
        show: false,
        distance: 0,
        length: 10,
      },
      axisTick: {
        show: false,
      },
      //刻度
      axisLabel: {
        show: false,
        distance: 50,
      },
      data: [
        {
          value: [11, 22, 50],
          name: "SCORE",
          //上面标题
          title: {
            fontSize: 14,
            fontWeight: 700,
          },
          //下面文字
          detail: {
            width: 60,
            height: 20,
            fontSize: 14,
            formatter: "表现力",
          },
        },
      ],
    },
  ],
}

示例图:
在这里插入图片描述

option = {
  series: [
    {
      name: 'Pressure',
      type: 'gauge',
      startAngle: 90,
      endAngle: -360,
      pointer: {
        show: false
      },
      progress: {
        show: true,
        overlap: false,
        roundCap: true,
        clip: false,
        itemStyle: {
          borderWidth: 2,
          borderColor: '#244E8F'
        }
      },
      axisLine: {
        lineStyle: {
          width: 30
        }
      },
      splitLine: {
        show: false,
        distance: 0,
        length: 10
      },
      axisTick: {
        show: false
      },
      //刻度
      axisLabel: {
        show: false,
        distance: 50
      },
      data: [
        {
          value: 50,
          name: 'SCORE',
          //上面标题
          title: {
            fontSize: 14,
            fontWeight: 700
          },
          //下面文字
          detail: {
            width: 60,
            height: 20,
            fontSize: 14,
            formatter: '表现力'
          }
        }
      ]
    }
  ]
}

示例图:
在这里插入图片描述

雷达图

option= {
  color: ["#E51924", "#2773D5"],
  radar: {
    shape: "circle",
    indicator: [
      { name: "Sales", max: 6500 },
      { name: "Admin", max: 6500 },
      { name: "Informaty", max: 6500 },
      { name: "Custome", max: 6500 },
      { name: "Develont", max: 6500 },
      { name: "Marketing", max: 6500 },
    ],
    axisName: {
      color: "#333",
      fontSize: 14,
      fontWeight: 700,
    },
  },
  series: [
    {
      name: "Budget vs spending",
      type: "radar",
      data: [
        {
          value: [4200, 3000, 2000, 3500, 6000, 1800],
          name: "红队",
          lineStyle: {
            color: "#E51924",
            opacity: 0.8,
          },
          symbolSize: 0,
          areaStyle: {
            color: "#E51924",
          },
        },
        {
          value: [5000, 1400, 2800, 2600, 4200, 2100],
          name: "蓝队",
          symbolSize: 0,
          lineStyle: {
            color: "#2773D5",
            opacity: 0.8,
          },
          areaStyle: {
            color: "#2773D5",
          },
        },
      ],
    },
  ],
},

示例图:
在这里插入图片描述

线性图

 lineOption: {
        visualMap: [
          {
            show: false,
            type: "continuous",
            seriesIndex: 0,
            min: 0,
          },
        ],
        tooltip: {
          trigger: "axis",
        },
        xAxis: {
          type: "category",
          data: ["A", "B", "C"],
        },
        yAxis: {
          type: "value",
        },
        grid: [
          {
            bottom: "10%",
          },
          {
            top: "10%",
          },
        ],
        series: [
          {
            type: "line",
            showSymbol: false,
            data: [0, 3, 4, 23, 0],
          },
        ],
      },

在这里插入图片描述

双饼图

option = {
  color:['#F2F2F2','#FF7815'],
  series: [
    {
      name: '123',
      type: 'pie',
      radius: ['30%', '38%'],
      color:['#FF7815','#F2F2F2'],
      label: {
        show: false
      },
      data: [
        { value:110, name: '111' },
        { value:90, name: 'F2F2F2' },
      ]
    },
    {
      name: '234',
      type: 'pie',
      radius: ['42%', '50%'],
      color:['#0073D5','#F2F2F2'],
      label: {
        show: false
      },
      data: [
        { value: 100, name: '999' },
        { value: 120, name: '333' },
      ]
    }
  ]
};

示意图:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晚生隆海

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值