fix: 曲线图宽度过大问题修复。

This commit is contained in:
tianyongbao
2026-01-19 22:13:56 +08:00
parent 14b966187c
commit 51c0703670

View File

@@ -81,7 +81,7 @@
>参数设置</view> -->
</view>
<nut-config-provider :theme-vars="themeVars">
<view class="m_t_20 view_f">
<view class="m_t_20 view_f" style="width: 100%; overflow: hidden;">
<view
:style="{
width: 100 / Number(item.num) + '%',
@@ -196,7 +196,7 @@
</view>
</view>
</nut-config-provider>
<nut-row class="m_t_20">
<nut-row class="m_t_20" style="width: 100%; overflow: hidden;">
<view class="chart-header-row">
<view class="chart-title">
<text class="title-text">{{
@@ -291,7 +291,7 @@
<view @click="changeShow">{{ setTitle }}</view>
</nut-col> -->
</nut-row>
<view :style="{ position: 'relative', marginTop: '10px' }" v-show="showChart">
<view :style="{ position: 'relative', marginTop: '10px', width: '100%', overflow: 'hidden' }" v-show="showChart">
<view class="loading-container" v-show="loading">
<Loading />
</view>
@@ -761,7 +761,8 @@ const keepNightOpen = ref(false);
/** -----------------method start----------------- */
Taro.useDidShow(() => {
const sysInfo = Taro.getSystemInfoSync();
let cWidth = (700 / 750) * sysInfo.screenWidth;
// 修改宽度计算:从 700/750 改为 680/750为左右边距预留空间
let cWidth = (680 / 750) * sysInfo.screenWidth;
let cHeight = (220 / 750) * sysInfo.windowHeight;
let pixelRatio = sysInfo.pixelRatio;
chartConf.cWidth = cWidth;
@@ -776,7 +777,8 @@ Taro.useDidShow(() => {
});
onMounted(() => {
const sysInfo = Taro.getSystemInfoSync();
let cWidth = (700 / 750) * sysInfo.screenWidth;
// 修改宽度计算:从 700/750 改为 680/750为左右边距预留空间
let cWidth = (680 / 750) * sysInfo.screenWidth;
let cHeight = (220 / 750) * sysInfo.windowHeight;
let pixelRatio = sysInfo.pixelRatio;
chartConf.cWidth = cWidth;
@@ -1243,6 +1245,7 @@ function createCharts(x, series, ids) {
fontColor: "#222222",
itemGap: 10,
position: "top",
float: "center",
},
dataLabel: false,
xAxis: {
@@ -1337,6 +1340,7 @@ function createCharts(x, series, ids) {
fontColor: "#222222",
itemGap: 10,
position: "top",
float: "center",
},
dataLabel: false,
xAxis: {
@@ -1403,7 +1407,7 @@ function updateCharts(x, series, ids) {
legend: {
fontColor: "#222222",
itemGap: 10,
float: prDev.value == 2 || prDev.value == 1 ? "left" : "center",
float: "center",
},
xAxis: {
disableGrid: true,
@@ -1584,7 +1588,8 @@ function hideTour(a) {
function refresh() {
// 确保重新设置图表尺寸
const sysInfo = Taro.getSystemInfoSync();
let cWidth = (700 / 750) * sysInfo.screenWidth;
// 修改宽度计算:从 700/750 改为 680/750为左右边距预留空间
let cWidth = (680 / 750) * sysInfo.screenWidth;
let cHeight = (220 / 750) * sysInfo.windowHeight;
let pixelRatio = sysInfo.pixelRatio;
chartConf.cWidth = cWidth;
@@ -1865,6 +1870,9 @@ defineExpose({
<style lang="scss">
.pondInfo_home {
width: 100%;
max-width: 100%;
overflow: hidden;
box-sizing: border-box;
height: 100%;
.tag {
background: RGB(14, 191, 117, 0.1);
@@ -1976,14 +1984,15 @@ defineExpose({
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0 15px;
gap: 15px;
padding: 0 5px;
gap: 6px;
}
.chart-title {
flex: 0 0 auto;
min-width: 55px;
.title-text {
font-size: 32px;
font-size: 28px;
font-weight: 600;
color: #222;
white-space: nowrap;
@@ -1991,19 +2000,22 @@ defineExpose({
}
.day-selector {
flex: 0 0 auto;
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: center;
gap: 0;
border-radius: 6px;
overflow: hidden;
border: 1px solid #e5e5e5;
max-width: 220px;
.day-btn {
padding: 0 18px;
height: 36px;
line-height: 36px;
font-size: 26px;
flex: 1;
padding: 0 10px;
height: 34px;
line-height: 34px;
font-size: 22px;
color: #666;
background: #fff;
border-right: 1px solid #e5e5e5;
@@ -2032,10 +2044,12 @@ defineExpose({
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 8px;
gap: 4px;
min-width: 85px;
justify-content: flex-end;
.action-link {
font-size: 28px;
font-size: 24px;
color: #1589E9;
white-space: nowrap;
cursor: pointer;
@@ -2047,9 +2061,9 @@ defineExpose({
}
.divider-dot {
font-size: 20px;
font-size: 16px;
color: #ccc;
margin: 0 2px;
margin: 0;
}
}
@@ -2095,6 +2109,8 @@ defineExpose({
.charts {
height: 330px;
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.loading-container {
position: absolute;