Добавлено выравнивание по левому краю для левого столбика подсказки курсора для графиков мониторинга и архива

This commit is contained in:
ts_salikhov 2022-08-18 13:14:51 +04:00
parent 1e27317ea1
commit ccd2158f36
2 changed files with 9 additions and 1 deletions

View File

@ -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 * as d3 from 'd3'
import { wrapPlugin } from '@components/d3/plugins/base' import { wrapPlugin } from '@components/d3/plugins/base'
@ -166,6 +166,7 @@ const _D3HorizontalCursor = <DataType,>({
}) })
const bodies = groups.map((group) => render(group, chartData)) const bodies = groups.map((group) => render(group, chartData))
.map(body => isValidElement(body) ? cloneElement(body, {className: 'tooltip-body' }) : body)
setTooltipBodies(bodies) setTooltipBodies(bodies)
}, [groups, data, yAxis, lineY, fixed, mouseState.visible]) }, [groups, data, yAxis, lineY, fixed, mouseState.visible])

View File

@ -99,6 +99,13 @@
} }
} }
} }
& .tooltip-body {
& > div:nth-child(n+3):nth-child(3n+1) {
text-align: end;
}
}
} }
} }