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