diff --git a/src/views/statistics/ppass_num.vue b/src/views/statistics/ppass_num.vue index d1b37871..710cd9d4 100644 --- a/src/views/statistics/ppass_num.vue +++ b/src/views/statistics/ppass_num.vue @@ -274,8 +274,22 @@ export default { that.xAxisData = xAxisData; that.option.xAxis.data = that.xAxisData; that.option.series = seriesData; + that.$nextTick(() => { + that.resizeChart(xAxisData.length, nameData.length); + }); }); }, + resizeChart(xCount, materialCount) { + let chartDiv = document.getElementById("bachart1"); + if (!chartDiv) return; + let wrapper = chartDiv.parentElement; + let parentWidth = wrapper.clientWidth; + let groupWidth = Math.max(60, materialCount * 25 + 30); + let neededWidth = xCount * groupWidth + 80; + chartDiv.style.width = Math.max(parentWidth, neededWidth) + "px"; + let inst = this.$refs.echarts1 && this.$refs.echarts1.myChart; + if (inst) inst.resize(); + }, handleQuery() { if (this.queryDate !== "" && this.queryDate !== null) { if (this.queryType == "月") { @@ -357,4 +371,12 @@ export default { left: 4px; z-index: 10; } +.echarts-scroll { + width: 100%; + overflow-x: auto; + overflow-y: hidden; +} +.echarts-scroll > :deep(#bachart1) { + min-width: 100%; +} diff --git a/src/views/statistics/stock_statistics.vue b/src/views/statistics/stock_statistics.vue index 574cf4b6..69bf8836 100644 --- a/src/views/statistics/stock_statistics.vue +++ b/src/views/statistics/stock_statistics.vue @@ -28,7 +28,7 @@ :filter-method="filterModel1" filter-placement="bottom-end" /> -