JS-ECharts-前端图表 多层级联合饼图、柱状堆叠图、柱/线组合图、趋势图、自定义中线、平均线、气泡备注点

news2024/10/6 1:43:58

本篇博客背景为JavaScript。在ECharts在线编码快速上手,绘制相关前端可视化图表。
ECharts官网:https://echarts.apache.org/zh/index.html

其他的一些推荐:
AntV:https://antv.vision/zh
chartcube:https://chartcube.alipay.com/make

文章目录

  • 1、饼图
    • 1.1 常规饼图
    • 1.2 多层级饼图/双层饼图
  • 2、柱状图
  • 2.1柱状堆叠图
  • 3、趋势图
    • 3.1 凹凸图
    • 3.2 折线图
  • 4、组合图

1、饼图

1.1 常规饼图

饼图,可以显示数据内容的分类及占比。
可自定义分类的备注内容(使用名称+值+百分比)。可自定义分类颜色。

在这里插入图片描述
代码示例如下:

option = {
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
    //图表标题位置;center表示居中
    left: 'center'
  },
  tooltip: {
    trigger: 'item'
  },
  legend: {
    orient: 'vertical',
    left: 'left'
  },
  series: [
    {
      type: 'pie',
      //调整图表在页面相对大小
      radius: '60%',
       label: {
                        normal: {
                            show: true,
                            //自定义色块备注,名称+值+百分比
                            formatter: '{b}:{c}' + '个\n\r' + '({d}%)'
                        }
                    },
      data: [
        { value: 8, name: 'A' },
        { value: 6, name: 'B' },
        { value: 3, name: 'C' },
        { value: 2, name: 'D' },
        { value: 7, name: 'E' },
        { value: 1, name: 'F' },
        { value: 1, name: 'G' },
        { value: 1, name: 'H' },
        { value: 5, name: 'I' },
        //数量较多会循环使用之前的颜色,所以加上,itemStyle:{color来自定义颜色
        { value: 13, name: 'J' ,itemStyle:{color:'#FF7F80'}},
        { value: 10, name: 'K' ,itemStyle:{color:'#A52A4A'}}
      ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      }
    }
  ]
};

1.2 多层级饼图/双层饼图

多层级饼图,可展示数据分类及其下钻数据内容分类和关联性。
能够直观从几个层次展示,第一维度横向比较,第二维度横向比较,第二维度基于第一维度的横向比较,第二维度基于第一维度的延伸展示。
可自定义数据内容的分类及相应占比值,也可以自定义第二维度的数据分类及占比。
在这里插入图片描述

代码示例如下:

option = {
  textStyle: {
      color: '#999',
      fontWeight: 'normal',
      //调整图表中字体大小
      fontSize: 15
    },
    toolbox: {
    feature: {
      dataView: { show: true, readOnly: false },
      magicType: { show: true, type: ['line', 'bar'] },
      restore: { show: true },
      saveAsImage: { show: true }
    }
  },
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
    //图表标题位置;left表示左靠齐
    left: 'left'
  },
  legend: {
    orient: 'vertical',
    left: 'left'
  },
            series: {
               itemStyle: {
        borderColor: '#fff',
        borderWidth: 3
      },
                type: 'sunburst',
                //调整图表在页面相对大小
                 radius: '99%',
                 //调整图表在页面整体位置
                  center: ['50%', '50%'],
                  //图表数据,一个对象为一个色块
                data: [{
                  //第1部分的色块名
                    name: '1',
                    //第1部分的的值,对应占比大小
                    value: 2.2,
                    children: [{
                      //第1部分外圈的名称
                        name: '1.2',
                        //第1部分外圈的值,对应其在该色块中占比大小
                        value: 1.2
                    },
                    {
                        name: '1.3',
                        value: 0.2
                    },
                    {
                        name: '1.1',
                        value: 0.8
                    }]
                }, {
                    name: '2',
					          value:1.8,
					          children: [{
                        name: '2.1',
                        value: 0.9
                    },
                    {
                        name: '2.2',
                        value: 0.1
                    },
                    {
                        name: '2.3',
                        value: 0.8
                    }]
                },
                {
                    name: '3',
                    value: 0.3,
                    children: [{
                        name: '3.1',
                        value: 0.075
                    },
                    {
                        name: '3.2',
                        value: 0.15
                    },
                    {
                        name: '3.3',
                        value: 0.075
                    }
                    ]
                },
                ]
            }
        };

