Skip to content

Commit cc911f1

Browse files
committed
pnpm docs:typescript:formatted
1 parent 8b0dacf commit cc911f1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

docs/data/charts/map/ColorScaleMapShape.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import * as React from 'react';
22
import Box from '@mui/material/Box';
33
import Stack from '@mui/material/Stack';
4+
import Typography from '@mui/material/Typography';
45
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
56
import ToggleButton from '@mui/material/ToggleButton';
7+
import { interpolateBlues } from 'd3-scale-chromatic';
68
import { feature as topojsonFeature } from 'topojson-client';
79
import countriesTopology from 'world-atlas/countries-110m.json';
810
import { Unstable_ChartsGeoDataProviderPremium as ChartsGeoDataProviderPremium } from '@mui/x-charts-premium/ChartsGeoDataProviderPremium';
@@ -16,14 +18,14 @@ import {
1618

1719
import { internetUsageByCountry } from '../dataset/internetUsageByCountry';
1820
import { withCountryCodeAsName, countryData } from '../dataset/countryData';
19-
import { blue } from '@mui/material/colors';
2021

2122
const countries = withCountryCodeAsName(
2223
topojsonFeature(countriesTopology, 'countries'),
2324
);
2425

2526
const data = Object.keys(countryData).map((code) => ({
26-
name: countryData[code].country,
27+
name: code,
28+
label: countryData[code].country,
2729
colorValue: internetUsageByCountry[code],
2830
}));
2931

@@ -43,6 +45,9 @@ export default function ColorScaleMapShape() {
4345
<ToggleButton value="continuous">continuous</ToggleButton>
4446
<ToggleButton value="piecewise">piecewise</ToggleButton>
4547
</ToggleButtonGroup>
48+
<Typography variant="body2" component="h6" sx={{ textAlign: 'end' }}>
49+
Share of the population using the Internet in 2020
50+
</Typography>
4651
<Box sx={{ width: '100%' }}>
4752
<ChartsGeoDataProviderPremium
4853
geoData={countries}
@@ -73,7 +78,7 @@ export default function ColorScaleMapShape() {
7378
: {
7479
type: 'piecewise',
7580
thresholds: [25, 50, 75],
76-
colors: [blue[100], blue[300], blue[500], blue[700]],
81+
colors: [0.25, 0.5, 0.75, 1].map(interpolateBlues),
7782
},
7883
},
7984
]}
@@ -84,7 +89,7 @@ export default function ColorScaleMapShape() {
8489
</ChartsSurface>
8590
<ChartsTooltip trigger="item" />
8691
{colorMap === 'continuous' ? (
87-
<ContinuousColorLegend axisDirection="z" />
92+
<ContinuousColorLegend axisDirection="z" sx={{ maxWidth: 150 }} />
8893
) : (
8994
<PiecewiseColorLegend axisDirection="z" direction="horizontal" />
9095
)}

0 commit comments

Comments
 (0)