|
@@ -14,23 +14,22 @@ const props = defineProps({
|
|
|
const bar_data = ref(props.BarData)
|
|
const bar_data = ref(props.BarData)
|
|
|
const bar_ref = ref()
|
|
const bar_ref = ref()
|
|
|
watch(
|
|
watch(
|
|
|
- () => props.BarData,
|
|
|
|
|
|
|
+ () => bar_data.value,
|
|
|
(current) => {
|
|
(current) => {
|
|
|
bar_data.value = current
|
|
bar_data.value = current
|
|
|
initOption.xAxis.data = barName.value
|
|
initOption.xAxis.data = barName.value
|
|
|
initOption.series = bar_series.value
|
|
initOption.series = bar_series.value
|
|
|
initOption.legend.data = Name.value
|
|
initOption.legend.data = Name.value
|
|
|
- initOption.yAxis.max = Max.value
|
|
|
|
|
- initOption.yAxis.interval = interval.value
|
|
|
|
|
initOption.toolbox.feature.saveAsImage.name = downloadName.value
|
|
initOption.toolbox.feature.saveAsImage.name = downloadName.value
|
|
|
initOption.toolbox.show = isShowTooltips.value
|
|
initOption.toolbox.show = isShowTooltips.value
|
|
|
|
|
+ initOption.yAxis.max = Max.value
|
|
|
|
|
+ initOption.yAxis.interval = interval.value
|
|
|
|
|
+ initOption.title.text = bar_title.value
|
|
|
initChart()
|
|
initChart()
|
|
|
- if (props.isRevenue) {
|
|
|
|
|
- initOption.title.text = bar_title.value
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- deep: true
|
|
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ once: true
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
// 最大值
|
|
// 最大值
|
|
@@ -221,6 +220,7 @@ const initOption = reactive({
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
type: 'value',
|
|
type: 'value',
|
|
|
|
|
+ scale: true,
|
|
|
splitLine: {
|
|
splitLine: {
|
|
|
show: true,
|
|
show: true,
|
|
|
lineStyle: {
|
|
lineStyle: {
|
|
@@ -306,10 +306,11 @@ const initChart = () => {
|
|
|
window.addEventListener('resize', () => {
|
|
window.addEventListener('resize', () => {
|
|
|
bar_chart.resize()
|
|
bar_chart.resize()
|
|
|
})
|
|
})
|
|
|
- bar_chart.on('legendselectchanged', function (event) {
|
|
|
|
|
|
|
+ bar_chart.on('legendselectchanged', function (event: any) {
|
|
|
const selected = event.selected
|
|
const selected = event.selected
|
|
|
let trueCount = 0
|
|
let trueCount = 0
|
|
|
let trueObj: any = {}
|
|
let trueObj: any = {}
|
|
|
|
|
+ let truearr: any = []
|
|
|
for (var key in selected) {
|
|
for (var key in selected) {
|
|
|
if (selected[key]) {
|
|
if (selected[key]) {
|
|
|
trueCount++
|
|
trueCount++
|
|
@@ -329,6 +330,28 @@ const initChart = () => {
|
|
|
initOption.title.text = `Total: `
|
|
initOption.title.text = `Total: `
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ if (trueCount != 0) {
|
|
|
|
|
+ initOption.series.forEach((item: any) => {
|
|
|
|
|
+ if (Object.keys(trueObj).includes(item.name)) {
|
|
|
|
|
+ truearr.push(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ const max = Math.max.apply(
|
|
|
|
|
+ Math,
|
|
|
|
|
+ truearr.map((ele: any) => {
|
|
|
|
|
+ return ele.Max
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ const interval = Math.max.apply(
|
|
|
|
|
+ Math,
|
|
|
|
|
+ truearr.map((ele: any) => {
|
|
|
|
|
+ return ele.interval
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ initOption.yAxis.max = max
|
|
|
|
|
+ initOption.yAxis.interval = interval
|
|
|
|
|
+ }
|
|
|
|
|
+ bar_chart.setOption(initOption)
|
|
|
})
|
|
})
|
|
|
bar_chart.setOption(initOption)
|
|
bar_chart.setOption(initOption)
|
|
|
}
|
|
}
|