123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- import * as echarts from "echarts";
- const commonStyle = {
- xAxis: {
- type: "category",
- axisTick: {
- show: false,
- },
- axisLine: {
- lineStyle: {
- color: "rgba(185,185,185,0.3)",
- },
- },
- axisLabel: {
- show: true,
- color: "rgba(255,255,255,0.6)",
- margin: 5,
- },
- data: ["正常", "较大", "异常"],
- },
- yAxis: {
- type: "value",
- show: false,
- axisLine: {
- show: false,
- },
- },
- grid: {
- top: "0%",
- left: "-10%",
- right: "0%",
- bottom: "0%",
- containLabel: true,
- },
- };
- const styleName1 = {
- ...commonStyle,
- series: [
- {
- data: [32, 40, 42],
- type: "bar",
- barWidth: 26,
- label: {
- show: true,
- color: "#fff",
- position: "insideTop",
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#BBA269",
- },
- {
- offset: 1,
- color: "#3D3523",
- },
- ]),
- borderRadius: [2, 2, 0, 0],
- },
- },
- ],
- };
- const styleName2 = {
- ...commonStyle,
- series: [
- {
- data: [32, 40, 42],
- type: "bar",
- barWidth: 26,
- stack: "total",
- label: {
- show: true,
- color: "#fff",
- position: "insideTop",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#BBA269",
- },
- {
- offset: 1,
- color: "#3D3523",
- },
- ]),
- // borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#B81500' // 高亮时的颜色
- },
- },
- {
- data: [0, 1, 0,13],
- type: "bar",
- barWidth: 26,
- stack: "total",
- label: {
- show: true,
- color: "#fff",
- // position: "top",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#ff0000",
- },
- {
- offset: 1,
- color: "#B81500",
- },
- ]),
- borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#B81500' // 高亮时的颜色
- },
- },
- {
- data: [16,15,16, 3],
- type: "bar",
- barWidth: 26,
- stack: "total",
- itemStyle: {
- color: "rgba(56,56,56,0.94)",
- borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#B81500' // 高亮时的颜色
- },
- label: {
- show: true,
- position: "insideTop",
- color: "#fff",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- },
- ],
- };
- const styleName3 = {
- ...commonStyle,
- series: [
- {
- data: [32, 40, 42],
- type: "bar",
- barWidth: 26,
- stack: "total",
- label: {
- show: true,
- color: "#fff",
- position: "insideTop",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#BBA269",
- },
- {
- offset: 1,
- color: "#3D3523",
- },
- ]),
- // borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#006F0B' // 高亮时的颜色
- },
- },
- {
- data: [16, 16, 16, 0],
- type: "bar",
- barWidth: 26,
- stack: "total",
- label: {
- show: true,
- color: "#fff",
- position: "insideTop",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#bb7d4c",
- },
- {
- offset: 1,
- color: "#90603a",
- },
- ]),
- borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#006F0B' // 高亮时的颜色
- },
- },
- {
- data: [0,0, 0, 0],
- type: "bar",
- barWidth: 26,
- stack: "total",
- itemStyle: {
- color: "rgba(56,56,56,0.94)",
- borderRadius: [2, 2, 0, 0],
- },
- emphasis: {
- color: '#006F0B' // 高亮时的颜色
- },
- label: {
- show: true,
- position: "insideTop",
- color: "#fff",
- formatter: ({ value }) => {
- return value ? value : "";
- },
- },
- },
- ],
- };
- export const barOption = { styleName1, styleName2,styleName3 };
|