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],

},

],

};

相关推荐
烬头882127 分钟前
React Native鸿蒙跨平台采用了函数式组件的形式,通过 props 接收分类数据,使用 TouchableOpacity实现了点击交互效果
javascript·react native·react.js·ecmascript·交互·harmonyos
s1hiyu27 分钟前
C++动态链接库开发
开发语言·c++·算法
Amumu1213827 分钟前
Vuex介绍
前端·javascript·vue.js
(❁´◡`❁)Jimmy(❁´◡`❁)28 分钟前
CF2188 C. Restricted Sorting
c语言·开发语言·算法
We་ct28 分钟前
LeetCode 54. 螺旋矩阵:两种解法吃透顺时针遍历逻辑
前端·算法·leetcode·矩阵·typescript
星火开发设计33 分钟前
C++ 预处理指令:#include、#define 与条件编译
java·开发语言·c++·学习·算法·知识
许泽宇的技术分享35 分钟前
第 1 章:认识 Claude Code
开发语言·人工智能·python
2601_9498095940 分钟前
flutter_for_openharmony家庭相册app实战+相册详情实现
javascript·flutter·ajax
qq_1777673744 分钟前
React Native鸿蒙跨平台通过Animated.Value.interpolate实现滚动距离到动画属性的映射
javascript·react native·react.js·harmonyos
AIFQuant1 小时前
如何利用免费股票 API 构建量化交易策略:实战分享
开发语言·python·websocket·金融·restful