forked from ddrilling/asb_cloud_front
Улучшена работа с типами в renderPoints
This commit is contained in:
parent
69222104a6
commit
e8fb9281b5
@ -50,7 +50,7 @@ export const renderPoint = <DataType extends Record<string, unknown>>(
|
||||
currentPoints.enter().append(config.shape)
|
||||
|
||||
const newPoints = getPointsRoot()
|
||||
.selectAll(config.shape)
|
||||
.selectAll<d3.BaseType, DataType>(config.shape)
|
||||
.transition()
|
||||
.duration(chart.animDurationMs ?? 0)
|
||||
|
||||
@ -58,14 +58,14 @@ export const renderPoint = <DataType extends Record<string, unknown>>(
|
||||
default:
|
||||
case 'circle':
|
||||
newPoints.attr('r', config.radius)
|
||||
.attr('cx', (d: any) => xAxis(chart.x(d)))
|
||||
.attr('cy', (d: any) => yAxis(chart.y(d)))
|
||||
.attr('cx', (d) => xAxis(chart.x(d)))
|
||||
.attr('cy', (d) => yAxis(chart.y(d)))
|
||||
break
|
||||
case 'line':
|
||||
newPoints.attr('x1', (d: any) => xAxis(chart.x(d)))
|
||||
.attr('x2', (d: any) => xAxis(chart.x(d)))
|
||||
.attr('y1', (d: any) => yAxis(chart.y(d)) - config.radius)
|
||||
.attr('y2', (d: any) => yAxis(chart.y(d)) + config.radius)
|
||||
newPoints.attr('x1', (d) => xAxis(chart.x(d)))
|
||||
.attr('x2', (d) => xAxis(chart.x(d)))
|
||||
.attr('y1', (d) => yAxis(chart.y(d)) - config.radius)
|
||||
.attr('y2', (d) => yAxis(chart.y(d)) + config.radius)
|
||||
break
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user