asb_cloud_front/src/components/d3/renders/base.ts

13 lines
484 B
TypeScript
Raw Normal View History

import * as d3 from 'd3'
import { ChartRegistry } from '../types'
export const appendTransition = <DataType, BaseType extends d3.BaseType, Datum, PElement extends d3.BaseType, PDatum>(
elms: d3.Selection<BaseType, Datum, PElement, PDatum>,
chart: ChartRegistry<DataType>
): d3.Selection<BaseType, Datum, PElement, PDatum> => {
if (chart.animDurationMs && chart.animDurationMs > 0)
return elms.transition().duration(chart.animDurationMs) as any
return elms
}