From 3c3576d5792bfabcef84979757ee344712e71cd3 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期六, 21 六月 2025 09:19:29 +0800 Subject: [PATCH] UA 整理提交 --- src/components/echarts/bar1.vue | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/echarts/bar1.vue b/src/components/echarts/bar1.vue index 960ab16..9307ade 100644 --- a/src/components/echarts/bar1.vue +++ b/src/components/echarts/bar1.vue @@ -2,6 +2,7 @@ import { onMounted, ref, watchEffect, nextTick, onBeforeUnmount } from "vue"; import * as echarts from 'echarts'; import baseChart from "./BaseChart.vue"; + import { toFixed } from '@/utils/toFixed.js'; const chart = ref(null); const props = defineProps({ @@ -16,10 +17,12 @@ unit: { type: String, default: '' - } + }, + barW: { + type: [Number, String], + default: 60, + }, }); - - const barWidth = 60; function createLinearColor(color) { return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ @@ -39,13 +42,14 @@ function getMax(data) { let max = Math.max.apply(null, data) * 1.2; - return max || 1; + return toFixed(max, 1) || 1; } function getOptions(xLabels, datas) { xLabels = xLabels || []; datas = datas || []; + let barWidth = props.barW; const option = { // title: { // text: props.title, @@ -67,7 +71,7 @@ grid: { left: '3%', right: '4%', - bottom: '3%', + bottom: '8%', top: 30, containLabel: true }, @@ -188,8 +192,13 @@ return chart_instance; } + function getDataURL() { + return chart.value.getDataURL(); + } + defineExpose({ getChart, + getDataURL, updateChart }); -- Gitblit v1.9.1