Skip to content

Commit 53863ae

Browse files
committed
refactor and fix issue where zoom out sometimes doesn't work in growth chart
1 parent 8d8fe55 commit 53863ae

File tree

1 file changed

+12
-55
lines changed

1 file changed

+12
-55
lines changed

components/Charts/PowerEnergyChart.vue

+12-55
Original file line numberDiff line numberDiff line change
@@ -51,64 +51,15 @@
5151
/>
5252

5353
<stacked-area-vis
54-
v-if="chartShown && isTypeGrowthStackedArea"
54+
v-if="chartShown && (isTypeArea || isTypeProportion || isTypeGrowthStackedArea)"
5555
:read-only="readOnly"
5656
:domains="domains"
57-
:dataset="growthDataset"
58-
:range="range"
59-
:interval="interval"
60-
:curve="chartCurve"
61-
:y-min="computedGrowthYMin"
62-
:y-max="computedGrowthYMax"
63-
:vis-height="visHeight"
64-
:hover-on="hoverOn"
65-
:hover-date="hoverDate"
66-
:dynamic-extent="zoomExtent"
67-
:zoomed="zoomExtent.length > 0"
68-
:x-guides="xGuides"
69-
:y-guides="yGuides"
70-
:x-axis-dy="tabletBreak ? 8 : 12"
71-
:y-axis-ticks="5"
72-
:show-x-axis="false"
73-
:compare-dates="compareDates"
74-
:focus-date="focusDate"
75-
:focus-on="focusOn"
76-
:incomplete-intervals="incompleteIntervals"
77-
:dataset-two="
78-
chartEnergyRenewablesLine ? renewablesPercentageDataset : []
79-
"
80-
:dataset-two-colour="renewablesLineColour"
81-
:highlight-domain="highlightId"
82-
:mobile-screen="tabletBreak"
83-
:display-prefix="chartDisplayPrefix"
84-
:should-convert-value="shouldConvertValue"
85-
:convert-value="convertValue"
86-
:unit="` ${chartDisplayPrefix}${chartUnit}`"
87-
:null-check-prop="'_total'"
88-
:filter-period="filterPeriod"
89-
:show-total-line="chartEnergyNetLine"
90-
:total-line-domain="'_total'"
91-
:class="{ dragging: dragging }"
92-
:use-offset-diverge="true"
93-
class="vis-chart"
94-
@dateOver="handleDateHover"
95-
@domainOver="handleDomainHover"
96-
@svgClick="handleSvgClick"
97-
@enter="handleVisEnter"
98-
@leave="handleVisLeave"
99-
@zoomExtent="handleZoomExtent"
100-
/>
101-
102-
<stacked-area-vis
103-
v-if="chartShown && (isTypeArea || isTypeProportion)"
104-
:read-only="readOnly"
105-
:domains="domains"
106-
:dataset="stackedAreaDataset"
57+
:dataset="isTypeGrowthStackedArea ? growthDataset : stackedAreaDataset"
10758
:range="range"
10859
:interval="interval"
10960
:curve="chartCurve"
110-
:y-min="isTypeArea ? computedYMin : 0"
111-
:y-max="isTypeArea ? computedYMax : 100"
61+
:y-min="isTypeGrowthStackedArea ? computedGrowthYMin : isTypeArea ? computedYMin : 0"
62+
:y-max="isTypeGrowthStackedArea ? computedGrowthYMax : isTypeArea ? computedYMax : 100"
11263
:vis-height="visHeight"
11364
:hover-on="hoverOn"
11465
:hover-date="hoverDate"
@@ -138,7 +89,7 @@
13889
:show-total-line="chartEnergyNetLine"
13990
:total-line-domain="'_total'"
14091
:class="{ dragging: dragging }"
141-
:use-offset-diverge="false"
92+
:use-offset-diverge="isTypeGrowthStackedArea ? true : false"
14293
class="vis-chart"
14394
@dateOver="handleDateHover"
14495
@domainOver="handleDomainHover"
@@ -1075,7 +1026,13 @@ export default {
10751026
this.$emit('selectedDataset', this.dataset)
10761027
},
10771028
1078-
fuelTechGroupName(val) {
1029+
zoomExtent() {
1030+
if (this.isTypeGrowthStackedArea) {
1031+
this.updateGrowDataset()
1032+
}
1033+
},
1034+
1035+
fuelTechGroupName() {
10791036
if (this.isTypeGrowthStackedArea) {
10801037
this.updateGrowDataset()
10811038
}

0 commit comments

Comments
 (0)