RankGlen 2022-04-09 10:10 采纳率: 0%
浏览 23

echarts怎么绘制多行象形柱状图

第一个柱状图的数据为什么会到第二个柱状图那里,还有x轴数据为什么不在中间

  • 写回答

1条回答 默认 最新

  • CSDN专家-sinJack 2022-04-09 10:21
    关注

    echarts官网获取demo

    
    option = {
        backgroundColor:'#031d33',
            animation: true,
            grid: {
              top: "5%",
              bottom: "15%",
              right: "5%"
            },
            xAxis: {
              data: ['消防烟感','摄像机','环境烟感','路灯','地磁'],
              axisLine: {
                show: false //隐藏X轴轴线
              },
              axisTick: {
                show: false //隐藏X轴轴线
              },
              splitLine: {
                show: true,
                lineStyle: {
                  color: "rgba(77, 128, 254, 0.2)",
                  width: 2
                }
              },
              axisLabel: {
                show: true,
                margin: 14,
                fontSize: 16,
                textStyle: {
                  color: "#65D5FF" //X轴文字颜色
                }
              }
            },
            yAxis: [
              {
                type: "value",
                gridIndex: 0,
                min: 0,
                max: 100,
                interval: 25,
                // splitNumber: 4,
                splitLine: {
                  show: true,
                  lineStyle: {
                    color: "rgba(77, 128, 254, 0.2)",
                    width: 2
                  }
                },
                axisTick: {
                  show: false
                },
                axisLine: {
                  show: true,
                  lineStyle: {
                    color: "rgba(77, 128, 254, 0.2)"
                  }
                },
                axisLabel: {
                  show: true,
                  margin: 14,
                  fontSize: 16,
                  textStyle: {
                    color: "#65D5FF"
                  }
                }
              }
            ],
            series: [
              {
                name: "设备在线率",
                type: "bar",
                barWidth: 16,
                itemStyle: {
                  normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                      {
                        offset: 0,
                        color: "rgba(146, 225, 255, 1)"
                      },
                      {
                        offset: 1,
                        color: "rgba(0, 151, 251, 1)"
                      }
                    ])
                  }
                },
                data: [21,43,56,32,64],
                z: 10,
                zlevel: 0
              },
              {
                // 分隔
                type: "pictorialBar",
                itemStyle: {
                  normal: {
                    color: "#0F375F"
                  }
                },
                symbolRepeat: "fixed",
                symbolMargin: 6,
                symbol: "rect",
                symbolClip: true,
                symbolSize: [18, 2],
                symbolPosition: "start",
                symbolOffset: [1,1],
                data:  [21,43,56,32,64],
                width: 2,
                z: 0,
                zlevel: 1
              },
              {
                name: "外框",
                type: "bar",
                barGap: "-110%", // 设置外框粗细
                data: [100, 100, 100, 100, 100, 100, 100],
                barWidth: 16,
                itemStyle: {
                  normal: {
                    color: "transparent", // 填充色
                    // barBorderRadius: 0, //圆角半径
                    label: {
                      // 标签显示位置
                      show: false,
                      position: "top" // insideTop 或者横向的 insideLeft
                    }
                  }
                },
                z: 0
              },
              {
                name: "背影",
                type: "line",
                smooth: true, //平滑曲线显示
                showAllSymbol: false, //显示所有图形。
                symbolSize: 0,
                lineStyle: {
                  width: 0
                },
                areaStyle: {
                  color: "rgba(0, 151, 251, 0.1)"
                },
                data:  [21,43,56,32,64],
                z: 5
              }
            ],
            dataZoom: [
              {
                type: "slider",
                show: false,
                xAxisIndex: [0],
                endValue: 4,
                startValue: 0
              }
            ]
          }
    
    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 4月9日

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法