This commit is contained in:
duanxiaohai 2024-04-16 14:54:49 +08:00
parent 603e339ebd
commit 86889c99bb
2 changed files with 0 additions and 234 deletions

View File

@ -1,233 +0,0 @@
<template>
<div
ref="chart"
style="width: 100%; height: calc(100% - 46px); min-height: 150px"
></div>
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
// echarts
import * as echarts from "echarts";
const chart = ref(null); // DOM
const data = ["大街乡", "社阳乡", "沐尘畲族乡", "庙下乡", "溪口镇", "罗家乡"];
const datas = ["8", "10", "7", " 23", "25", "250"];
let zoomShow = true;
// if (data.length > 7) {
// zoomShow = true;
// } else {
// zoomShow = false;
// }
let option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
legend: {},
grid: {
top: "-2%",
left: "3%",
right: "8%",
bottom: "3%",
containLabel: true,
// containLabel:false,
color: "#ffffff",
},
// dataZoom: [
// {//
// show: zoomShow,
// type: "inside",
// startValue: 0,
// endValue: 2,
// minValueSpan: 2,
// maxValueSpan: 2,
// yAxisIndex: [0],
// zoomOnMouseWheel: false, //
// moveOnMouseWheel: true, //
// moveOnMouseMove: true, //
// },
// { //使
// show: zoomShow,
// type: "slider",
// realtime: true,
// startValue: 0,
// endValue: 2,
// width: "3.5",
// height: "80%",
// yAxisIndex: [0], // y
// fillerColor: "rgba(154, 181, 215, 1)", //
// borderColor: "rgba(17, 100, 210, 0.12)",
// backgroundColor: "#cfcfcf", //
// handleSize: 0, //
// showDataShadow: false, // auto
// showDetail: false, //
// top: "1%",
// right: "5",//
// },
// ],
dataZoom: [
{
//使
id: "dataZoomY",
type: "slider",
yAxisIndex: [0], // y
filterMode: "empty", //,
width: "10",
height: "100%",
right: "3%", //
orient: "vertical", // 'horizontal''vertical'
start: 0, // ,0 ~ 100
end: 70, //
zoomLock: true, //
fillerColor: "rgba(154, 181, 215, 1)", //
borderColor: "rgba(17, 100, 210, 0.12)",
backgroundColor: "#cfcfcf", //
handleSize: 0, //
showDataShadow: false, // auto
showDetail: false, //
zoomOnMouseWheel: false, //
moveOnMouseWheel: true, //
moveOnMouseMove: true, //
},
],
calculable: true,
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: {
//线
show: true,
lineStyle: {
color: "rgba(255, 255, 255, 0.2)",
width: 1,
},
},
axisPointer: {
label: {
autoSplitNumber: 5,
},
},
axisTick: {
show: true, // x
},
},
yAxis: {
show:true,
type: "category", //
data: data,
// max:10,
//y
axisLabel: {
show: true ,
inside: false,
// bargap: 0.5, //
textStyle: {
color: "#ffffff",
},
},
//y线
axisLine: {
show:true,
lineStyle: {
color: "#ffffff",
width: 1,
type: "solid",
},
},
axisTick: {
show: true, // x
},
//
// scrollbar: {
// orient: "vertical",
// //
// height: 100,
// },
//线
splitLine: {
// show: false,
show:true,
lineStyle: {
color: "#ffffff",
width: 1,
},
},
},
series: [
{
type: "bar",
name: "次数",
data: datas,
barWidth: 15, //
barGap: 0.3 /*多个并排柱子设置柱子之间的间距*/,
// barCategoryGap: "10" /**/,
barMaxWidth: 20, //
barMinWidth: 5, //
itemStyle: {
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)" },
{ offset: 1, color: "rgba(0, 183, 255, 1)" },
]),
},
},
},
],
};
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3
var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使
myChart.setOption(option);
// myChart.on("scroll", function (event) {
// // bargap
// var bargap = event.scrollData / 10000; // 1%0.5bargap
// myChart.setOption({
// yAxis: {
// axisLabel: {
// bargap: bargap,
// },
// },
// });
// });
// :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
});
</script>
<style scoped></style>

View File

@ -177,7 +177,6 @@ import eP3_2 from "./echarts_yl/eP3_2.vue";
import ePie2 from "./echarts_yl/pie2.vue";
import eGraph from "./echarts_yl/graph.vue";
import ePie3d from "./echarts_yl/pie3d.vue";
// import waterBall from "./echarts_yl/waterBall.vue";
import ylJHSY from "./echarts_yl/ylJHSY.vue";
import ylSMFW from "./echarts_yl/ylSMFW.vue";
import ylXZZC from "./echarts_yl/ylXZZC.vue";