Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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),
}
}
const generateData = () => generateDayCounts(from, to)
handleDiceRoll = () => {
const { from, to } = this.state
this.setState({
data: generateDayCounts(from, to),
})
}
const generateData = () => generateDayCounts(from, to)
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) => {
const generateData = () => generateDayCounts(from, to)
const data = generateData()