Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): add more chart types to the homepage
- Loading branch information
Showing
34 changed files
with
303 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useMemo } from 'react' | ||
import random from 'lodash/random' | ||
import { AreaBump } from '@nivo/bump' | ||
import { useHomeTheme } from './theme' | ||
import { dimensions } from './dimensions' | ||
import range from 'lodash/range' | ||
|
||
const serieIds = ['JavaScript', 'ReasonML', 'TypeScript', 'Elm'] | ||
const generateData = () => { | ||
const years = range(2000, 2005) | ||
|
||
return serieIds.map(id => ({ | ||
id, | ||
data: years.map(year => ({ | ||
x: year, | ||
y: random(5, 40), | ||
})), | ||
})) | ||
} | ||
|
||
export const HomeAreaBumpDemo = () => { | ||
const data = useMemo(() => generateData(), []) | ||
const { colors, nivoTheme } = useHomeTheme() | ||
|
||
return ( | ||
<div id="area-bump"> | ||
<AreaBump | ||
width={dimensions.width} | ||
height={dimensions.height} | ||
margin={dimensions.margin} | ||
data={data} | ||
colors={colors} | ||
borderWidth={1} | ||
spacing={12} | ||
borderColor={colors[3]} | ||
blendMode="normal" | ||
enableGridX={true} | ||
axisTop={null} | ||
axisBottom={null} | ||
startLabel={false} | ||
endLabel={false} | ||
isInteractive={false} | ||
animate={false} | ||
theme={nivoTheme} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { useMemo } from 'react' | ||
import { Bump } from '@nivo/bump' | ||
import { useHomeTheme } from './theme' | ||
import { dimensions } from './dimensions' | ||
import range from 'lodash/range' | ||
import shuffle from 'lodash/shuffle' | ||
|
||
interface Datum { | ||
x: number | ||
y: number | ||
} | ||
|
||
const generateData = () => { | ||
const years = range(2000, 2005) | ||
const ranks = range(1, 6) | ||
|
||
const series: { | ||
id: string | ||
data: Datum[] | ||
}[] = ranks.map(rank => { | ||
return { | ||
id: `Serie ${rank}`, | ||
data: [], | ||
} | ||
}) | ||
|
||
years.forEach(year => { | ||
shuffle(ranks).forEach((rank, i) => { | ||
series[i].data.push({ | ||
x: year, | ||
y: rank, | ||
}) | ||
}) | ||
}) | ||
|
||
return series | ||
} | ||
|
||
export const HomeBumpDemo = () => { | ||
const data = useMemo(() => generateData(), []) | ||
const { colors, nivoTheme } = useHomeTheme() | ||
|
||
return ( | ||
<div id="bump"> | ||
<Bump | ||
width={dimensions.width} | ||
height={dimensions.height} | ||
margin={dimensions.margin} | ||
data={data} | ||
colors={colors} | ||
lineWidth={dimensions.lineWidth} | ||
pointSize={dimensions.pointSize} | ||
endLabel={false} | ||
startLabel={false} | ||
enableGridX={true} | ||
axisTop={null} | ||
axisRight={null} | ||
axisBottom={null} | ||
axisLeft={null} | ||
isInteractive={false} | ||
animate={false} | ||
theme={nivoTheme} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { useMemo } from 'react' | ||
import { Choropleth } from '@nivo/geo' | ||
import { useHomeTheme } from './theme' | ||
import { dimensions } from './dimensions' | ||
import { generateChoroplethData } from '../../data/components/geo/generator' | ||
import countries from '../../data/components/geo/world_countries' | ||
|
||
export const HomeChoroplethDemo = () => { | ||
const data = useMemo(() => generateChoroplethData(), []) | ||
const { colors, nivoTheme } = useHomeTheme() | ||
|
||
return ( | ||
<div id="choropleth"> | ||
<Choropleth | ||
width={dimensions.width} | ||
height={dimensions.height} | ||
margin={dimensions.margin} | ||
data={data} | ||
features={countries.features} | ||
colors={colors} | ||
domain={[0, 1000000]} | ||
unknownColor={`${colors[0]}44`} | ||
borderWidth={1} | ||
borderColor={colors[3]} | ||
isInteractive={false} | ||
animate={false} | ||
theme={nivoTheme} | ||
projectionType="mercator" | ||
projectionScale={100} | ||
projectionTranslation={[0.5, 0.6]} | ||
projectionRotation={[0, 0, 0]} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useMemo } from 'react' | ||
import { RadialBar } from '@nivo/radial-bar' | ||
import { useHomeTheme } from './theme' | ||
import { dimensions } from './dimensions' | ||
|
||
const generateData = () => { | ||
const ids = ['Supermarket', 'Combini', 'Online', 'Marché'] | ||
const categories = ['Vegetables', 'Fruits', 'Meat'] | ||
|
||
return ids.map(id => ({ | ||
id, | ||
data: categories.map(category => ({ | ||
x: category, | ||
y: Math.round(Math.random() * 300), | ||
})), | ||
})) | ||
} | ||
|
||
export const HomeRadialBarDemo = () => { | ||
const data = useMemo(() => generateData(), []) | ||
const { colors, nivoTheme } = useHomeTheme() | ||
|
||
return ( | ||
<div id="radial-bar"> | ||
<RadialBar | ||
width={dimensions.width} | ||
height={dimensions.height} | ||
margin={dimensions.margin} | ||
data={data} | ||
tracksColor={`${colors[0]}44`} | ||
colors={colors.slice(1)} | ||
endAngle={315} | ||
borderWidth={1} | ||
borderColor={colors[3]} | ||
padding={0.3} | ||
isInteractive={false} | ||
animate={false} | ||
theme={nivoTheme} | ||
enableLabels={false} | ||
radialAxisStart={null} | ||
circularAxisOuter={null} | ||
/> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.