Skip to content

Commit 1a89bb1

Browse files
committed
tests
1 parent 129d89d commit 1a89bb1

File tree

5 files changed

+7
-31
lines changed

5 files changed

+7
-31
lines changed

test/plots/aapl-close.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ export async function aaplClose() {
66
return Plot.plot({
77
y: {grid: true},
88
marks: [
9-
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.1}),
10-
Plot.lineY(aapl, {x: "Date", y: "Close"}),
9+
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.1, line: true}),
1110
Plot.ruleY([0])
1211
]
1312
});
@@ -28,8 +27,7 @@ export async function aaplCloseClip() {
2827
x: {domain: [new Date(Date.UTC(2015, 0, 1)), new Date(Date.UTC(2015, 3, 1))]},
2928
y: {grid: true},
3029
marks: [
31-
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.1}),
32-
Plot.lineY(aapl, {x: "Date", y: "Close"}),
30+
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.1, line: true}),
3331
Plot.ruleY([0], {clip: false})
3432
]
3533
});

test/plots/availability.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,10 @@ import * as d3 from "d3";
33

44
export async function availability() {
55
const data = await d3.csv<any>("data/availability.csv", d3.autoType);
6-
const sum = (d) => (d.length ? d3.sum(d) : NaN); // force gaps
76
return Plot.plot({
87
height: 180,
98
marks: [
10-
Plot.areaY(data, {
11-
x: "date",
12-
y: "value",
13-
interval: "day",
14-
reduce: sum,
15-
curve: "step",
16-
fill: "#f2f2fe"
17-
}),
18-
Plot.lineY(data, {
19-
x: "date",
20-
y: "value",
21-
interval: "day",
22-
reduce: sum,
23-
curve: "step"
24-
}),
9+
Plot.areaY(data, {x: "date", y: "value", interval: "day", curve: "step", fill: "#f2f2fe", line: true}),
2510
Plot.ruleY([0])
2611
]
2712
});

test/plots/downloads.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ export async function downloads() {
55
const downloads = (await d3.csv<any>("data/downloads.csv", d3.autoType)).filter((d) => d.downloads > 0);
66
return Plot.plot({
77
marks: [
8-
Plot.areaY(downloads, {x: "date", interval: "day", y: "downloads", curve: "step", fill: "#ccc"}),
98
Plot.ruleY([0]),
10-
Plot.lineY(downloads, {x: "date", interval: "day", y: "downloads", curve: "step", strokeWidth: 1})
9+
Plot.areaY(downloads, {x: "date", interval: "day", y: "downloads", curve: "step", fill: "#ccc", line: true, strokeWidth: 1})
1110
]
1211
});
1312
}

test/plots/music-revenue.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@ import * as d3 from "d3";
33

44
export async function musicRevenue() {
55
const riaa = await d3.csv<any>("data/riaa-us-revenue.csv", d3.autoType);
6-
const stack: Plot.AreaYOptions = {
7-
x: "year",
8-
y: "revenue",
9-
z: "format",
10-
order: "-appearance"
11-
};
126
return Plot.plot({
137
y: {
148
grid: true,
159
label: "Annual revenue (billions, adj.)",
1610
transform: (d) => d / 1000
1711
},
1812
marks: [
19-
Plot.areaY(riaa, Plot.stackY({...stack, fill: "group", title: (d) => `${d.format}\n${d.group}`})),
20-
Plot.lineY(riaa, Plot.stackY2({...stack, stroke: "white", strokeWidth: 1})),
13+
Plot.areaY(riaa, {x: "year", y: "revenue", z: "format", order: "-appearance", fill: "group", title: (d: any) => `${d.format}\n${d.group}`, line: true, stroke: "white", strokeWidth: 1}),
2114
Plot.ruleY([0])
2215
]
2316
});

test/plots/ridgeline.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export async function ridgeline() {
2020
curve: "basis",
2121
sort: "date",
2222
fill: "color-mix(in oklab, var(--plot-background), currentColor 20%)",
23-
line: true
23+
line: true,
24+
strokeWidth: 1
2425
})
2526
]
2627
});

0 commit comments

Comments
 (0)