From ccd2158f36e51468d75cba4aa775fdaa04ec93c1 Mon Sep 17 00:00:00 2001 From: ts_salikhov Date: Thu, 18 Aug 2022 13:14:51 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B2=D0=BD=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=20=D0=BB=D0=B5=D0=B2?= =?UTF-8?q?=D0=BE=D0=BC=D1=83=20=D0=BA=D1=80=D0=B0=D1=8E=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BB=D0=B5=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=BB=D0=B1=D0=B8=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=D0=B7=D0=BA=D0=B8=20=D0=BA=D1=83=D1=80=D1=81=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D1=80=D0=B0=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=BC=D0=BE=D0=BD=D0=B8=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=D0=B0=20=D0=B8=20=D0=B0=D1=80=D1=85?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/d3/monitoring/D3HorizontalCursor.tsx | 3 ++- src/styles/d3.less | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/d3/monitoring/D3HorizontalCursor.tsx b/src/components/d3/monitoring/D3HorizontalCursor.tsx index 44d1ec1..335475d 100644 --- a/src/components/d3/monitoring/D3HorizontalCursor.tsx +++ b/src/components/d3/monitoring/D3HorizontalCursor.tsx @@ -1,4 +1,4 @@ -import { CSSProperties, ReactNode, SVGProps, useEffect, useMemo, useRef, useState } from 'react' +import { CSSProperties, ReactNode, SVGProps, useEffect, useMemo, useRef, useState, isValidElement, cloneElement } from 'react' import * as d3 from 'd3' import { wrapPlugin } from '@components/d3/plugins/base' @@ -166,6 +166,7 @@ const _D3HorizontalCursor = ({ }) const bodies = groups.map((group) => render(group, chartData)) + .map(body => isValidElement(body) ? cloneElement(body, {className: 'tooltip-body' }) : body) setTooltipBodies(bodies) }, [groups, data, yAxis, lineY, fixed, mouseState.visible]) diff --git a/src/styles/d3.less b/src/styles/d3.less index 6ec1bb0..daadea4 100644 --- a/src/styles/d3.less +++ b/src/styles/d3.less @@ -99,6 +99,13 @@ } } } + + & .tooltip-body { + + & > div:nth-child(n+3):nth-child(3n+1) { + text-align: end; + } + } } }