-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): generate chart icons from code
- Loading branch information
Raphaël Benitte
authored and
Raphaël Benitte
committed
Dec 11, 2018
1 parent
d1bb057
commit 209177a
Showing
80 changed files
with
1,325 additions
and
84 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14.4 KB
(96%)
packages/parallel-coordinates/doc/parallel-coordinates-canvas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
Diff not rendered.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
Diff not rendered.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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,69 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* (c) 2016 Raphaël Benitte | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
import React, { Fragment } from 'react' | ||
import { Bar } from '@nivo/bar' | ||
import barGreyImg from '../../assets/icons/bar-grey.png' | ||
import barRedImg from '../../assets/icons/bar-red.png' | ||
import { ICON_SIZE, Icon } from './styled' | ||
|
||
const chartProps = { | ||
indexBy: 'id', | ||
keys: ['A', 'B', 'C'], | ||
margin: { | ||
top: 12, | ||
bottom: 16, | ||
}, | ||
padding: 0.2, | ||
enableGridX: false, | ||
enableGridY: false, | ||
axisBottom: null, | ||
axisLeft: null, | ||
enableLabel: false, | ||
data: [ | ||
{ id: '0', A: 3.2, B: 2, C: 1.6 }, | ||
{ id: '1', A: 2.8, B: 1.7, C: 1.2 }, | ||
{ id: '2', A: 4, B: 2.4, C: 1.8 }, | ||
{ id: '3', A: 6, B: 4, C: 2 }, | ||
{ id: '4', A: 5, B: 3, C: 2 }, | ||
], | ||
isInteractive: false, | ||
} | ||
|
||
const BarIcon = () => ( | ||
<Fragment> | ||
<Icon id="bar-grey"> | ||
<Bar | ||
width={ICON_SIZE} | ||
height={ICON_SIZE} | ||
{...chartProps} | ||
colors={['#b0aeaf', '#838383', '#767676']} | ||
/> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${barGreyImg})`, | ||
}} | ||
/> | ||
<Icon id="bar-red"> | ||
<Bar | ||
width={ICON_SIZE} | ||
height={ICON_SIZE} | ||
{...chartProps} | ||
colors={['#ff8d80', '#f54d31', '#e2462f']} | ||
/> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${barRedImg})`, | ||
}} | ||
/> | ||
</Fragment> | ||
) | ||
|
||
export default BarIcon |
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,119 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* (c) 2016 Raphaël Benitte | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
import React, { Fragment } from 'react' | ||
import { Bullet } from '@nivo/bullet' | ||
import bulletGreyImg from '../../assets/icons/bullet-grey.png' | ||
import bulletRedImg from '../../assets/icons/bullet-red.png' | ||
import { ICON_SIZE, Icon } from './styled' | ||
|
||
const chartProps = { | ||
data: [ | ||
{ | ||
id: 'A', | ||
ranges: [36, 100], | ||
measures: [56], | ||
markers: [76], | ||
}, | ||
{ | ||
id: 'B', | ||
ranges: [60, 100], | ||
measures: [76], | ||
markers: [88], | ||
}, | ||
{ | ||
id: 'C', | ||
ranges: [50, 100], | ||
measures: [60], | ||
markers: [74], | ||
}, | ||
], | ||
margin: { | ||
top: 8, | ||
bottom: 8, | ||
}, | ||
titleOffsetX: -300, | ||
spacing: 8, | ||
isInteractive: false, | ||
markerSize: 0.4, | ||
} | ||
|
||
const Range = colors => d => { | ||
const color = d.data.v1 === 100 ? colors[1] : colors[0] | ||
|
||
return <rect x={d.x} y={d.y} width={d.width} height={d.height} fill={color} /> | ||
} | ||
|
||
const Measure = color => d => ( | ||
<rect x={d.x} y={d.y} width={d.width} height={d.height} fill={color} /> | ||
) | ||
|
||
const Marker = color => d => ( | ||
<rect fill={color} x={d.x - d.size / 2} y={d.y - d.size / 2} width={d.size} height={d.size} /> | ||
) | ||
|
||
const BulletIcon = () => ( | ||
<Fragment> | ||
<Icon id="bullet-grey"> | ||
<Bullet | ||
width={ICON_SIZE} | ||
height={ICON_SIZE} | ||
{...chartProps} | ||
rangeComponent={Range(['#e2e2e2', '#c5c5c5'])} | ||
measureComponent={Measure('#666')} | ||
markerComponent={Marker('#666')} | ||
theme={{ | ||
axis: { | ||
ticks: { | ||
line: { | ||
strokeWidth: 0, | ||
}, | ||
text: { | ||
fill: 'transparent', | ||
}, | ||
}, | ||
}, | ||
}} | ||
/> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${bulletGreyImg})`, | ||
}} | ||
/> | ||
<Icon id="bullet-red"> | ||
<Bullet | ||
width={ICON_SIZE} | ||
height={ICON_SIZE} | ||
{...chartProps} | ||
rangeComponent={Range(['#ffc6c6', '#ffa4a2'])} | ||
measureComponent={Measure('#e2462f')} | ||
markerComponent={Marker('#e2462f')} | ||
theme={{ | ||
axis: { | ||
ticks: { | ||
line: { | ||
strokeWidth: 0, | ||
}, | ||
text: { | ||
fill: 'transparent', | ||
}, | ||
}, | ||
}, | ||
}} | ||
/> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${bulletRedImg})`, | ||
}} | ||
/> | ||
</Fragment> | ||
) | ||
|
||
export default BulletIcon |
Oops, something went wrong.