echarts 折线图_自定义_常用图表配置_数据可视化

Echarts 常用各类图表模板配置

注意: 这里主要就是基于各类图表,更多的使用 Echarts 的各类配置项;

以下代码都可以复制到 Echarts 官网,直接预览;



echarts 项目可视化、ecahrts 折线图、ecahrts柱状图、echarts横向柱状图、echarts折线图+柱状图、echarts 关系图、echarts 知识图谱、ecahrts 地图、ecahrts 地图 josn 文件、地图json免费下载、echarts k线图、echarts环形图、echarts 3D 柱状图、echarts 象形柱图、echarts 自定义样式、echarts 矢量图、echarts 基础教程、echarts 快速入门、echarts 基础配置、charts 图表案例、echarts 大屏可视化、echarts 属性详解、echarts 动画、自定义二分图布局、echarts 力向导图

一、折线图

const colorList = ['#9E87FF', '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'];
option = {
  backgroundColor: '#fff',
  legend: {
    icon: 'circle',
    top: '5%',
    right: '5%',
    itemWidth: 6,
    itemGap: 20,
    textStyle: {
      color: '#556677'
    }
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      label: {
        show: true,
        backgroundColor: '#fff',
        color: '#556677',
        borderColor: 'rgba(0,0,0,0)',
        shadowColor: 'rgba(0,0,0,0)',
        shadowOffsetY: 0
      },
      lineStyle: {
        width: 1
      }
    },
    backgroundColor: '#fff',
    textStyle: {
      color: '#5c6c7c'
    },
    padding: [10, 10],
    extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)'
  },
  grid: {
    top: '15%'
  },
  xAxis: [
    {
      type: 'category',
      data: [
        '2024-01-01',
        '2024-02-02',
        '2024-03-03',
        '2024-04-04',
        '2024-05-05',
        '2024-06-06',
        '2024-07-07'
      ],
      axisLine: {
        lineStyle: {
          color: '#DCE2E8'
        }
      },
      axisTick: {
        show: true
      },
      axisLabel: {
        interval: 0,
        textStyle: {
          color: '#556677'
        },
        // 默认x轴字体大小
        fontSize: 12,
        // margin:文字到x轴的距离
        margin: 15
      },
      axisPointer: {
        label: {
          padding: [-1, 0, 10, 0],
          margin: 15,
          // 移入时的字体大小
          fontSize: 18,
          backgroundColor: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#fff' // 0% 处的颜色
              },
              {
                // offset: 0.9,
                offset: 0.86,
                color: '#fff' // 0% 处的颜色
              },
              {
                offset: 0.86,
                color: '#33c0cd' // 0% 处的颜色
              },
              {
                offset: 1,
                color: '#33c0cd' // 100% 处的颜色
              }
            ],
            global: false // 缺省为 false
          }
        }
      },
      boundaryGap: false
    }
  ],
  yAxis: [
    {
      type: 'value',
      name: `数据量`,
      axisTick: {
        show: true
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#73DDFF'
        }
      },
      axisLabel: {
        color: '#73DDFF'
      },
      splitLine: {
        show: false
      }
    },
    {
      type: 'value',
      name: `次数`,
      position: 'right',
      axisTick: {
        show: true
      },
      axisLabel: {
        color: '#9E87FF',
        formatter: '{value}'
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#9E87FF'
        }
      },
      splitLine: {
        show: false
      }
    }
  ],
  series: [
    {
      name: '存储数据',
      type: 'line',
      data: [10, 10, 30, 12, 15, 3, 7],
      symbol: 'circle',
      smooth: true,
      yAxisIndex: 0,
      symbolSize: 4,
      showSymbol: true,
      lineStyle: {
        width: 3,
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
          {
            offset: 0,
            color: '#9effff'
          },
          {
            offset: 1,
            color: '#9E87FF'
          }
        ]),
        shadowColor: 'rgba(158,135,255, 0.3)',
        shadowBlur: 10,
        shadowOffsetY: 20
      },
      normal: {
        color: colorList[0],
        borderColor: colorList[0]
      },
      emphasis: {
        itemStyle: {
          color: '#ff0000',
          borderColor: '#ff0000',
          borderWidth: 6,
          shadowBlur: 12,
          shadowOffsetX: 0,
          shadowOffsetY: 0,
          shadowColor: 'rgba(0,0,0,0.5)'
        }
      },
      markLine: {
        silent: true,
        data: [
          {
            yAxis: 20
          }
        ]
      },
      markPoint: {
        symbolSize: 80,
        label: {
          show: true,
          align: 'center',
          color: 'white',
          fontWeight: 100,
          formatter: '{b}'
        },
        itemStyle: {
          color: {
            type: 'radial',
            x: 0.4,
            y: 0.4,
            r: 0.9,
            colorStops: [
              {
                offset: 0,
                color: '#51e0a2'
              },
              {
                offset: 1,
                color: 'rgb(33,150,243)'
              }
            ],
            globalCoord: true
          },
          shadowColor: 'rgba(0, 0, 0, 0.5)',
          shadowBlur: 10
        },
        data: [
          {
            name: '最大值',
            type: 'max'
          }
        ]
      }
    },
    {
      name: '传输数据',
      type: 'line',
      data: [5, 12, 11, 14, 25, 16, 10],
      symbolSize: 1,
      symbol: 'circle',
      smooth: true,
      yAxisIndex: 0,
      showSymbol: false,
      lineStyle: {
        width: 8,
        color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [
          {
            offset: 0,
            color: '#73DD39'
          },
          {
            offset: 1,
            color: '#73DDFF'
          }
        ]),
        shadowColor: 'rgba(115,221,255, 0.3)',
        shadowBlur: 10,
        shadowOffsetY: 20
      },
      normal: {
        color: colorList[1],
        borderColor: colorList[1]
      }
    },
    {
      name: '通信频次',
      type: 'line',
      data: [150, 120, 170, 140, 500, 160, 110],
      yAxisIndex: 1,
      symbol: 'circle',
      smooth: true,
      symbolSize: 10,
      showSymbol: true,
      lineStyle: {
        width: 3,
        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
          {
            offset: 0,
            color: '#fe9a'
          },
          {
            offset: 1,
            color: '#fe9a8b'
          }
        ]),
        shadowColor: 'rgba(254,154,139, 0.3)',
        shadowBlur: 10,
        shadowOffsetY: 20
      },
      normal: {
        color: colorList[2],
        borderColor: colorList[2]
      }
    }
  ]
};


