Merge branch 'dev' of bitbucket.org:autodrilling/asb_cloud_front into dev

This commit is contained in:
goodmice 2022-09-09 11:38:29 +05:00
commit c3200427e4
5 changed files with 49 additions and 11 deletions

View File

@ -28,6 +28,7 @@ export type D3HorizontalCursorProps<DataType> = D3HorizontalCursorSettings<DataT
data: DataType[] data: DataType[]
sizes: ChartSizes sizes: ChartSizes
yAxis?: d3.ScaleTime<number, number> yAxis?: d3.ScaleTime<number, number>
spaceBetweenGroups?: number
} }
const defaultLineStyle: SVGProps<SVGLineElement> = { const defaultLineStyle: SVGProps<SVGLineElement> = {
@ -62,7 +63,7 @@ const makeDefaultRender = <DataType,>(): D3GroupRenderFunction<DataType> => (gro
) )
const _D3HorizontalCursor = <DataType,>({ const _D3HorizontalCursor = <DataType,>({
width = 220, spaceBetweenGroups = 30,
height = 200, height = 200,
render = makeDefaultRender<DataType>(), render = makeDefaultRender<DataType>(),
position: _position = 'bottom', position: _position = 'bottom',
@ -178,19 +179,21 @@ const _D3HorizontalCursor = <DataType,>({
{groups.map((_, i) => ( {groups.map((_, i) => (
<foreignObject <foreignObject
key={`${i}`} key={`${i}`}
width={width} width={sizes.groupWidth + spaceBetweenGroups}
height={height} height={height}
x={sizes.groupLeft(i) + (sizes.groupWidth - width) / 2} x={sizes.groupLeft(i) - spaceBetweenGroups / 2}
y={tooltipY} y={tooltipY}
opacity={fixed || mouseState.visible ? 1 : 0} opacity={fixed || mouseState.visible ? 1 : 0}
pointerEvents={fixed ? 'all' : 'none'} pointerEvents={fixed ? 'all' : 'none'}
style={{ transition: 'opacity .1s ease-out', userSelect: fixed ? 'auto' : 'none' }} style={{ transition: 'opacity .1s ease-out', userSelect: fixed ? 'auto' : 'none' }}
> >
<div className={`tooltip ${position} ${className}`} <div className={'tooltip-wrapper'}>
style={{height: 'auto', bottom: `${position === 'bottom' ? '0' : ''}`}} <div className={`adaptive-tooltip tooltip ${position} ${className}`}
> style={{height: 'auto', bottom: `${position === 'bottom' ? '0' : ''}`}}
<div className={'tooltip-content'}> >
{tooltipBodies[i]} <div className={'tooltip-content'}>
{tooltipBodies[i]}
</div>
</div> </div>
</div> </div>
</foreignObject> </foreignObject>

View File

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

View File

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

View File

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

View File

@ -2,12 +2,17 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
& .tooltip-wrapper {
display: flex;
justify-content: center;
}
& .tooltip { & .tooltip {
@color: white; @color: white;
@bg-color: rgba(0, 0, 0, .75); @bg-color: rgba(0, 0, 0, .75);
@arrow-size: 8px; @arrow-size: 8px;
width: 100%; max-width: 100%;
height: 100%; height: 100%;
font-size: 13px; font-size: 13px;
@ -110,3 +115,34 @@
height: 100%; height: 100%;
} }
} }
@media (max-width: 1800px) {
.asb-d3-chart .adaptive-tooltip {
font-size: 11px;
}
}
@media (max-width: 1600px) {
.asb-d3-chart .adaptive-tooltip {
font-size: 9px;
}
}
@media (max-width: 1440px) {
.asb-d3-chart .adaptive-tooltip {
font-size: 8px;
padding: 0;
}
}
@media (max-width: 1310px) {
.asb-d3-chart .adaptive-tooltip {
font-size: 7px;
}
}
@media (max-width: 1279px) {
.asb-d3-chart .adaptive-tooltip {
font-size: 6px;
}
}