File tree 3 files changed +26
-2
lines changed
3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change
1
+ import * as Plot from "@observablehq/plot" ;
2
+ import * as d3 from "d3" ;
3
+
4
+ export default async function ( ) {
5
+ const gapminder = await d3 . tsv ( "data/gapminder.tsv" , d3 . autoType ) ;
6
+ return Plot . plot ( {
7
+ marginLeft : 70 ,
8
+ inset : 10 ,
9
+ grid : true ,
10
+ facet :{ data : gapminder , y : "continent" } ,
11
+ x : {
12
+ type : "log" ,
13
+ transform : d => Math . pow ( 10 , d )
14
+ } ,
15
+ marks : [
16
+ Plot . boxX ( gapminder , {
17
+ x : d => Math . log10 ( d . gdpPercap ) ,
18
+ stroke : "continent" ,
19
+ strokeWidth : 0.5 ,
20
+ time : "year" ,
21
+ timeFilter : "lte"
22
+ } )
23
+ ]
24
+ } ) ;
25
+ }
Original file line number Diff line number Diff line change @@ -7,15 +7,13 @@ export default async function () {
7
7
marginLeft : 70 ,
8
8
inset : 10 ,
9
9
grid : true ,
10
- // facet:{ data: gapminder, y: "continent"},
11
10
x : {
12
11
type : "log" ,
13
12
transform : d => Math . pow ( 10 , d )
14
13
} ,
15
14
marks : [
16
15
Plot . boxX ( gapminder , {
17
16
x : d => Math . log10 ( d . gdpPercap ) ,
18
- sort : null ,
19
17
y : "continent" ,
20
18
stroke : "continent" ,
21
19
strokeWidth : 0.5 ,
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ export {default as fruitSales} from "./fruit-sales.js";
77
77
export { default as fruitSalesDate } from "./fruit-sales-date.js" ;
78
78
export { default as gapminder } from "./gapminder.js" ;
79
79
export { default as gapminderBox } from "./gapminder-box.js" ;
80
+ export { default as gapminderBoxFacet } from "./gapminder-box-facet.js" ;
80
81
export { default as gapminderDodge } from "./gapminder-dodge.js" ;
81
82
export { default as gapminderContinent } from "./gapminder-continent.js" ;
82
83
export { default as gistempAnomaly } from "./gistemp-anomaly.js" ;
You can’t perform that action at this time.
0 commit comments