forked from ddrilling/asb_cloud_front
Исправлена высота подсказки курсора для графиков мониторинга и архива
This commit is contained in:
parent
ccd2158f36
commit
0e432df77c
@ -1,4 +1,4 @@
|
|||||||
import { CSSProperties, ReactNode, SVGProps, useEffect, useMemo, useRef, useState, isValidElement, cloneElement } from 'react'
|
import { CSSProperties, ReactNode, SVGProps, useEffect, useMemo, useRef, useState } 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,7 +166,6 @@ 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])
|
||||||
@ -180,7 +179,7 @@ const _D3HorizontalCursor = <DataType,>({
|
|||||||
<foreignObject
|
<foreignObject
|
||||||
key={`${i}`}
|
key={`${i}`}
|
||||||
width={width}
|
width={width}
|
||||||
height={'100%'}
|
height={height}
|
||||||
x={sizes.groupLeft(i) + (sizes.groupWidth - width) / 2}
|
x={sizes.groupLeft(i) + (sizes.groupWidth - width) / 2}
|
||||||
y={tooltipY}
|
y={tooltipY}
|
||||||
opacity={fixed || mouseState.visible ? 1 : 0}
|
opacity={fixed || mouseState.visible ? 1 : 0}
|
||||||
|
@ -28,7 +28,7 @@ export const cursorRender = (group, data) => {
|
|||||||
<Fragment key={chart.key}>
|
<Fragment key={chart.key}>
|
||||||
<GridItem row={i+2} col={1} style={{ padding: '4px 0' }}>{getChartIcon(chart)}</GridItem>
|
<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={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>
|
</Fragment>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
@ -99,13 +99,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .tooltip-body {
|
|
||||||
|
|
||||||
& > div:nth-child(n+3):nth-child(3n+1) {
|
|
||||||
text-align: end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user