How to use the @nivo/generators.generateDayCounts 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 / packages / calendar / stories / calendar.stories.js View on Github external
import React from 'react'
import { storiesOf } from '@storybook/react'
import { generateDayCounts } from '@nivo/generators'
import { Calendar } from '../src'

const from = new Date(2019, 0, 1)
const to = new Date(2019, 11, 31)
const data = generateDayCounts(from, to)

const commonProps = {
    width: 900,
    height: 260,
    margin: {
        top: 50,
        right: 10,
        bottom: 10,
        left: 50,
    },
    from: from.toISOString(),
    to: to.toISOString(),
    data,
}

const stories = storiesOf('Calendar', module)
github plouc / nivo / website / src / components / charts / calendar / CalendarPage.js View on Github external
constructor(props) {
        super(props)

        const from = new Date(2015, 3, 1)
        const to = new Date(2018, 7, 12)

        this.state = {
            from,
            to,
            data: generateDayCounts(from, to),
        }
    }
github plouc / nivo / website / src / pages / calendar / canvas.js View on Github external
const generateData = () => generateDayCounts(from, to)
github plouc / nivo / website / src / components / charts / calendar / CalendarPage.js View on Github external
handleDiceRoll = () => {
        const { from, to } = this.state
        this.setState({
            data: generateDayCounts(from, to),
        })
    }
github plouc / nivo / website / src / pages / calendar / index.js View on Github external
const generateData = () => generateDayCounts(from, to)
github plouc / nivo / website / src / components / pages / Home.js View on Github external
import { ResponsiveRadar } from '@nivo/radar'
import { ResponsiveChord } from '@nivo/chord'
import { ResponsiveCalendar } from '@nivo/calendar'
import { ResponsiveBubble } from '@nivo/circle-packing'
import { ResponsiveSunburst } from '@nivo/sunburst'
import { ResponsivePie } from '@nivo/pie'
import { ResponsiveTreeMap } from '@nivo/treemap'
import { ResponsiveStream } from '@nivo/stream'
import { ResponsiveBar } from '@nivo/bar'
import { ResponsiveLine } from '@nivo/line'

const colors = redColorRange

const calendarFrom = new Date(2015, 3, 1)
const calendarTo = new Date(2016, 5, 1)
const calendarData = generateDayCounts(calendarFrom, calendarTo)
const voronoi = {
    xDomain: [0, 400],
    yDomain: [0, 300],
}
voronoi.data = range(80).map(id => ({
    id,
    x: Math.random() * voronoi.xDomain[1],
    y: Math.random() * voronoi.yDomain[1],
}))

const radarMargin = { top: 20, right: 40, bottom: 10, left: 40 }

const streamDataLayerCount = 5
const generateStreamData = () =>
    range(16).map(() =>
        range(streamDataLayerCount).reduce((acc, i) => {
github plouc / nivo / website / src / pages / calendar / api.js View on Github external
const generateData = () => generateDayCounts(from, to)
const data = generateData()