80 lines
1.7 KiB
Vue
80 lines
1.7 KiB
Vue
<template>
|
|
<custom-echart-bar :chart-data="state.data" height="100%" :option="state.option" />
|
|
</template>
|
|
<script setup>
|
|
import { reactive } from 'vue';
|
|
|
|
const state = reactive({
|
|
option: {
|
|
grid: {
|
|
left: '5%',
|
|
right: '5%',
|
|
bottom: '5%',
|
|
top: '10%',
|
|
containLabel: true,
|
|
},
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
axisPointer: {
|
|
type: 'shadow',
|
|
},
|
|
backgroundColor: 'rgba(18, 55, 85, 0.8);',
|
|
borderColor: '#35d0c0',
|
|
formatter: (data) => {
|
|
const params = data[0];
|
|
let str = `<div class="custom-echarts-tips">
|
|
<span>${params.name}</span><br/>
|
|
<span>${params.marker} ${params.data} 万元</span>
|
|
</div>`;
|
|
return str;
|
|
},
|
|
},
|
|
barStyle: {
|
|
barWidth: 15,
|
|
itemStyle: {
|
|
borderRadius: [8, 8, 0, 0],
|
|
},
|
|
color: {
|
|
type: 'linear',
|
|
x: 0,
|
|
y: 0,
|
|
x2: 0,
|
|
y2: 1,
|
|
colorStops: [
|
|
{ offset: 0, color: '#35D0C0' },
|
|
{ offset: 1, color: '#35D0C0' },
|
|
],
|
|
global: false,
|
|
},
|
|
},
|
|
xAxis: {
|
|
type: 'category',
|
|
// name: '面积',
|
|
axisTick: {
|
|
show: false,
|
|
alignWithLabel: false,
|
|
interval: 'auto',
|
|
inside: false,
|
|
length: 5,
|
|
lineStyle: {
|
|
type: 'solid',
|
|
width: 1,
|
|
color: 'rgba(28, 158, 222, 1)',
|
|
},
|
|
},
|
|
},
|
|
yAxis: {
|
|
type: 'value',
|
|
// name: '面积(万亩)',
|
|
},
|
|
},
|
|
data: [
|
|
{ value: 530, name: '种子' },
|
|
{ value: 1215, name: '化肥' },
|
|
{ value: 2312, name: '农药' },
|
|
{ value: 916, name: '地膜' },
|
|
{ value: 108, name: '水' },
|
|
],
|
|
});
|
|
</script>
|