How to use the @nivo/legends.useQuantizeColorScaleLegendData function in @nivo/legends

To help you get started, we’ve selected a few @nivo/legends 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 / geo / src / hooks.js View on Github external
data: datum,
                        value: datumValue,
                        formattedValue: valueFormatter(datumValue),
                    }
                    featureWithData.color = getFillColor(featureWithData)
                    featureWithData.label = getLabel(featureWithData)

                    return featureWithData
                }

                return feature
            }),
        [features, data, findMatchingDatum, getValue, valueFormatter, getFillColor]
    )

    const legendData = useQuantizeColorScaleLegendData({
        scale: colorScale,
        valueFormat: valueFormatter,
    })

    return {
        colorScale,
        getFillColor,
        boundFeatures,
        valueFormatter,
        legendData,
    }
}

@nivo/legends

legend components for nivo dataviz library

MIT
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis

Similar packages