2、柱状图

2.1柱状堆叠图

柱状图与数据堆叠柱状图,可直观展示数据分类及该批次下数据细致划分及占比。
可自定义堆叠类型,自定义数据分类及占比等。双y轴图。
在这里插入图片描述

代码示例如下:

const Colors = {
  'United States': '#b22234'
};
option = {
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
    //图表标题位置;left表示左靠齐
    left: 'left'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  toolbox: {
    feature: {
      dataView: { show: true, readOnly: false },
      magicType: { show: true, type: ['line', 'bar'] },
      restore: { show: true },
      saveAsImage: { show: true }
    }
  },
  legend: {},
  grid: {
    //整个图表距离页面最左侧的相对距离
    left: '3%',
    right: '4%',
    //整个图表距离页面顶部的相对距离
    top:'18%',
    bottom: '3%',
    containLabel: true
  },
  //横坐标
  xAxis: [
    {
      type: 'category',
      //横坐标名称
      data: ['A1', 'A2','A3','A4','A5','A6','A7',
    ],
    axisLabel: {
      interval: 0,
      //横坐标倾斜程度
      rotate: 30
    }
    }
  ],
  //纵坐标,这儿是双纵坐标
  yAxis: [
    {
      type: 'value',
      //纵坐标名称
      name: '数量1',
    },
    {
      type: 'value',
      name: '数量2',
      //纵坐标最小值
      //min: 0,
      //纵坐标最大值
      //max: 10000,
      //纵坐标数据间隔
      //interval: 800,
    }
  ],
  series: [
    {
      //数据分类名称
      name: 'B1',
      type: 'bar',
      //color: '#76be77',
      emphasis: {
        focus: 'series'
      },
      label: {
        //柱状图上展示具体数值
        show: true
      },
      data:[123,34,77,34,43,546,113]
    },
    {
      name: 'C1',
      type: 'bar',
      //柱状图数据堆叠效果
      stack: 'Ad',
      //color: '#a90000',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[583,182,203,36,93,709,888]
    },
    {
      name: 'C2',
      stack: 'Ad',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[165,8,12,6,30,112,223]
    },
    {
      name: 'D1',
      yAxisIndex: 1,
      type: 'bar',
      //数据堆叠在不同柱子,根据stack的名称区分
      stack: 'Ad2',
      //color: '#a90000',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[17579,5788,5774,5044,3715,4811,2288]
    },
    {
      name: 'D2',
      yAxisIndex: 1,
      stack: 'Ad2',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[1533,146,1140,480,809,70,22]
    },
    {
      name: 'D3',
      yAxisIndex: 1,
      stack: 'Ad2',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[7101,470,502,641,6650,10418,5026]
    },
    {
      name: 'D4',
      yAxisIndex: 1,
      stack: 'Ad2',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data:[0,0,0,0,0,0,3923]
    }
  ]  
};

3、趋势图

3.1 凹凸图

可展示对应数据长期情况,趋势及最大最小值。
可自定义数据分类及备注点内容和坐标点位置等。
在这里插入图片描述

代码示例如下:

