Merged in feature/edit-tooltip (pull request #5)

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

Approved-by: Александр Васильевич Сироткин
This commit is contained in:
Салихов Тимур 2022-08-22 08:49:23 +00:00 committed by Александр Васильевич Сироткин
commit 00f7d6e9da
5 changed files with 8 additions and 5 deletions

View File

@ -139,7 +139,7 @@ const _D3HorizontalCursor = <DataType,>({
if (!mouseState.visible || fixed) return
let top = mouseState.y + offsetY
if (top + height >= sizes.chartsHeight) {
if (mouseState.y >= sizes.chartsHeight / 2) {
setPosition('bottom')
top = mouseState.y - offsetY - height
} else {
@ -186,7 +186,9 @@ const _D3HorizontalCursor = <DataType,>({
pointerEvents={fixed ? 'all' : 'none'}
style={{ transition: 'opacity .1s ease-out', userSelect: fixed ? 'auto' : 'none' }}
>
<div className={`tooltip ${position} ${className}`}>
<div className={`tooltip ${position} ${className}`}
style={{height: 'auto', bottom: `${position === 'bottom' ? '0' : ''}`}}
>
<div className={'tooltip-content'}>
{tooltipBodies[i]}
</div>

View File

@ -568,6 +568,7 @@ const _D3MonitoringCharts = <DataType extends Record<string, unknown>>({
groups={groups}
sizes={sizes}
data={data}
height={height}
/>
</D3MouseZone>
</svg>

View File

@ -255,7 +255,7 @@ const Archive = memo(() => {
plugins={{
menu: { enabled: false },
cursor: {
width: 200,
width: 220,
render: cursorRender,
}
}}

View File

@ -28,7 +28,7 @@ export const cursorRender = (group, data) => {
<Fragment key={chart.key}>
<GridItem row={i+2} col={1} style={{ padding: '4px 0' }}>{getChartIcon(chart)}</GridItem>
<GridItem row={i+2} col={2}>{chart.shortLabel || chart.label}</GridItem>
<GridItem row={i+2} col={3} style={{ paddingRight: 0 }}>{xFormat(chart)}</GridItem>
<GridItem row={i+2} col={3} style={{ paddingRight: 0, textAlign: 'end' }}>{xFormat(chart)}</GridItem>
</Fragment>
)
})}

View File

@ -295,7 +295,7 @@ const TelemetryView = memo(() => {
plugins={{
menu: { enabled: false },
cursor: {
width: 200,
width: 220,
render: cursorRender,
},
}}