Skip to content

Commit

Permalink
Session UI: price/co2 visualization, fix month tooltip (#16772)
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis authored Oct 21, 2024
1 parent 2711690 commit a14da6c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
24 changes: 21 additions & 3 deletions assets/js/components/Sessions/CostHistoryChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,32 @@

<script>
import { Bar } from "vue-chartjs";
import { BarController, BarElement, CategoryScale, LinearScale, Legend, Tooltip } from "chart.js";
import {
BarController,
BarElement,
CategoryScale,
Legend,
LinearScale,
LineController,
LineElement,
Tooltip,
} from "chart.js";
import { registerChartComponents, commonOptions, tooltipLabelColor } from "./chartConfig";
import LegendList from "./LegendList.vue";
import formatter from "../../mixins/formatter";
import colors from "../../colors";
import { TYPES, GROUPS, PERIODS } from "./types";
registerChartComponents([BarController, BarElement, CategoryScale, LinearScale, Legend, Tooltip]);
registerChartComponents([
BarController,
BarElement,
CategoryScale,
Legend,
LinearScale,
LineController,
LineElement,
Tooltip,
]);
export default {
name: "CostHistoryChart",
Expand Down Expand Up @@ -222,7 +240,7 @@ export default {
const date = new Date(this.year, label - 1, 1);
return this.fmtMonth(date);
} else {
const date = new Date(this.year, this.month, label);
const date = new Date(this.year, this.month - 1, label);
return this.fmtDayMonth(date);
}
},
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/Sessions/EnergyHistoryChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default {
const date = new Date(this.year, label - 1, 1);
return this.fmtMonth(date);
} else {
const date = new Date(this.year, this.month, label);
const date = new Date(this.year, this.month - 1, label);
return this.fmtDayMonth(date);
}
},
Expand Down

0 comments on commit a14da6c

Please sign in to comment.