option = {
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    data: ['A', 'B', 'C', 'D', 'E','F'
    ],
    orient: 'vertical',
    left: 'left',
    top:'7%',
  },
   toolbox: {
    show: true,
    feature: {
      dataZoom: {
        yAxisIndex: 'none'
      },
      dataView: { readOnly: false },
      magicType: { type: ['line', 'bar','stack'] },
      restore: {},
      saveAsImage: {}
    }
  },
  grid: {
    //整个图表距离页面最左侧的相对距离
    left: '5%',
    right: '4%',
    //整个图表距离页面底部的相对距离
    bottom: '3%',
    containLabel: true
  },
  //横坐标
  xAxis: {
    type: 'category',
    boundaryGap: false,
    //横坐标的名称
    data: ['2022-7-1', '2022-7-2', '2022-7-3', '2022-7-4', '2022-7-5', '2022-7-6', '2022-7-7',
    '2022-7-8','2022-7-9','2022-7-10','2022-7-11','2022-7-12','2022-7-13','2022-7-14',
    '2022-7-15','2022-7-16','2022-7-17','2022-7-18','2022-7-19','2022-7-20',
    '2022-7-21','2022-7-22','2022-7-23','2022-7-24','2022-7-25',
    '2022-7-26','2022-7-27','2022-7-28','2022-7-29','2022-7-30','2022-7-31'
    ],
    axisLabel: {
      interval: 0,
      //横坐标名称倾斜程度
      rotate: 30
    }
  },
  //纵坐标
  yAxis: {
    type: 'value',
    //纵坐标最小值
    min: 0,
    //纵坐标最大值
    max: 2,
  },
  series: [
    {
      name: 'A',
      smooth: true,
      //增加该曲线的备注点
      markPoint: {
        data: [
          //备注点的名称,展示内容,坐标点
          { name: 'markPoint', value: 'A', xAxis: 9, yAxis: 1,
          symbolSize:150,
          }
        ],
      },
      type: 'line',
      label: {
        show: true
      },
      //该曲线对应横坐标的具体数值
      data: [0,0,0,0,0,1,1,0,0,0,
      0,0,0,0,1,
      0,0,0,0,0,
      0,0,0,0,1,
      0,0,0,0,0,0
      ]
    },
    {
      name: 'B',
      smooth: true,
      markPoint: {
        data: [
          { name: 'markPoint', value: 'B', xAxis: 9, yAxis: 1,
          symbolSize:160,
          }
        ],
      },
      type: 'line',
      label: {
        show: true
      },
      data: [0,0,0,0,0,0,1,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,0
      ]
    },
    {
      name: 'C',
      smooth: true,
      markPoint: {
        data: [
          { name: 'markPoint', value: 'C', xAxis: 9, yAxis: 1,
          symbolSize:150,
          }
        ],
      },
      type: 'line',
      label: {
        show: true
      },
      data: [0,0,0,0,0,0,0,1,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,0
      ]
    },
    {
      name: 'D',
      smooth: true,
      markPoint: {
        data: [
          { name: 'markPoint', value: 'D', xAxis: 9, yAxis: 1,
          symbolSize:150,
          }
        ],
      },
      type: 'line',
      label: {
        show: true
      },
      data: [0,0,0,0,1,0,1,0,0,0,
      0,0,0,1,0,
      0,0,0,0,0,
      0,0,0,0,0,
      1,0,0,1,0,0
      ]
    },
    {
      name: 'E',
      smooth: true,
      type: 'line',
      label: {
        show: true
      },
      data: [0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,
      0,0,0,0,0,0
      ]
    },
    {
      name: 'F',
      smooth: true,
      markPoint: {
        data: [
          { name: 'markPoint', value: 'F', xAxis: 9, yAxis: 1,
          symbolSize:150,
          }
        ],
      },
      type: 'line',
      label: {
        show: true
      },
      data: [1,0,0,0,0,0,0,0,0,0,
      1,0,0,0,0,
      0,0,1,1,0,
      0,0,0,0,1,
      0,1,1,0,0,0
      ]
    }
  ]
};

3.2 折线图

折线图,可较好展示数据波动及趋势,可快速看出最值。
可自定义数值及中线平均值。
在这里插入图片描述

代码示例如下:

