How to use the @nivo/core.bindDefs function in @nivo/core

To help you get started, we’ve selected a few @nivo/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plouc / nivo / packages / nivo-treemap / src / enhance.js View on Github external
withPropsOnChange(['nodes', 'defs', 'fill'], ({ nodes, defs, fill }) => {
        return {
            defs: bindDefs(defs, nodes, fill, { targetKey: 'fill' }),
        }
    }),
]
github plouc / nivo / packages / circle-packing / src / enhance.js View on Github external
withPropsOnChange(['nodes', 'defs', 'fill'], ({ nodes, defs, fill }) => {
        return {
            defs: bindDefs(defs, nodes, fill, { targetKey: 'fill' }),
        }
    }),
]
github plouc / nivo / packages / bar / src / Bar.js View on Github external
}

    const willEnter = layout === 'vertical' ? barWillEnterVertical : barWillEnterHorizontal
    const willLeave =
        layout === 'vertical'
            ? barWillLeaveVertical(springConfig)
            : barWillLeaveHorizontal(springConfig)

    const shouldRenderLabel = ({ width, height }) => {
        if (!enableLabel) return false
        if (labelSkipWidth > 0 && width < labelSkipWidth) return false
        if (labelSkipHeight > 0 && height < labelSkipHeight) return false
        return true
    }

    const boundDefs = bindDefs(defs, result.bars, fill, {
        dataKey: 'data',
        targetKey: 'data.fill',
    })

    return (
        
            {({ showTooltip, hideTooltip }) => {
                const commonProps = {
                    borderRadius,
                    borderWidth,
github plouc / nivo / packages / waffle / src / enhance.js View on Github external
({ computedData, defs, fill }) => ({
                            defs: bindDefs(defs, computedData, fill, { targetKey: 'fill' }),
                        })
                    ),
github plouc / nivo / packages / treemap / src / enhance.js View on Github external
withPropsOnChange(['nodes', 'defs', 'fill'], ({ nodes, defs, fill }) => {
        return {
            defs: bindDefs(defs, nodes, fill, { targetKey: 'fill' }),
        }
    }),
]
github plouc / nivo / packages / stream / src / Stream.js View on Github external
})

    const slices = range(data.length).map(i => ({
        index: i,
        x: enhancedLayers[0].layer[i].x,
        stack: sortBy(
            enhancedLayers.map(layer => ({
                id: layer.id,
                color: layer.color,
                ...layer.layer[i],
            })),
            'y2'
        ),
    }))

    const boundDefs = bindDefs(defs, enhancedLayers, fill)

    return (
        
            {({ showTooltip, hideTooltip }) => (
github plouc / nivo / packages / nivo-stream / src / Stream.js View on Github external
enhancedLayers.map(layer => ({
                id: layer.id,
                color: layer.color,
                ...layer.layer[i],
            })),
            'y2'
        ),
    }))

    const motionProps = {
        animate,
        motionDamping,
        motionStiffness,
    }

    const boundDefs = bindDefs(defs, enhancedLayers, fill)

    return (
        
            {({ showTooltip, hideTooltip }) => (
github plouc / nivo / packages / pie / src / Pie.js View on Github external
{({ centerX, centerY, radius, innerRadius, arcs, arcGenerator }) => {
                    const boundDefs = bindDefs(defs, arcs, fill, {
                        dataKey: 'data',
                    })

                    return (
                        
                            {({ showTooltip, hideTooltip }) => (