47
47
:single-domain-label =" singleDomainLabel"
48
48
:show-date-axis =" showDateAxis"
49
49
:change-since-label =" changeSinceLabel"
50
+ :growth-label =" growthLabel"
50
51
@type-click =" handleTypeClick"
51
52
@date-axis =" (visible) => showDateAxis = visible"
52
53
/>
@@ -731,6 +732,11 @@ export default {
731
732
732
733
changeSinceLabel () {
733
734
const ds = this .isTypeGrowthStackedArea ? this .growthDataset : this .stackedAreaDataset
735
+
736
+ if (ds .length === 0 ) {
737
+ return ' '
738
+ }
739
+
734
740
if (this .zoomExtent .length > 0 ) {
735
741
return DateDisplay .specialDateFormats (
736
742
this .zoomExtent [0 ].getTime (),
@@ -753,6 +759,15 @@ export default {
753
759
)
754
760
},
755
761
762
+ growthLabel () {
763
+ const label = this .interval .toLowerCase ()
764
+
765
+ if (this .isRollingSumRange ) {
766
+ return ` ${ label} -on-previous-year-${ label} `
767
+ }
768
+ return ` ${ label} -on-${ label} `
769
+ },
770
+
756
771
dataset () {
757
772
let ds = null
758
773
if (this .isTypeLine ) {
@@ -1054,6 +1069,12 @@ export default {
1054
1069
this .$emit (' selectedDataset' , this .dataset )
1055
1070
},
1056
1071
1072
+ isYAxisAveragePower () {
1073
+ if (this .isTypeGrowthStackedArea ) {
1074
+ this .updateGrowDataset ()
1075
+ }
1076
+ },
1077
+
1057
1078
zoomExtent () {
1058
1079
if (this .isTypeGrowthStackedArea ) {
1059
1080
this .updateGrowDataset ()
@@ -1225,10 +1246,21 @@ export default {
1225
1246
}
1226
1247
}
1227
1248
1228
- const dataset = transformToGrowthTimeSeries (this .powerEnergyDataset , this .domains , compareIndex)
1249
+ const ds = this .isYAxisAbsolute
1250
+ ? this .powerEnergyDataset
1251
+ : this .averagePowerDataset
1252
+
1253
+ const dataset = transformToGrowthTimeSeries (ds, this .domains , compareIndex)
1229
1254
1230
1255
this .handleTypeClick ()
1231
1256
1257
+ if (this .isRollingSumRange ) {
1258
+ // only return the data where there are values
1259
+ return dataset .slice (compareIndex, dataset .length - 1 )
1260
+ }
1261
+
1262
+ // remove first null period
1263
+ dataset .shift ()
1232
1264
return dataset
1233
1265
},
1234
1266
0 commit comments