const Colors = {
  'United States': '#b22234'
};
option = {
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
    //图表标题位置;left表示左靠齐
    left: 'left'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  toolbox: {
    feature: {
      dataView: { show: true, readOnly: false },
      magicType: { show: true, type: ['line', 'bar'] },
      restore: { show: true },
      saveAsImage: { show: true }
    }
  },
  legend: {},
  grid: {
    //整个图表距离页面最左侧的相对距离
    left: '3%',
    right: '4%',
    //整个图表距离页面顶部的相对距离
    top:'18%',
    bottom: '3%',
    containLabel: true
  },
  //纵坐标
  xAxis: [
    {
      type: 'category',
      //纵坐标名称
      data: ['2022-7-1', '2022-7-2', '2022-7-3', '2022-7-4', '2022-7-5',
      '2022-7-6', '2022-7-7','2022-7-8','2022-7-9','2022-7-10',
      '2022-7-11','2022-7-12','2022-7-13','2022-7-14','2022-7-15',
      '2022-7-16','2022-7-17','2022-7-18','2022-7-19','2022-7-20',
    '2022-7-21','2022-7-22','2022-7-23','2022-7-24','2022-7-25',
    '2022-7-26','2022-7-27','2022-7-28','2022-7-29','2022-7-30'
    ],
    axisLabel: {
      interval: 0,
      rotate: 30
    }
    }
  ],
  //横坐标
  yAxis: [
    {
      type: 'value',
      //纵坐标名称
      name: '单位1',
    },
    {
      type: 'value',
      name: '单位2',
      //纵坐标最小值
      //min: 0,
      //max: 100,
      //纵坐标间隔
      interval: 20,
    }
  ],
  series: [
    {
      name: '数据1',
      type: 'line',
      yAxisIndex: 1,
      markLine: {
        //平均线
        data: [{ type: 'average', name: 'Avg' }]
      },
      label: {
        //展示折线点对应的数据
        show: true,
        //数据展示位置,right展示在点的右边
        position: 'right',
      },
      data: [99.59, 114.71, 85.92, 58.9, 83.63, 101.49, 86.82, 79.3, 95.04, 234.91, 41.62, 62.23, 113.63, 97.76, 83.83, 164.91, 108.76, 68.58, 90.65, 89.06, 68.08, 66.28, 233.1, 107.23, 60.1, 72.76, 113.96, 89.59, 86.8, 100]
    },
    {
      name: '数据2',
      type: 'line',
      yAxisIndex: 1,
      markLine: {
        data: [{ type: 'average', name: 'Avg' }]
      },
      label: {
        show: true,
        position: 'right',
      },
      data: [28.0, 15.28, 21.47, 17.38, 142.15, 24.43, 13.14, 32.45, 19.19, 11.81, 5.68, 7.69, 3.67, 16.34, 5.2, 14.82, 28.38, 19.25, 22.4, 11.46, 2.69, 20.27, 34.78, 19.64, 10.72, 22.71, 13.94, 12.23, 10.78, 14.45]
    }
  ]  
};

4、组合图

4.1 柱状图+折线图
柱状图与折线图的形式,可便捷看出数据总量、分类及其数据趋势走向。
可自定义数据、分类,双y轴、数据备注点等。
在这里插入图片描述

代码示例如下:

