Compare commits

..

No commits in common. "33956d49cbc056ce82f4822364ea1816c4127ea6" and "29db0c4024a943a08024f9b6b0255fc932d02909" have entirely different histories.

4 changed files with 46 additions and 137 deletions

View File

@ -33,16 +33,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
showMarkPoint: { showMarkPoint: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isHorizontal: {
type: Boolean,
default: false,
},
}, },
emits: ['click'], emits: ['click'],
setup(props, { emit }) { setup(props, { emit }) {
@ -88,7 +82,6 @@ export default {
Object.assign(option, cloneDeep(props.option)); Object.assign(option, cloneDeep(props.option));
} else { } else {
Object.assign(option, cloneDeep(props.option)); Object.assign(option, cloneDeep(props.option));
}
let typeArr = Array.from(new Set(props.chartData.map((item) => item.type))); let typeArr = Array.from(new Set(props.chartData.map((item) => item.type)));
let xAxisData = Array.from(new Set(props.chartData.map((item) => item.name))); let xAxisData = Array.from(new Set(props.chartData.map((item) => item.name)));
let seriesData = []; let seriesData = [];
@ -116,9 +109,9 @@ export default {
option.series = props.isSeries && option.series.length > 0 ? option.series : seriesData; option.series = props.isSeries && option.series.length > 0 ? option.series : seriesData;
if (props.isHorizontal) { if (props.isHorizontal) {
option.yAxis.data = xAxisData; option.yAxis.data = xAxisData;
option.xAxis.data = [];
} else { } else {
option.xAxis.data = xAxisData; option.xAxis.data = [];
}
} }
console.log(option); console.log(option);
setOptions(option); setOptions(option);

View File

@ -11,6 +11,8 @@
.custom-tooltip-container{ .custom-tooltip-container{
border-radius: 8px !important; border-radius: 8px !important;
padding: 6px 16px 6px 8px !important;
background-color: rgba(0,0,0,0.7) !important;
backdrop-filter: blur(8px) !important; backdrop-filter: blur(8px) !important;
& span{ & span{
width: 8px !important; width: 8px !important;

View File

@ -16,15 +16,6 @@ const props = defineProps({
}, },
}); });
let values = reactive([]);
const getValue = (dataList) => {
let arr = [];
for (let i = 0; i < dataList.length; i++) {
arr.push(dataList[i].value);
}
return arr;
};
const state = reactive({ const state = reactive({
data: [], data: [],
option: { option: {
@ -54,10 +45,10 @@ const state = reactive({
extraCssText: 'backdrop-filter: blur(8px);', extraCssText: 'backdrop-filter: blur(8px);',
}, },
barStyle: { barStyle: {
barWidth: 14, barWidth: 10,
itemStyle: { itemStyle: {
borderWidth: 14, borderWidth: 10,
borderRadius: [10, 10, 10, 10], // borderRadius: [8, 8, 8, 8], //
}, },
color: { color: {
type: 'linear', type: 'linear',
@ -95,8 +86,7 @@ const state = reactive({
show: false, show: false,
}, },
}, },
yAxis: [ yAxis: {
{
type: 'category', type: 'category',
data: ['耿马镇', '勐撒镇', '勐永镇', '孟定镇', '大兴乡'], data: ['耿马镇', '勐撒镇', '勐永镇', '孟定镇', '大兴乡'],
axisTick: { axisTick: {
@ -109,86 +99,12 @@ const state = reactive({
show: false, show: false,
}, },
}, },
{
//
type: 'category',
inverse: true,
offset: 10,
axisTick: 'none',
axisLine: 'none',
show: true,
axisLabel: {
textStyle: {
color: '#ffffff',
fontSize: '16',
},
formatter: function (value) {
let str = '{title|' + value + '吨}';
return str;
},
rich: {
title: {
color: '#fff',
fontSize: 16,
},
},
},
data: [12000, 8000, 6000, 4000, 3500],
},
],
series: [ series: [
{ {
name: '值',
type: 'bar', type: 'bar',
zlevel: 1, // barWidth: '40%', //
barBorderRadius: 10, // barMinHeight: 2, //
itemStyle: { // barGap: '20%', //
borderRadius: [10, 10, 10, 10],
color: 'rgba(100, 200, 255, 0.3)',
},
backgroundStyle: {
color: 'rgba(100, 200, 255, 0.3)',
borderRadius: [10, 10, 10, 10], // barBorderRadius
},
barWidth: 20,
data: values,
label: {
position: [0, -16],
align: 'left',
show: true,
formatter: (params) => {
return params.name;
},
},
barMaxWidth: 40,
markLine: {
label: {
color: '#26a69a',
},
},
},
{
name: '背景',
type: 'bar',
barWidth: 20,
barGap: '-100%',
data: [],
barBorderRadius: 30,
itemStyle: {
normal: {
color: 'rgba(105,131,242,.3)',
borderRadius: 10,
},
},
label: {
show: false,
},
barMaxWidth: 40,
markLine: {
label: {
color: '#26a69a',
},
},
}, },
], ],
}, },
@ -232,7 +148,6 @@ const loadData = (val) => {
} }
} }
} }
values = getValue(state.data);
console.log(val); console.log(val);
}; };
</script> </script>

View File

@ -23,7 +23,6 @@ const state = reactive({
containLabel: true, containLabel: true,
}, },
tooltip: { tooltip: {
show: true,
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow', type: 'shadow',