From 18ee36f0cf52f3ae6660022331033c4d112ff8de Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 29 Dec 2022 15:32:41 -0800 Subject: [PATCH] app/vmui: reuse the series color in line tooltip --- .../vmui/src/components/Chart/ChartTooltip/ChartTooltip.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmui/packages/vmui/src/components/Chart/ChartTooltip/ChartTooltip.tsx b/app/vmui/packages/vmui/src/components/Chart/ChartTooltip/ChartTooltip.tsx index b56aa6f496..14e70b697d 100644 --- a/app/vmui/packages/vmui/src/components/Chart/ChartTooltip/ChartTooltip.tsx +++ b/app/vmui/packages/vmui/src/components/Chart/ChartTooltip/ChartTooltip.tsx @@ -1,7 +1,7 @@ import React, { FC, useEffect, useMemo, useRef, useState } from "preact/compat"; import uPlot, { Series } from "uplot"; import { MetricResult } from "../../../api/types"; -import { formatPrettyNumber, getColorLine } from "../../../utils/uplot/helpers"; +import { formatPrettyNumber } from "../../../utils/uplot/helpers"; import dayjs from "dayjs"; import { DATE_FULL_TIMEZONE_FORMAT } from "../../../constants/date"; import ReactDOM from "react-dom"; @@ -51,7 +51,7 @@ const ChartTooltip: FC = ({ const dataTime = useMemo(() => u.data[0][dataIdx], [u, dataIdx]); const date = useMemo(() => dayjs(dataTime * 1000).tz().format(DATE_FULL_TIMEZONE_FORMAT), [dataTime]); - const color = useMemo(() => getColorLine(series[seriesIdx]?.label || ""), [series, seriesIdx]); + const color = useMemo(() => series[seriesIdx]?.stroke+"", [series, seriesIdx]); const name = useMemo(() => { const group = metrics[seriesIdx -1]?.group || 0;