option = {
  title: {
    //图表标题填写位置
    text: '图表标题',
    //图表副标题填写位置
    subtext: '副标题',
    //图表标题位置;left表示左靠齐
    left: 'left'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {},
  grid: {  
    //整个图表距离页面最左侧的相对距离
    left: '3%',
    right: '4%',
   //整个图表距离页面顶部的相对距离
    top:'18%',
    bottom: '3%',
    containLabel: true
  },
  toolbox: {
    feature: {
      dataView: { show: true, readOnly: false },
      magicType: { show: true, type: ['line', 'bar'] },
      restore: { show: true },
      saveAsImage: { show: true }
    }
  },
 //横坐标
  xAxis: [
    {
      type: 'category',
      //横坐标的名称
      data: ['A', 'B', 'C', 'D', 'E','F',
    'G','H','I','J','K','L',
    "N","M"],
    axisLabel: {
      interval: 0,
      //横坐标名称倾斜程度
      rotate: 30
    }
    }
    
  ],
//纵坐标,双纵坐标
  yAxis: [
    {
      type: 'value',
      //纵坐标名称
      name: '数量',
    },
    {
      type: 'value',
      name: '百分比',
      //纵坐标最小值
      min: 0,
      max: 100,
      //纵坐标间隔
      interval: 20,
      axisLabel: {
        //纵坐标加单位
      formatter: '{value} %'
      }
    }
  ],
  series: [
    {
      name: '数量1',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data: [4,1,1,6,0,
      8,7,10,1,0,
      1,2,1,1]
    },
    {
      name: '数量2',
      type: 'bar',
      emphasis: {
        focus: 'series'
      },
      label: {
        show: true
      },
      data: [4,1,1,6,0,
      7,6,10,1,0,
      1,2,1,1]
    },
    {
      name: '百分比',
      markPoint: {
        data: [
          //备注点的名称,展示内容,坐标点
          { name: 'markPoint', value: 'A', xAxis: 6, yAxis: 84,
          symbolSize:90,
          itemStyle:{
            //指定颜色
              color:'#DC143C'
          }
          },
          { name: 'markPoint', value: 'B', xAxis: 5, yAxis: 89,
          symbolSize:100,
          itemStyle:{
              color:'#DC143C'
          },
          }
        ],
      },
      type: 'line',
      yAxisIndex: 1,
      tooltip: {
        valueFormatter: function (value) {
          return value + ' %';
        }
      },
      color:'#a90000',
      label: {
        show: true,
        position: 'right',
      },
      data: [100,100,100,100,100,
      88,86,100,100,100,
      100,100,100,100]
    }
  ]  
};

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1034853.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

RocketMQ高性能核心原理与源码架构剖析(下)

四、融汇贯通阶段 开始梳理⼀些⽐较完整,⽐较复杂的完整业务线。 8 、消息持久化设计 1 、 RocketMQ 的持久化⽂件结构 消息持久化也就是将内存中的消息写⼊到本地磁盘的过程。⽽磁盘 IO 操作通常是⼀个很耗性能,很慢的操作,所以&#xf…

图像处理与计算机视觉--第三章-颜色与纹理分析-6问

图像处理与计算机视觉--第三章-颜色与纹理分析-6问 1.哪些因素决定物体颜色的感知? 对于物体颜色的感知,主要取决于以下三个因素: 1.照射到物体表面光波长的分布 2.物体表面如何反射照射光 3.传感器或者视觉细胞的敏感性 除了上述的三个因素之外&#xff0c…

nuc980学习笔记7-设置开机自启动

测试条件,nuc980开发板。 一、开机启动脚本 为什么需要开机自启动脚本?我们编写完程序之后,下载到开发板,往往需要程序开机自行启动,为了实现开机自启动,则需要编写相关的脚本。 二、设置开机启动的步骤 开…

2009-2022年上市公司华证 ESG数据

2009-2022年华证 ESG数据(年度) 1、时间:2009-2022年 2、范围:沪深A股上市公司 指标:证券简称、证券代码、华证ESG评级 2009-2022年华证ESG数据(季度) 1、时间:2009/03/31---20…

在React中,什么是组件的状态(state)?如何更新组件的状态?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ 创建和初始化状态⭐ 更新状态⭐ 注意事项⭐ 写在最后 ⭐ 专栏简介 前端入门之旅:探索Web开发的奇妙世界 欢迎来到前端入门之旅!感兴趣的可以订阅本专栏哦!这个专栏是为那些对Web开发感兴趣、刚刚踏入前…

力扣-228.汇总区间

AC Code 自己做出来的&#xff0c;代码写的很烂&#xff0c;但是也浅浅记录一下叭&#xff0c;下面有看答案思路写出来的双指针代码 class Solution { public:vector<string> summaryRanges(vector<int>& nums) {vector<string> ans;int n nums.size();…

Docker部署ElasticSearch数据库+analysis-ik分词器插件

文章目录 一、部署ElasticSearch数据库二、添加分词器插件(analysis-ik)三、测试ElasticSearch数据库analysis-ik分词器插件 一、部署ElasticSearch数据库 1、准备工作 docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.6 Pwd"/data/software/elasticse…

csa从初阶到大牛(练习题2-查询)

新建2个文件d1.txt d2.txt ,使用vim打开d1.txt 输入“Hello World”字符串,将b1.txt 硬链接到b2.txt &#xff0c;查看2个文件的硬连接数 # 新建文件d1.txt和d2.txt touch d1.txt d2.txt# 使用vim编辑d1.txt并输入文本"Hello World" vim d1.txt# 创建硬链接b2.…

红黑树Java实现

文章目录 红黑树1. 概念性质2. 红黑树节点定义3. 红黑树的插入情况1情况2情况3其它细节问题插入代码实现 4. 红黑树的验证5.性能分析 红黑树 1. 概念性质 红黑树也是一种二插搜索树&#xff0c;每一个节点上比普通二插搜索树都增加了一个存储位置表示节点的颜色&#xff0c;可…

【lesson10】进程状态

文章目录 认识进程状态新建运行阻塞挂起 Linux具体的进程状态RSDtTXZ是什么为什么 认识进程状态 上面就是各种进程状态&#xff0c;上面都是理论进程状态理论进程状态放在哪个操作系统中都是正确的&#xff0c;但是具体的操作系统实现可能又会有所不同。 下面我们来理解进程状态…

SurroundOcc:用于自动驾驶的多摄像头3D占用网格预测

文章&#xff1a;SurroundOcc: Multi-Camera 3D Occupancy Prediction for Autonomous Driving 作者&#xff1a;Yi Wei, Linqing Zhao, Wenzhao Zheng, Zheng Zhu , Jie Zhou, Jiwen Lu 编辑&#xff1a;点云PCL 代码&#xff1a;https://github.com/weiyithu/SurroundOcc.git…

【AI视野·今日NLP 自然语言处理论文速览 第三十七期】Wed, 20 Sep 2023

AI视野今日CS.NLP 自然语言处理论文速览 Wed, 20 Sep 2023 Totally 64 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computation and Language Papers SlimPajama-DC: Understanding Data Combinations for LLM Training Authors Zhiqiang Shen, Tianhua Tao, Li…

js惰性函数

看下面这份ts代码 实现的效果也很简单,就是将一份文本,复制到剪切板上,未了兼容更多的浏览器(没错说的就是你>ie !),做了一个兼容性判断, 当浏览器支持navigator.clipboard这个api时,就直接调用这个api将文本复制到剪切板中, 如果不支持这个api的话,就执行else里面的代码,这…

【Kafaka实现高吞吐量、低延迟的底层原理】

文章目录 Kafaka实现高吞吐量、低延迟的底层原理顺序写入Page Cache零拷贝分区分段索引批量读写批量压缩 Kafaka实现高吞吐量、低延迟的底层原理 Kafka虽然是基于磁盘做的数据存储&#xff0c;但却具有高并发、高吞吐量、低延时的特点&#xff0c;其吞吐量动辄几万、几十上百万…

springBoot对接多个mq并且实现延迟队列---未完待续

mq调用流程 创建消息转换器 package com.wd.config;import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.context.annotation.Bean; import o…

深度解析React 18应用性能提升

众所周知,React 18 引入的一个重要特性就是并发功能,从根本上改变了 React 应用程序的渲染方式。本文将带大家一同探讨这些最新功能的具体作用,特别是如何提高应用程序性能。 一、主线程与长任务 当我们在浏览器中运行 JavaScript 时,JS 引擎会在单线程环境下执行代码内容…

Kubernetes基础(二)-Headless Service

1 简介 Headless Service是一种特殊的服务类型&#xff0c;它不会分配虚拟 IP&#xff0c;而是直接暴露所有 Pod 的 IP 和 DNS 记录。这客户端可以直接访问 Pod IP 地址&#xff0c;并使用这些 IP 地址进行负载均衡。 Headless Services是一种特殊的service&#xff0c;其spec…

封装了一个中间放大效果的iOS轮播视图

效果图 计算逻辑 设定在中间展示的size&#xff0c;即正常size&#xff0c;然后设置水平和竖直方向上的margin, 在view的origin和scrollView的contentoffset相等的时候&#xff0c;即 视图处在正中间的时候&#xff0c;最大&#xff0c;然后通过计算其他视图的origin和scrollV…

计算机基础 堆和栈

首先我们需要知道的是栈和堆是两种数据结构 1.栈和堆的定义 栈&#xff1a;是一种先进后出的数据结构&#xff0c;是一种线性结构 堆是一种树形结构&#xff0c;是一颗完全二叉树&#xff0c; 其存储的元素可以通过指针或引用访问 最大堆【大根堆】 &#xff1a;堆中的每一个…

js-cookie使用 js深度克隆(判断引用类型是数组还是对象的方法)

cookie和深度拷贝的使用 1、js-cookie使用2、js深度克隆 1、js-cookie使用 前端的本地存储分为 localstorage、sesstionstorage、cookie 但是咱们有时候需要做7天免登录的需求时&#xff0c;选择 cookie 作为前端的本地存储是在合适不过的了 直接操作 cookie 可以&#xff0c; …