How to use the @nivo/generators.generateLibTree function in @nivo/generators

To help you get started, we’ve selected a few @nivo/generators 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 / website / src / components / charts / bubble / BubblePage.js View on Github external
/*
 * This file is part of the nivo project.
 *
 * Copyright 2016-present, Raphaël Benitte.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
import React, { Component } from 'react'
import Helmet from 'react-helmet'
import { generateLibTree } from '@nivo/generators'

export default class BubblePage extends Component {
    state = {
        libTree: generateLibTree(),
    }

    diceRoll = () => {
        this.setState({ libTree: generateLibTree() })
    }

    render() {
        const { childRoutes } = this.props
        const { libTree } = this.state

        return (
            <div>
                
                {childRoutes.map(childRoute =&gt; {
                    return React.cloneElement(childRoute, {
                        component: null,</div>
github plouc / nivo / website / src / components / pages / Home.js View on Github external
theme={homeTheme}
                        colors={colors}
                        animate={false}
                        isInteractive={false}
                        {...commonAxes}
                        dotSize={7}
                        dotBorderWidth={1}
                        dotBorderColor="#e25d47"
                    /&gt;
                    <span>
                        <span>Line documentation</span>
                    </span>
                
                
                    
                    <span>
                        <span>Bubble documentation</span>
                    </span>
github plouc / nivo / packages / circle-packing / stories / bubble.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { generateLibTree } from '@nivo/generators'
import { Bubble } from '../src'

const commonProperties = {
    width: 900,
    height: 500,
    root: generateLibTree(),
    identity: 'name',
    value: 'loc',
    label: 'name',
    labelSkipRadius: 16,
}

storiesOf('Bubble', module)
    .add('default', () =&gt; )
    .add('rendering leaves only', () =&gt; )
    .add('with formatted values', () =&gt; (
        
                `${Number(value).toLocaleString('ru-RU', {
                    minimumFractionDigits: 2,
                })} ₽`
github plouc / nivo / website / src / pages / bubble / api.js View on Github external
* This file is part of the nivo project.
 *
 * Copyright 2016-present, Raphaël Benitte.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
import React from 'react'
import { generateLibTree } from '@nivo/generators'
import SEO from '../../components/seo'
import ApiClient from '../../components/components/api-client/ApiClient'
import { groups } from '../../data/components/bubble/props'
import mapper from '../../data/components/bubble/mapper'
import meta from '../../data/components/bubble/meta.yml'

const root = generateLibTree()

const BubbleApi = () =&gt; {
    return (
        &lt;&gt;
github plouc / nivo / website / src / pages / sunburst / api.js View on Github external
* This file is part of the nivo project.
 *
 * Copyright 2016-present, Raphaël Benitte.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
import React from 'react'
import { generateLibTree } from '@nivo/generators'
import SEO from '../../components/seo'
import ApiClient from '../../components/components/api-client/ApiClient'
import { groups } from '../../data/components/sunburst/props'
import mapper from '../../data/components/sunburst/mapper'
import meta from '../../data/components/sunburst/meta.yml'

const data = generateLibTree()

const SunburstApi = () =&gt; {
    return (
        &lt;&gt;
github plouc / nivo / packages / circle-packing / stories / bubbleHtml.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { generateLibTree } from '@nivo/generators'
import { BubbleHtml } from '../src'

const commonProperties = {
    width: 900,
    height: 500,
    root: generateLibTree(),
    identity: 'name',
    value: 'loc',
    label: 'name',
    labelSkipRadius: 16,
}

storiesOf('BubbleHtml', module)
    .add('default', () =&gt; )
    .add('rendering leaves only', () =&gt; )
    .add('with formatted values', () =&gt; (
        
                `${Number(value).toLocaleString('ru-RU', {
                    minimumFractionDigits: 2,
                })} ₽`
github plouc / nivo / packages / nivo-sunburst / stories / sunburst.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withKnobs, boolean, select } from '@storybook/addon-knobs'
import { generateLibTree } from '@nivo/generators'
import { Sunburst } from '../index'

const commonProperties = {
    width: 600,
    height: 600,
    margin: { top: 0, right: 0, bottom: 0, left: 0 },
    data: generateLibTree(),
    identity: 'name',
    value: 'loc',
    animate: true,
}

const stories = storiesOf('Sunburst', module)

stories.addDecorator(story =&gt; <div>{story()}</div>).addDecorator(withKnobs)

stories.add('default', () =&gt; )

stories.add('with child color modifier', () =&gt; (
    
))
github plouc / nivo / packages / treemap / stories / treemap.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { generateLibTree } from '@nivo/generators'
import { TreeMap } from '../src'

const commonProperties = {
    width: 900,
    height: 400,
    root: generateLibTree(),
    identity: 'name',
    value: 'loc',
    label: 'name',
    labelSkipRadius: 16,
}

storiesOf('TreeMap', module).add('custom tooltip', () =&gt; (
     (
            <strong color="" style="{{">
                {id}: {value}
            </strong>
        )}
        theme={{
            tooltip: {
github plouc / nivo / packages / sunburst / stories / sunburst.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withKnobs } from '@storybook/addon-knobs'
import { generateLibTree } from '@nivo/generators'
import { Sunburst } from '../src'

const commonProperties = {
    width: 900,
    height: 500,
    data: generateLibTree(),
    identity: 'name',
    value: 'loc',
    animate: true,
}

const stories = storiesOf('Sunburst', module)

stories.addDecorator(withKnobs)

stories.add('default', () =&gt; )

stories.add('with child color modifier', () =&gt; (
    
))

stories.add('with child colors independent of parent', () =&gt; (
github plouc / nivo / website / src / data / components / treemap / generator.js View on Github external
export const generateLightDataSet = () => ({ root: generateLibTree() })