Skip to content

Commit f8eb18f

Browse files
committed
refactor and fix issue where growth dataset is not calculated when hiddenDomains changed
1 parent 95bf41a commit f8eb18f

File tree

1 file changed

+15
-35
lines changed

1 file changed

+15
-35
lines changed

components/Charts/PowerEnergyChart.vue

+15-35
Original file line numberDiff line numberDiff line change
@@ -1076,50 +1076,28 @@ export default {
10761076
},
10771077
10781078
fuelTechGroupName(val) {
1079-
console.log('fuelTechGroupName', val)
1080-
10811079
if (this.isTypeGrowthStackedArea) {
1082-
this.growthDataset = this.zoomExtent.length > 0 ? this.getGrowthDataset().filter((d) => {
1083-
return d.date >= this.zoomExtent[0] && d.date < this.zoomExtent[1]
1084-
}) : this.getGrowthDataset()
1085-
1086-
console.log('growthDataset fuelTechGroupName', this.growthDataset)
1080+
this.updateGrowDataset()
10871081
}
10881082
},
10891083
10901084
interval() {
10911085
this.handleTypeClick()
10921086
10931087
if (this.isTypeGrowthStackedArea) {
1094-
this.growthDataset = this.zoomExtent.length > 0 ? this.getGrowthDataset().filter((d) => {
1095-
return d.date >= this.zoomExtent[0] && d.date < this.zoomExtent[1]
1096-
}) : this.getGrowthDataset()
1097-
1098-
console.log('growthDataset zoomExtent', this.growthDataset)
1088+
this.updateGrowDataset()
10991089
}
11001090
},
11011091
1102-
// zoomExtent(val) {
1103-
// console.log('zoomExtent', val, this.stackedAreaDataset)
1104-
1105-
// if (this.isTypeGrowthStackedArea) {
1106-
// this.growthDataset = val.length > 0 ? this.getGrowthDataset().filter((d) => {
1107-
// return d.date >= val[0] && d.date < val[1]
1108-
// }) : this.getGrowthDataset()
1109-
1110-
// console.log('growthDataset zoomExtent', this.growthDataset)
1111-
// }
1112-
// },
1113-
11141092
isTypeGrowthStackedArea(val) {
1115-
console.log('isTypeGrowthStackedArea', val)
1116-
11171093
if (val) {
1118-
this.growthDataset = this.zoomExtent.length > 0 ? this.getGrowthDataset().filter((d) => {
1119-
return d.date >= this.zoomExtent[0] && d.date < this.zoomExtent[1]
1120-
}) : this.getGrowthDataset()
1094+
this.updateGrowDataset()
1095+
}
1096+
},
11211097
1122-
console.log('growthDataset isTypeGrowthStackedArea', this.growthDataset)
1098+
hiddenDomains() {
1099+
if (this.isTypeGrowthStackedArea) {
1100+
this.updateGrowDataset()
11231101
}
11241102
}
11251103
},
@@ -1128,11 +1106,7 @@ export default {
11281106
this.visHeight = this.chartHeight
11291107
11301108
if (this.isTypeGrowthStackedArea) {
1131-
this.growthDataset = this.zoomExtent.length > 0 ? this.getGrowthDataset().filter((d) => {
1132-
return d.date >= this.zoomExtent[0] && d.date < this.zoomExtent[1]
1133-
}) : this.getGrowthDataset()
1134-
1135-
console.log('growthDataset powerEnergyDataset', this.growthDataset)
1109+
this.updateGrowDataset()
11361110
}
11371111
},
11381112
@@ -1146,6 +1120,12 @@ export default {
11461120
doUpdateTickFormats: 'visInteract/doUpdateTickFormats'
11471121
}),
11481122
1123+
updateGrowDataset() {
1124+
this.growthDataset = this.zoomExtent.length > 0 ? this.getGrowthDataset().filter((d) => {
1125+
return d.date >= this.zoomExtent[0] && d.date < this.zoomExtent[1]
1126+
}) : this.getGrowthDataset()
1127+
},
1128+
11491129
convertValue(value) {
11501130
return SI.convertValue(
11511131
this.chartUnitPrefix,

0 commit comments

Comments
 (0)