@@ -256,27 +256,22 @@ export default {
256
256
return null ;
257
257
}
258
258
259
- return (
260
- datasetLabel +
261
- " : " +
262
- (this .costType === TYPES .PRICE
259
+ const valueFmt =
260
+ this .costType === TYPES .PRICE
263
261
? this .fmtPricePerKWh (value, this .currency , false )
264
- : this .fmtCo2Medium (value))
265
- ) ;
262
+ : this .fmtCo2Medium (value);
263
+ return ` ${ datasetLabel } : ${ valueFmt } ` ;
266
264
}
267
265
268
- return (
269
- datasetLabel +
270
- " : " +
271
- ( this .costType === TYPES . PRICE
272
- ? this .fmtMoney (value || 0 , this . currency , true , true )
273
- : this . fmtGrams (value || 0 ))
274
- ) ;
266
+ return value
267
+ ? ` ${ datasetLabel} : ${
268
+ this . costType === TYPES . PRICE
269
+ ? this . fmtMoney (value, this .currency , true , true )
270
+ : this .fmtGrams (value)
271
+ } `
272
+ : null ;
275
273
},
276
274
labelColor: tooltipLabelColor (false ),
277
- labelTextColor : (item ) => {
278
- return ! item .raw ? colors .muted : " #fff" ;
279
- },
280
275
},
281
276
itemSort : function (a , b ) {
282
277
return b .datasetIndex - a .datasetIndex ;
@@ -288,7 +283,13 @@ export default {
288
283
stacked: true ,
289
284
border: { display: false },
290
285
grid: { display: false },
291
- ticks: { color: colors .muted },
286
+ ticks: {
287
+ color: colors .muted ,
288
+ callback : (value ) =>
289
+ this .period === PERIODS .YEAR
290
+ ? this .fmtMonth (new Date (this .year , value, 1 ), true )
291
+ : value,
292
+ },
292
293
},
293
294
y: {
294
295
stacked: true ,
0 commit comments