This commit is contained in:
duanxiaohai 2024-04-16 11:19:00 +08:00
parent 9a7703b2a1
commit e1cb692d68
1 changed files with 24 additions and 26 deletions

View File

@ -13,6 +13,8 @@ import * as echarts from "echarts";
const chart = ref(null); // DOM
const data = ["大街乡", "社阳乡", "沐尘畲族乡", "庙下乡", "溪口镇", "罗家乡"];
const datas = ["2", "4", "7", " 23", "25", "250"];
let zoomShow = true;
// if (data.length > 7) {
// zoomShow = true;
@ -31,7 +33,7 @@ let option = {
grid: {
top: "-2%",
left: "3%",
right: "4%",
right: "8%",
bottom: "3%",
containLabel: true,
color: "#ffffff",
@ -69,26 +71,24 @@ let option = {
},
],
calculable: true,
color: "rgba(0, 252, 255, 1)",
// label: {
// normal: {
// show: true,
// lineHeight: 10,
// formatter: '{c}',
// position: 'right',
// textStyle: {
// color: '#fff',
// fontSize: 10
// }
// }
// },
xAxis: {
// name: '/',
type: "value",
data: datas,
axisLabel: {
//
textStyle: {
color: "#ffffff",
},
// formatter: `{value}/` // x
formatter: function (value, index) {
if (index === datas.length - 1) {
//
return value + "/次"; //
} else {
return value; //
}
},
},
splitLine: {
//线
@ -102,17 +102,17 @@ let option = {
yAxis: {
type: "category", //
data: data,
axisLabel: {
// max:10,
//y
axisLabel: {
inside: false,
//
bargap: 0.5,
bargap: 0.5, //
textStyle: {
color: "#ffffff",
},
},
axisLine: {
//y线
axisLine: {
show: false,
lineStyle: {
color: "#ffffff",
@ -126,10 +126,8 @@ let option = {
//
height: 100,
},
// max:10,
splitLine: {
//线
splitLine: {
show: false,
lineStyle: {
color: "#ffffff",
@ -140,15 +138,16 @@ let option = {
series: [
{
type: "bar",
data: [2, 4, 7, 23, 25, 250],
data: datas,
barWidth: 15, //
barGap: 0.3 /*多个并排柱子设置柱子之间的间距*/,
// barCategoryGap: "10" /**/,
barMaxWidth: 20, //
barMinWidth: 5, //
itemStyle: {
// emphasis: {
// barBorderRadius: 7
// },
normal: {
borderWidth: 1,
borderColor: "rgba(0, 183, 255, 1)",
borderRadius: [0, 0, 50, 0], //
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: "rgba(26, 255, 217, 0)" },
@ -160,7 +159,6 @@ let option = {
],
};
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));