echarts 柱状图曲线图

javascript 复制代码
option = {
  backgroundColor: '#0C1E49',
  

  tooltip: {
    trigger: "axis",
    textStyle: {
      fontSize: 14,
      fontWeight: 400,
      color: "rgb(255, 255, 255)",
    },
    backgroundColor: "#43434391",
    borderColor: "#43434391",
  },
legend: {
         //  align: "right",
         //  right: "14%",
          top: "5%",
          //   type: "plain",
          //   formatter: ["{name}"].join("\n"),
          textStyle: {
            color: "rgba(255, 255, 255, 0.6)"
        }
        
        },
 

  grid: {
    top: "12%",
    bottom: "2%",
    right: "2%",
    left: "2%",
    containLabel: true,
  },

  xAxis: [
    {
      type: "category",
      splitLine: { show: false },
      data: ["1月", "2月", "3月", "4月", "5月", "6月",
             "7月", "8月", "9月", "10月", "11月", "12月"],
      axisTick: {
        alignWithLabel: true,
        show: true,
        length: 5,
      },
      axisLabel: {
        show: true,
        textStyle: { color: "#bfd0e1" },
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: "rgba(255,255,255,0.8)",
          fontSize: 13,
        },
      },
    },
  ],

  yAxis: [
    {
      type: "value",
      name: "单位:万元",
      splitLine: { show: false },
      axisLine: {
        show: true,
        lineStyle: {
          color: "rgba(255,255,255,0.8)",
          fontSize: 13,
        },
      },
      splitNumber: 5,
      axisLabel: {
        show: true,
        margin: 15,
        textStyle: { color: "#bfd0e1" },
      },
      axisTick: {
        show: true,
        length: 5,
      },
    },
    {
      type: "value",
      name: "",
      splitLine: { show: false },
      axisLine: { show: false },
      splitNumber: 5,
      axisLabel: {
        show: true,
        margin: 15,
        textStyle: { color: "#bfd0e1" },
      },
      axisTick: {
        show: true,
        length: 5,
      },
    },
  ],

  series: [
    /* ===== 月度计划 bar + 上下菱形 ===== */
    {
      name: "月度计划",
      type: "bar",
      barMaxWidth: "auto",
      barWidth: 20,
      data: [120, 132, 145, 134, 156, 135, 147, 120, 152, 144, 136, 158],
      itemStyle: {
        color: {
          type: "linear",
          x: 0, y: 0, x2: 0, y2: 1,
          colorStops: [
            { offset: 0, color: "#009b73" },
            { offset: 1, color: "#00e362" },
          ],
        },
      },
    },
    {
      name: "月度计划",
      type: "pictorialBar",
      barMaxWidth: 20,
      symbol: "diamond",
      symbolOffset: [-12, "40%"],
      symbolSize: [20, 10],
      color: "#00e462",
      data: [10, 21, 25, 35, 35, 10, 10, 10, 10, 10, 10, 10],
      tooltip: { show: false },
      zlevel: 2,
    },
    {
      name: "月度计划",
      type: "pictorialBar",
      barMaxWidth: 20,
      symbol: "diamond",
      symbolPosition: "end",
      symbolOffset: [-12, "-50%"],
      symbolSize: [20, 10],
      color: "#00e462",
      data: [120, 132, 145, 134, 156, 135, 147, 120, 152, 144, 136, 158],
      tooltip: { show: false },
      zlevel: 2,
    },

    /* ===== 月度完成 bar + 上下菱形 ===== */
    {
      name: "月度完成",
      type: "bar",
      barMaxWidth: "auto",
      barWidth: 20,
      data: [115, 125, 140, 130, 150, 128, 138, 110, 148, 135, 125, 150],
      itemStyle: {
        color: {
          type: "linear",
          x: 0, y: 0, x2: 0, y2: 1,
          colorStops: [
            { offset: 0, color: "#0d67b2" },
            { offset: 1, color: "#24a2f6" },
          ],
        },
      },
    },
    {
      name: "月度完成",
      type: "pictorialBar",
      barMaxWidth: 20,
      symbol: "diamond",
      symbolOffset: [12, "40%"],
      symbolSize: [20, 10],
      color: "#24a2f6",
      data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
      tooltip: { show: false },
      zlevel: 2,
    },
    {
      name: "月度完成",
      type: "pictorialBar",
      barMaxWidth: 20,
      symbol: "diamond",
      symbolPosition: "end",
      symbolOffset: [11, "-50%"],
      symbolSize: [20, 10],
      color: "#24a2f6",
      data: [115, 125, 140, 130, 150, 128, 138, 110, 148, 135, 125, 150],
      tooltip: { show: false },
      zlevel: 2,
    },

    /* ===== 年累计划 / 年累完成 折线 ===== */
    {
      name: "年累计划",
      type: "line",
      smooth: true,
      symbolSize: 6,
      color: "#FFB805",
      itemStyle: {
        borderColor: "#FFB805",
        borderWidth: 2,
      },
      lineStyle: { color: "#FFB805" },
      data:  [120, 152, 197, 231, 287, 322, 369, 429, 441, 485, 521, 579],
    },
    {
      name: "年累完成",
      type: "line",
      smooth: true,
      symbolSize: 6,
      color: "#FF4545",
      itemStyle: {
        borderColor: "#FF4545",
        borderWidth: 2,
      },
      lineStyle: { color: "#FF4545" },
      data: [115, 140, 180, 210, 260, 288, 326, 336, 384, 419, 444, 594],
    },
  ],
};