二、环形图

echarts 环形图:多层嵌套,自定义 legend 位置、颜色,中间插入数据及文字,颜色渐变;

文字链接: https://blog.csdn.net/aibujin/article/details/124796709?spm=1001.2014.3001.5501

三、k 线图

文章链接: https://blog.csdn.net/aibujin/article/details/124797924?spm=1001.2014.3001.5501

四、折线图

echarts 折线图,横纵坐标轴线颜色、文字颜色,网格线,坐标轴两侧留白,数据渐变,刻度线等;

文章链接:https://blog.csdn.net/aibujin/article/details/124802512?spm=1001.2014.3001.5501

文章链接:https://blog.csdn.net/aibujin/article/details/130157140?spm=1001.2014.3001.5501

文章链接:https://blog.csdn.net/aibujin/article/details/130223130?spm=1001.2014.3001.5501

五、横向柱状图

echarts 横向柱状图,坐标轴隐藏,网格线颜色渐变,网格默认背景,柱状图边框宽度/颜色,数据渐变,刻度线隐藏等;

文章链接: https://blog.csdn.net/aibujin/article/details/124802889?spm=1001.2014.3001.5501

六、折线图 + 柱状图

echarts 折线图 + 柱状图,左右两侧y轴线,横纵坐标轴线颜色、文字颜色,网格线,坐标轴两侧留白,数据渐变,刻度线等;

文章链接: https://blog.csdn.net/aibujin/article/details/124803493?spm=1001.2014.3001.5501

七、3D 柱状图

echarts 3D 柱状图,多个柱状图叠加,y轴内刻度线、隐藏横坐标,文字颜色,网格线,坐标轴两侧留白,数据渐变,刻度线等;

文章链接: https://blog.csdn.net/aibujin/article/details/124879825?spm=1001.2014.3001.5501

八、工程项目可视化

echarts 工程项目可视化,依据x轴时间坐标轴,叠加展示不同阶段的项目节点,y轴展示项目阶段名、文字颜色,网格线,坐标轴两侧留白、背景色等;

文章链接: https://blog.csdn.net/aibujin/article/details/130237643?spm=1001.2014.3001.5501

九、雷达图

echarts 雷达图,自定义指示器名称,线条样式、区域填充样式、折线拐点标志、自定义名称样式、坐标轴分隔线、坐标轴两侧留白、背景色等;

文章链接:https://blog.csdn.net/aibujin/article/details/130266382?spm=1001.2014.3001.5501

十、象形柱图

echarts 象形柱图,隐藏横纵坐标轴、网格线,坐标轴两侧留白,自定义矢量图,文字提示框、图形类型、背景色等;

文章链接:https://blog.csdn.net/aibujin/article/details/130289101?spm=1001.2014.3001.5501

十一、环形占比图

echarts 环形占比图,环形图、仪表盘、刻度线,自定义提示框、颜色渐变、背景色等;

文章链接:https://blog.csdn.net/aibujin/article/details/130265744?spm=1001.2014.3001.5501

十二、圆环动画

echarts 圆环动画,饼图、环形图、图表动画、网格线,颜色渐变,图行矢量,文字提示框、图表层级、背景色等;

文章链接:https://blog.csdn.net/aibujin/article/details/130288849?spm=1001.2014.3001.5501

十三、力向导图(二分图布局)

文章链接:https://blog.csdn.net/aibujin/article/details/134148974?spm=1001.2014.3001.5501
文章链接:https://blog.csdn.net/aibujin/article/details/134690784?spm=1001.2014.3001.5501
文章链接:https://blog.csdn.net/aibujin/article/details/134147640?spm=1001.2014.3001.5502

十四、地图

echarts 地图,自定义提示框;

文章链接:https://blog.csdn.net/aibujin/article/details/130532911?spm=1001.2014.3001.5501

十五、地图 json 免费下载

  1. 全省份 json 下载:https://mp.csdn.net/mp_download/manage/download/UpDetailed?spm=3001.5299

  2. 阿里数据可视化平台下载:http://datav.aliyun.com/portal/school/atlas/area_selector

在这里插入图片描述
3. https://geojson.cn/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值