Optimizer UI: fix line charts (#29936)
This commit is contained in:
parent
9cc0da1a86
commit
c5d9bccec2
4 changed files with 8 additions and 4 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
CategoryScale,
|
||||
LinearScale,
|
||||
BarController,
|
||||
LineController,
|
||||
BarElement,
|
||||
LineElement,
|
||||
PointElement,
|
||||
|
|
@ -41,6 +42,7 @@ ChartJS.register(
|
|||
CategoryScale,
|
||||
LinearScale,
|
||||
BarController,
|
||||
LineController,
|
||||
BarElement,
|
||||
LineElement,
|
||||
PointElement,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
Chart as ChartJS,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
LineController,
|
||||
LineElement,
|
||||
PointElement,
|
||||
Title,
|
||||
|
|
@ -40,6 +41,7 @@ const tension = 0;
|
|||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
LineController,
|
||||
LineElement,
|
||||
PointElement,
|
||||
Title,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
LineElement,
|
||||
Tooltip,
|
||||
type ChartData,
|
||||
type ScriptableContext,
|
||||
type TooltipItem,
|
||||
} from "chart.js";
|
||||
import { registerChartComponents, commonOptions, tooltipLabelColor } from "./chartConfig";
|
||||
|
|
@ -28,7 +29,6 @@ import formatter from "@/mixins/formatter";
|
|||
import colors from "@/colors";
|
||||
import { TYPES, GROUPS, PERIODS, type Session } from "./types";
|
||||
import { CURRENCY } from "@/types/evcc";
|
||||
import type { Context } from "chartjs-plugin-datalabels";
|
||||
|
||||
registerChartComponents([
|
||||
BarController,
|
||||
|
|
@ -153,7 +153,7 @@ export default defineComponent({
|
|||
backgroundColor,
|
||||
label,
|
||||
data: Object.values(result).map((index) => index[group] || 0),
|
||||
borderRadius: (context: Context) => {
|
||||
borderRadius: (context: ScriptableContext<"bar">) => {
|
||||
const threshold = 0.04; // 400 Wh
|
||||
const { dataIndex, datasetIndex } = context;
|
||||
const currentValue = context.dataset.data[dataIndex] as number;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import {
|
|||
Legend,
|
||||
Tooltip,
|
||||
type ChartData,
|
||||
type ScriptableContext,
|
||||
type TooltipModel,
|
||||
type TooltipItem,
|
||||
} from "chart.js";
|
||||
|
|
@ -26,7 +27,6 @@ import LegendList from "./LegendList.vue";
|
|||
import formatter, { POWER_UNIT } from "@/mixins/formatter";
|
||||
import colors from "@/colors";
|
||||
import { GROUPS, PERIODS, type Session } from "./types";
|
||||
import type { Context } from "chartjs-plugin-datalabels";
|
||||
|
||||
registerChartComponents([BarController, BarElement, CategoryScale, LinearScale, Legend, Tooltip]);
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ export default defineComponent({
|
|||
backgroundColor,
|
||||
label,
|
||||
data: Object.values(result).map((day) => day[group] || 0),
|
||||
borderRadius: (context: Context) => {
|
||||
borderRadius: (context: ScriptableContext<"bar">) => {
|
||||
const threshold = 0.04; // 400 Wh
|
||||
const { dataIndex, datasetIndex } = context;
|
||||
const currentValue = context.dataset.data[dataIndex] as number;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue