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