-
-
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.
- Loading branch information
Raphaël Benitte
authored and
Raphaël Benitte
committed
Mar 27, 2019
1 parent
119b9e9
commit 54c0040
Showing
17 changed files
with
273 additions
and
31 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
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.
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,98 @@ | ||
/* | ||
* 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 { Choropleth } from '@nivo/geo' | ||
import choroplethGreyImg from '../../assets/icons/choropleth-grey.png' | ||
import choroplethRedImg from '../../assets/icons/choropleth-red.png' | ||
import { ICON_SIZE, Icon } from './styled' | ||
import world from '../charts/geo/world_countries' | ||
|
||
const includeCountries = ['DZA', 'NER', 'BFA', 'MLI', 'MRT'] | ||
const features = world.features.filter(f => includeCountries.includes(f.id)) | ||
|
||
const data = [ | ||
{ id: 'DZA', value: 3 }, | ||
{ id: 'NER', value: 6 }, | ||
{ id: 'BFA', value: 1 }, | ||
{ id: 'MLI', value: 12 }, | ||
{ id: 'MRT', value: 7 }, | ||
{ id: 'COD', value: 9 }, | ||
] | ||
|
||
const chartProps = { | ||
width: ICON_SIZE, | ||
height: ICON_SIZE, | ||
features, | ||
data, | ||
projectionScale: 166, | ||
projectionTranslation: [0.8, 1.2], | ||
isInteractive: false, | ||
borderWidth: 1, | ||
} | ||
|
||
const ChoroplethIcon = () => ( | ||
<Fragment> | ||
<Icon | ||
id="choropleth-grey" | ||
style={{ | ||
position: 'relative', | ||
}} | ||
> | ||
<Choropleth {...chartProps} borderColor="#686868" borderWidth={6} /> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
zIndex: 10, | ||
}} | ||
> | ||
<Choropleth | ||
{...chartProps} | ||
borderWidth={0} | ||
colors={['#ddd', '#bbb', '#999', '#777']} | ||
/> | ||
</div> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${choroplethGreyImg})`, | ||
}} | ||
/> | ||
<Icon | ||
id="choropleth-red" | ||
style={{ | ||
position: 'relative', | ||
}} | ||
> | ||
<Choropleth {...chartProps} borderColor="#d45036" borderWidth={6} /> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
zIndex: 10, | ||
}} | ||
> | ||
<Choropleth | ||
{...chartProps} | ||
borderWidth={0} | ||
colors={['#ffb8b4', '#ff8b7d', '#ff5c3e']} | ||
/> | ||
</div> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${choroplethRedImg})`, | ||
}} | ||
/> | ||
</Fragment> | ||
) | ||
|
||
export default ChoroplethIcon |
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,81 @@ | ||
/* | ||
* 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 { GeoMap } from '@nivo/geo' | ||
import {} from 'd3-geo' | ||
import geomapGreyImg from '../../assets/icons/geomap-grey.png' | ||
import geomapRedImg from '../../assets/icons/geomap-red.png' | ||
import { ICON_SIZE, Icon } from './styled' | ||
import world from '../charts/geo/world_countries' | ||
|
||
const includeCountries = ['DZA', 'NER', 'BFA', 'MLI', 'MRT'] | ||
const features = world.features.filter(f => includeCountries.includes(f.id)) | ||
|
||
const chartProps = { | ||
width: ICON_SIZE, | ||
height: ICON_SIZE, | ||
features, | ||
projectionScale: 166, | ||
projectionTranslation: [0.8, 1.2], | ||
isInteractive: false, | ||
borderWidth: 1, | ||
} | ||
|
||
const GeoMapIcon = () => ( | ||
<Fragment> | ||
<Icon | ||
id="geomap-grey" | ||
style={{ | ||
position: 'relative', | ||
}} | ||
> | ||
<GeoMap {...chartProps} borderWidth={6} borderColor="#686868" /> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
zIndex: 10, | ||
}} | ||
> | ||
<GeoMap {...chartProps} fillColor="#e2e2e2" borderColor="#686868" /> | ||
</div> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${geomapGreyImg})`, | ||
}} | ||
/> | ||
<Icon | ||
id="geomap-red" | ||
style={{ | ||
position: 'relative', | ||
}} | ||
> | ||
<GeoMap {...chartProps} borderWidth={6} borderColor="#d45036" /> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
zIndex: 10, | ||
}} | ||
> | ||
<GeoMap {...chartProps} fillColor="#ffc6c5" borderColor="#d45036" /> | ||
</div> | ||
</Icon> | ||
<Icon | ||
style={{ | ||
backgroundImage: `url(${geomapRedImg})`, | ||
}} | ||
/> | ||
</Fragment> | ||
) | ||
|
||
export default GeoMapIcon |
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.