1.修改大屏问题
This commit is contained in:
2025-09-29 15:41:01 +08:00
parent 7154314e93
commit e4d3e3ba1c
8 changed files with 89 additions and 60 deletions
+8 -8
View File
@@ -93,7 +93,6 @@
});
}
const myChart = ref();
function getData() {
twoLApi({
sex: chooseType.value,
@@ -110,23 +109,24 @@
});
}
function initChart(value) {
myChart.value = echarts.init(newChart.value!);
function initChart(value: any) {
let myChart = echarts.init(newChart.value);
const dx =
value.map((item) => {
value.map((item: any) => {
return item.name;
}) || [];
const dy =
value.map((item) => {
value.map((item: any) => {
return item.count;
}) || [];
const max = value.sort((a, b) => b.count - a.count).length > 0 ? value.sort((a, b) => b.count - a.count)[0].count : [];
const max: any =
value.sort((a: any, b: any) => b.count - a.count).length > 0 ? value.sort((a: any, b: any) => b.count - a.count)[0].count : [];
const m = max % 25 === 0 ? max : (parseInt(max / 25) + 1) * 25;
let option = getClassCharts(dx, dy, m);
myChart.value.setOption(option);
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.value.resize();
myChart && myChart.resize();
});
}
const emit = defineEmits(['handleView']);