How to use the @nivo/core.useTheme 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 / annotations / src / CircleAnnotationOutline.js View on Github external
const CircleAnnotationOutline = memo(({ x, y, size }) => {
    const theme = useTheme()
    const { animate, springConfig } = useMotionConfig()

    if (!animate) {
        return (
            <>
                {theme.annotations.outline.outlineWidth > 0 && (
github plouc / nivo / packages / axes / src / components / Axis.js View on Github external
x,
    y,
    length,
    ticksPosition,
    tickValues,
    tickSize,
    tickPadding,
    tickRotation,
    format,
    renderTick,
    legend,
    legendPosition,
    legendOffset,
    onClick,
}) => {
    const theme = useTheme()
    const { animate, springConfig } = useMotionConfig()

    const formatValue = useMemo(() => getFormatter(format, scale), [format, scale])

    const { ticks, textAlign, textBaseline } = computeCartesianTicks({
        axis,
        scale,
        ticksPosition,
        tickValues,
        tickSize,
        tickPadding,
        tickRotation,
    })

    let legendNode = null
    if (legend !== undefined) {
github plouc / nivo / packages / chord / src / ChordRibbonTooltip.js View on Github external
const ChordRibbonTooltip = memo(({ ribbon }) => {
    const theme = useTheme()

    return (
        ,
                    <strong>{ribbon.source.label}</strong>,
                    ribbon.source.formattedValue,
                ],
                [
                    ,
                    <strong>{ribbon.target.label}</strong>,
                    ribbon.target.formattedValue,
                ],
            ]}
github plouc / nivo / packages / annotations / src / RectAnnotationOutline.js View on Github external
const RectAnnotationOutline = memo(({ x, y, width, height }) =&gt; {
    const theme = useTheme()
    const { animate, springConfig } = useMotionConfig()

    if (!animate) {
        return (
            &lt;&gt;
                {theme.annotations.outline.outlineWidth &gt; 0 &amp;&amp; (
github plouc / nivo / packages / chord / src / Chord.js View on Github external
padAngle,
        colors,
    })

    const { setCurrentArc, setCurrentRibbon, getArcOpacity, getRibbonOpacity } = useChordSelection({
        arcs,
        arcOpacity,
        arcHoverOpacity,
        arcHoverOthersOpacity,
        ribbons,
        ribbonOpacity,
        ribbonHoverOpacity,
        ribbonHoverOthersOpacity,
    })

    const theme = useTheme()
    const getLabelTextColor = useInheritedColor(labelTextColor, theme)
    const getArcBorderColor = useInheritedColor(arcBorderColor, theme)
    const getRibbonBorderColor = useInheritedColor(ribbonBorderColor, theme)

    const layerContext = useChordLayerContext({
        center,
        radius,
        arcs,
        arcGenerator,
        ribbons,
        ribbonGenerator,
    })

    if (radius &lt;= 0) return null

    const legendData = arcs.map(arc =&gt; ({
github plouc / nivo / packages / bar / stories / bar.stories.js View on Github external
const CustomTick = tick =&gt; {
    const theme = useTheme()

    return (
github plouc / nivo / packages / radar / src / RadarGridLabels.js View on Github external
const RadarGridLabels = memo(({ radius, angles, indices, label: labelComponent, labelOffset }) =&gt; {
    const theme = useTheme()
    const { animate, springConfig } = useMotionConfig()

    const labels = indices.map((index, i) =&gt; {
        const position = positionFromAngle(angles[i], radius + labelOffset)
        const textAnchor = textAnchorFromAngle(angles[i])

        return {
            id: index,
            angle: radiansToDegrees(angles[i]),
            anchor: textAnchor,
            ...position,
        }
    })

    if (animate !== true) {
        return
github StateOfJS / State-of-JS-2019 / src / modules_not_used / tools / charts / tools_opinion_bump_chart / BumpChart.js View on Github external
linePoints.push([xScale('satisfaction'), yScale(tool.satisfactionRank)])
                linePoints.push([innerWidth, yScale(tool.satisfactionRank)])

                return {
                    ...tool,
                    linePoints
                }
            }),
        [tools, xScale, yScale, linePadding, innerWidth]
    )

    const [currentTool, setCurrentTool] = useState(null)

    const getColor = useOrdinalColorScale(distinctColors, 'id')

    const theme = useTheme()

    return (
        
            
            
            {toolsWithPoints.map(tool =&gt; (
github plouc / nivo / packages / bump / src / bump / LinesLabels.js View on Github external
const LinesLabels = ({ series, getLabel, position, padding, color }) =&gt; {
    const theme = useTheme()
    const { animate, springConfig } = useMotionConfig()
    const labels = useSeriesLabels({
        series,
        getLabel,
        position,
        padding,
        color,
    })

    if (!animate) {
        return labels.map(label =&gt; {
            return (
github plouc / nivo / packages / swarmplot / src / SwarmPlotCanvas.js View on Github external
isInteractive,
        onMouseEnter,
        onMouseMove,
        onMouseLeave,
        onClick,
        tooltip,
        debugMesh,
    }) => {
        const canvasEl = useRef(null)
        const [currentNode, setCurrentNode] = useState(null)
        const { margin, innerWidth, innerHeight, outerWidth, outerHeight } = useDimensions(
            width,
            height,
            partialMargin
        )
        const theme = useTheme()

        const { nodes, xScale, yScale } = useSwarmPlot({
            width: innerWidth,
            height: innerHeight,
            data,
            groups,
            groupBy,
            identity,
            label,
            value,
            valueFormat,
            valueScale,
            size,
            spacing,
            layout,
            gap,