Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useEffect(() => {
// 第一次时初始化
chartRef.current || (chartRef.current = new Charts(domRef.current))
const mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
chartRef.current.setOption(getRingOption(mergedConfig), true)
let activeIndex = 0
function * loop() {
while (true) {
setState({ mergedConfig, activeIndex })
const option = getOption(mergedConfig, activeIndex)
chartRef.current.setOption(option, true)
const { activeTimeGap, data } = option.series[0]
const mergedColor = useMemo(() => deepMerge(deepClone(defaultColor, true), color || []), [color])
const mergedColor = useMemo(() => deepMerge(deepClone(defaultColor, true), color || []), [color])
const mergedColor = useMemo(() => deepMerge(deepClone(defaultColor, true), color || []), [color])
function getStyle({ style, textAlign }) {
return deepMerge(style, {
textAlign,
textBaseline: 'middle'
})
}
useEffect(() => {
const mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
if (!rendererRef.current) {
rendererRef.current = new CRender(domRef.current)
graphRef.current = getGraph(mergedConfig)
}
const graph = graphRef.current
graph.animationEnd()
const shape = getShape(mergedConfig)
const cacheNum = graph.shape.number.length
const shapeNum = shape.number.length
cacheNum !== shapeNum && (graph.shape.number = shape.number)
function getMergedConfig() {
const mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
mergedConfig.points = mergedConfig.points.map(item => {
if (Array.isArray(item)) {
return { position: item, text: '' }
}
return item
})
return mergedConfig
}
function calcAligns(mergedConfig, header) {
const columnNum = header.length
let aligns = new Array(columnNum).fill('left')
const { align } = mergedConfig
return deepMerge(aligns, align)
}
function calcData() {
const mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
const rows = calcRows(mergedConfig)
const heights = calcHeights(mergedConfig)
const data = { mergedConfig, rows }
heights !== undefined && Object.assign(data, { heights })
Object.assign(stateRef.current, data, { rowsData: rows, animationIndex: 0 })
setState(state => ({ ...state, ...data }))
}
const mergedColor = useMemo(() => deepMerge(deepClone(defaultColor, true), color || []), [color])