option = {

backgroundColor: '#0C1E49',

tooltip: {

trigger: "axis",

textStyle: {

fontSize: 14,

fontWeight: 400,

color: "rgb(255, 255, 255)",

},

backgroundColor: "#43434391",

borderColor: "#43434391",

},

legend: {

// align: "right",

// right: "14%",

top: "5%",

// type: "plain",

// formatter: ["{name}"].join("\n"),

textStyle: {

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

}

},

grid: {

top: "12%",

bottom: "2%",

right: "2%",

left: "2%",

containLabel: true,

},

xAxis: [

{

type: "category",

splitLine: { show: false },

data: ["1月", "2月", "3月", "4月", "5月", "6月",

"7月", "8月", "9月", "10月", "11月", "12月"],

axisTick: {

alignWithLabel: true,

show: true,

length: 5,

},

axisLabel: {

show: true,

textStyle: { color: "#bfd0e1" },

},

axisLine: {

show: true,

lineStyle: {

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

fontSize: 13,

},

},

},

],

yAxis: [

{

type: "value",

name: "单位:万元",

splitLine: { show: false },

axisLine: {

show: true,

lineStyle: {

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

fontSize: 13,

},

},

splitNumber: 5,

axisLabel: {

show: true,

margin: 15,

textStyle: { color: "#bfd0e1" },

},

axisTick: {

show: true,

length: 5,

},

},

{

type: "value",

name: "",

splitLine: { show: false },

axisLine: { show: false },

splitNumber: 5,

axisLabel: {

show: true,

margin: 15,

textStyle: { color: "#bfd0e1" },

},

axisTick: {

show: true,

length: 5,

},

},

],

series: [

/* ===== 月度计划 bar + 上下菱形 ===== */

{

name: "月度计划",

type: "bar",

barMaxWidth: "auto",

barWidth: 20,

data: [120, 132, 145, 134, 156, 135, 147, 120, 152, 144, 136, 158],

itemStyle: {

color: {

type: "linear",

x: 0, y: 0, x2: 0, y2: 1,

colorStops: [

{ offset: 0, color: "#009b73" },

{ offset: 1, color: "#00e362" },

],

},

},

},

{

name: "月度计划",

type: "pictorialBar",

barMaxWidth: 20,

symbol: "diamond",

symbolOffset: [-12, "40%"],

symbolSize: [20, 10],

color: "#00e462",

data: [10, 21, 25, 35, 35, 10, 10, 10, 10, 10, 10, 10],

tooltip: { show: false },

zlevel: 2,

},

{

name: "月度计划",

type: "pictorialBar",

barMaxWidth: 20,

symbol: "diamond",

symbolPosition: "end",

symbolOffset: [-12, "-50%"],

symbolSize: [20, 10],

color: "#00e462",

data: [120, 132, 145, 134, 156, 135, 147, 120, 152, 144, 136, 158],

tooltip: { show: false },

zlevel: 2,

},

/* ===== 月度完成 bar + 上下菱形 ===== */

{

name: "月度完成",

type: "bar",

barMaxWidth: "auto",

barWidth: 20,

data: [115, 125, 140, 130, 150, 128, 138, 110, 148, 135, 125, 150],

itemStyle: {

color: {

type: "linear",

x: 0, y: 0, x2: 0, y2: 1,

colorStops: [

{ offset: 0, color: "#0d67b2" },

{ offset: 1, color: "#24a2f6" },

],

},

},

},

{

name: "月度完成",

type: "pictorialBar",

barMaxWidth: 20,

symbol: "diamond",

symbolOffset: [12, "40%"],

symbolSize: [20, 10],

color: "#24a2f6",

data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],

tooltip: { show: false },

zlevel: 2,

},

{

name: "月度完成",

type: "pictorialBar",

barMaxWidth: 20,

symbol: "diamond",

symbolPosition: "end",

symbolOffset: [11, "-50%"],

symbolSize: [20, 10],

color: "#24a2f6",

data: [115, 125, 140, 130, 150, 128, 138, 110, 148, 135, 125, 150],

tooltip: { show: false },

zlevel: 2,

},

/* ===== 年累计划 / 年累完成 折线 ===== */

{

name: "年累计划",

type: "line",

smooth: true,

symbolSize: 6,

color: "#FFB805",

itemStyle: {

borderColor: "#FFB805",

borderWidth: 2,

},

lineStyle: { color: "#FFB805" },

data: [120, 152, 197, 231, 287, 322, 369, 429, 441, 485, 521, 579],

},

{

name: "年累完成",

type: "line",

smooth: true,

symbolSize: 6,

color: "#FF4545",

itemStyle: {

borderColor: "#FF4545",

borderWidth: 2,

},

lineStyle: { color: "#FF4545" },

data: [115, 140, 180, 210, 260, 288, 326, 336, 384, 419, 444, 594],

},

],

};

相关推荐
喝拿铁写前端12 小时前
当 AI 会写代码之后,我们应该怎么“管”它?
前端·人工智能
老前端的功夫12 小时前
TypeScript 类型魔术:模板字面量类型的深层解密与工程实践
前端·javascript·ubuntu·架构·typescript·前端框架
2501_9418705613 小时前
面向微服务熔断与流量削峰策略的互联网系统稳定性设计与多语言工程实践分享
开发语言·python
modelmd13 小时前
Go 编程语言指南 练习题目分享
开发语言·学习·golang
Nan_Shu_61413 小时前
学习: Threejs (2)
前端·javascript·学习
G_G#13 小时前
纯前端js插件实现同一浏览器控制只允许打开一个标签,处理session变更问题
前端·javascript·浏览器标签页通信·只允许一个标签页
带土113 小时前
4. C++ static关键字
开发语言·c++
C++ 老炮儿的技术栈13 小时前
什么是通信规约
开发语言·数据结构·c++·windows·算法·安全·链表
@大迁世界13 小时前
TypeScript 的本质并非类型,而是信任
开发语言·前端·javascript·typescript·ecmascript