Session UI: fix day/year labels (#16919)
This commit is contained in:
parent
3c99810619
commit
4b51a3014b
3 changed files with 17 additions and 8 deletions
|
|
@ -208,6 +208,9 @@ export default {
|
|||
});
|
||||
},
|
||||
options() {
|
||||
// capture vue component this to be used in chartjs callbacks
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const vThis = this;
|
||||
return {
|
||||
...commonOptions,
|
||||
locale: this.$i18n?.locale,
|
||||
|
|
@ -285,10 +288,11 @@ export default {
|
|||
grid: { display: false },
|
||||
ticks: {
|
||||
color: colors.muted,
|
||||
callback: (value) =>
|
||||
this.period === PERIODS.YEAR
|
||||
? this.fmtMonth(new Date(this.year, value, 1), true)
|
||||
: value,
|
||||
callback: function (value) {
|
||||
return vThis.period === PERIODS.YEAR
|
||||
? vThis.fmtMonth(new Date(vThis.year, value, 1), true)
|
||||
: this.getLabelForValue(value);
|
||||
},
|
||||
},
|
||||
},
|
||||
y: {
|
||||
|
|
|
|||
|
|
@ -145,6 +145,9 @@ export default {
|
|||
}));
|
||||
},
|
||||
options() {
|
||||
// capture vue component this to be used in chartjs callbacks
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const vThis = this;
|
||||
return {
|
||||
...commonOptions,
|
||||
locale: this.$i18n?.locale,
|
||||
|
|
@ -209,10 +212,11 @@ export default {
|
|||
grid: { display: false },
|
||||
ticks: {
|
||||
color: colors.muted,
|
||||
callback: (value) =>
|
||||
this.period === PERIODS.YEAR
|
||||
? this.fmtMonth(new Date(this.year, value, 1), true)
|
||||
: value,
|
||||
callback: function (value) {
|
||||
return vThis.period === PERIODS.YEAR
|
||||
? vThis.fmtMonth(new Date(vThis.year, value, 1), true)
|
||||
: this.getLabelForValue(value);
|
||||
},
|
||||
},
|
||||
},
|
||||
y: {
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@
|
|||
import Modal from "bootstrap/js/dist/modal";
|
||||
import "@h2d2/shopicons/es/regular/cablecharge";
|
||||
import "@h2d2/shopicons/es/regular/car3";
|
||||
import "@h2d2/shopicons/es/regular/eco1";
|
||||
import "@h2d2/shopicons/es/regular/sun";
|
||||
import formatter, { POWER_UNIT } from "../mixins/formatter";
|
||||
import api from "../api";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue