echarts 柱状图包含右侧进度

javascript 复制代码
 const categories = ["ZSZQ-1标", "ZSZQ-2标", "ZSZQ-3标", "ZSZQ-4标"] ;

    const xuan = [60, 54, 96, 35];
    const pei = [74, 63, 54, 43];
    const kao = [64, 53, 74, 23];
option = {
    backgroundColor: '#0C1E49',
   tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
        legend: {
            data: ["选(右轴)", "培", "考"],
            top: 6,
            right: 10,
            textStyle: { color: "#CFE2FF" },
        },
        grid: {
            left: "3%",
            right: "5%",
            bottom: "10%",
            top: "18%",
            containLabel: true,
        },
        xAxis: [
            {
                type: "category",
                data: categories,
                axisTick: { show: false },
                axisLine: { lineStyle: { color: "#7FA7D8" } },
                axisLabel: { color: "#CFE2FF" },
            },
        ],
        yAxis: [
            {
                type: "value",
                min: 0,
                axisTick: {
                    show: true //隐藏X轴刻度
                },
                // 左轴根据数据自适应刻度,不设固定满刻度
                splitLine: { show: false },
                axisLine: {
                    lineStyle: { color: "#7FA7D8" }, show: true, //隐藏X轴轴线
                },
                axisLabel: { color: "#CFE2FF" },
            },
            {
                type: "value",
                min: 0,
                max: 100,
                axisTick: {
                    show: true //隐藏X轴刻度
                },
                splitLine: { show: false },
                axisLine: {
                    lineStyle: { color: "#7FA7D8" }, show: true, //隐藏X轴轴线
                },
                axisLabel: {
                    color: "#CFE2FF",
                    formatter: (val) => `${val}%`,
                },
            },
        ],
        series: [

            {
                name: "培",
                type: "bar",
                barWidth: 20,
                itemStyle: { color: "#29F19C", barBorderRadius:  [5,5, 0, 0], },
                data: pei,
                z: 1,
            },
            {
                name: "考",
                type: "bar",
                barWidth: 20,
                itemStyle: { color: "#F3BA61", barBorderRadius:  [5,5, 0, 0], },
                data: kao,
                z: 1,
            },
            {
                name: "选(右轴)",
                type: "bar",
                yAxisIndex: 1,
                barWidth: 20,
                itemStyle: { color: "#6DA5FF" ,
               //   barBorderRadius:  [10,10, 0, 0],
                 },
                showBackground: true,
                
                backgroundStyle: {
                   
                    color: "rgba(255,255,255,0.15)",
                },
                data: xuan,
                z: 1,
            },
        ],
};

const categories = ["ZSZQ-1标", "ZSZQ-2标", "ZSZQ-3标", "ZSZQ-4标"] ;

const xuan = [60, 54, 96, 35];

const pei = [74, 63, 54, 43];

const kao = [64, 53, 74, 23];

option = {

backgroundColor: '#0C1E49',

tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },

legend: {

data: ["选(右轴)", "培", "考"],

top: 6,

right: 10,

textStyle: { color: "#CFE2FF" },

},

grid: {

left: "3%",

right: "5%",

bottom: "10%",

top: "18%",

containLabel: true,

},

xAxis: [

{

type: "category",

data: categories,

axisTick: { show: false },

axisLine: { lineStyle: { color: "#7FA7D8" } },

axisLabel: { color: "#CFE2FF" },

},

],

yAxis: [

{

type: "value",

min: 0,

axisTick: {

show: true //隐藏X轴刻度

},

// 左轴根据数据自适应刻度,不设固定满刻度

splitLine: { show: false },

axisLine: {

lineStyle: { color: "#7FA7D8" }, show: true, //隐藏X轴轴线

},

axisLabel: { color: "#CFE2FF" },

},

{

type: "value",

min: 0,

max: 100,

axisTick: {

show: true //隐藏X轴刻度

},

splitLine: { show: false },

axisLine: {

lineStyle: { color: "#7FA7D8" }, show: true, //隐藏X轴轴线

},

axisLabel: {

color: "#CFE2FF",

formatter: (val) => `${val}%`,

},

},

],

series: [

{

name: "培",

type: "bar",

barWidth: 20,

itemStyle: { color: "#29F19C", barBorderRadius: [5,5, 0, 0], },

data: pei,

z: 1,

},

{

name: "考",

type: "bar",

barWidth: 20,

itemStyle: { color: "#F3BA61", barBorderRadius: [5,5, 0, 0], },

data: kao,

z: 1,

},

{

name: "选(右轴)",

type: "bar",

yAxisIndex: 1,

barWidth: 20,

itemStyle: { color: "#6DA5FF" ,

// barBorderRadius: [10,10, 0, 0],

},

showBackground: true,

backgroundStyle: {

color: "rgba(255,255,255,0.15)",

},

data: xuan,

z: 1,

},

],

};

相关推荐
sigernet4 分钟前
Claude Code 不再推荐 npm 安装:官方改为 Native Installer
前端·npm·node.js
We་ct4 分钟前
LeetCode 212. 单词搜索 II:Trie+DFS 高效解法
开发语言·算法·leetcode·typescript·深度优先·图搜索算法·图搜索
lxh01138 分钟前
函数防抖题解
前端·javascript·算法
OxyTheCrack9 分钟前
【C++】简述main函数中的argc与argv
开发语言·c++
颜酱12 分钟前
环检测与拓扑排序:BFS/DFS双实现
javascript·后端·算法
我发现一个问题14 分钟前
node+ts+koa全栈框架学习-1
前端
历程里程碑16 分钟前
Linux 49 HTTP请求与响应实战解析 带http模拟实现源码--万字长文解析
java·开发语言·网络·c++·网络协议·http·排序算法
sure28217 分钟前
React Native中自定义TabBar
前端·react native·react.js
ZVAyIVqt0UFji17 分钟前
高可用虚拟IP(HaVip)技术详解:原理、设计与应用
开发语言·网络·网络协议·tcp/ip·perl
飞Link18 分钟前
深度解析 TS2Vec:时序表示学习中的层次化建模(Hierarchical Contrastive Learning)
开发语言·python·学习·数据挖掘