How to use the @nivo/scales.computeScale function in @nivo/scales

To help you get started, we’ve selected a few @nivo/scales 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 / swarmplot / src / compute.js View on Github external
export const computeValueScale = ({ width, height, axis, getValue, scale, data }) => {
    const values = data.map(getValue)
    const min = Math.min(...values)
    const max = Math.max(...values)

    return computeScale({ ...scale, axis }, { [axis]: { min, max } }, width, height)
}

@nivo/scales

<a href="https://nivo.rocks"><img alt="nivo" src="https://raw.githubusercontent.com/plouc/nivo/master/nivo.png" width="216" height="68"/></a>

MIT
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis

Similar packages