Skip to content

Commit 1f01c40

Browse files
authored
Merge branch 'main' into fil/default-margins
2 parents bb905bd + 1d01e25 commit 1f01c40

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/marks/rect.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ To round corners, use the **r** option. If the combined corner radii exceed the
196196
</label>
197197
</p>
198198

199-
:::plot hidden defer
199+
:::plot hidden defer https://observablehq.com/@observablehq/plot-rounded-rects
200200
```js
201201
Plot.plot({
202202
marks: [
@@ -218,7 +218,7 @@ Plot.plot({
218218

219219
To round corners on a specific side, use the **rx1**, **ry1**, **rx2**, or **ry2** options. When stacking rounded rects vertically, use a positive **ry2** and a corresponding negative **ry1**; likewise for stacking rounded rects horizontally, use a positive **rx2** and a negative **rx1**. Use the **clip** option to hide the “wings” below zero.
220220

221-
:::plot defer
221+
:::plot defer https://observablehq.com/@observablehq/plot-rounded-rects
222222
```js
223223
Plot.plot({
224224
color: {legend: true},
@@ -232,7 +232,7 @@ Plot.plot({
232232

233233
You can even round specific corners using the **rx1y1**, **rx2y1**, **rx2y2**, and **rx1y2** options.
234234

235-
:::plot defer
235+
:::plot defer https://observablehq.com/@observablehq/plot-rounded-rects
236236
```js
237237
Plot.plot({
238238
color: {legend: true},

docs/marks/waffle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ onMounted(() => {
2929

3030
The **waffle mark** is similar to the [bar mark](./bar.md) in that it displays a quantity (or quantitative extent) for a given category; but unlike a bar, a waffle is subdivided into square cells that allow easier counting. Waffles are useful for reading exact quantities. How quickly can you count the pears 🍐 below? How many more apples 🍎 are there than bananas 🍌?
3131

32-
:::plot
32+
:::plot https://observablehq.com/@observablehq/plot-simple-waffle
3333
```js
3434
Plot.waffleY([212, 207, 315, 11], {x: ["apples", "bananas", "oranges", "pears"]}).plot({height: 420})
3535
```
3636
:::
3737

3838
The waffle mark is often used with the [group transform](../transforms/group.md) to compute counts. The chart below compares the number of female and male athletes in the 2012 Olympics.
3939

40-
:::plot
40+
:::plot https://observablehq.com/@observablehq/plot-waffle-group
4141
```js
4242
Plot.waffleY(olympians, Plot.groupX({y: "count"}, {x: "sex"})).plot({x: {label: null}})
4343
```
@@ -62,7 +62,7 @@ The **unit** option determines the quantity each waffle cell represents; it defa
6262
</span>
6363
</p>
6464

65-
:::plot
65+
:::plot https://observablehq.com/@observablehq/plot-waffle-unit
6666
```js
6767
Plot.waffleY(olympians, Plot.groupZ({y: "count"}, {fx: "date_of_birth", unit})).plot({fx: {interval: "5 years", label: null}})
6868
```
@@ -76,15 +76,15 @@ While waffles typically represent integer quantities, say to count people or day
7676

7777
Like bars, waffles can be [stacked](../transforms/stack.md), and implicitly apply the stack transform when only a single quantitative channel is supplied.
7878

79-
:::plot
79+
:::plot https://observablehq.com/@observablehq/plot-stacked-waffles
8080
```js
8181
Plot.waffleY(olympians, Plot.groupZ({y: "count"}, {fill: "sex", sort: "sex", fx: "weight", unit: 10})).plot({fx: {interval: 10}, color: {legend: true}})
8282
```
8383
:::
8484

8585
Waffles can also be used to highlight a proportion of the whole. The chart below recreates a graphic of survey responses from [“Teens in Syria”](https://www.economist.com/graphic-detail/2015/08/19/teens-in-syria) by _The Economist_ (August 19, 2015); positive responses are in orange, while negative responses are in gray. The **rx** option is used to produce circles instead of squares.
8686

87-
:::plot
87+
:::plot https://observablehq.com/@observablehq/plot-survey-waffle
8888
```js
8989
Plot.plot({
9090
axis: null,

src/mark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {channelDomain, createChannels, valueObject} from "./channel.js";
22
import {defined} from "./defined.js";
33
import {maybeFacetAnchor} from "./facet.js";
44
import {maybeClip, maybeNamed, maybeValue} from "./options.js";
5-
import {dataify, isDomainSort, isObject, isOptions, keyword, range, singleton} from "./options.js";
5+
import {dataify, isDomainSort, isObject, isOptions, keyword, range, singleton, string} from "./options.js";
66
import {project} from "./projection.js";
7-
import {maybeClassName, styles} from "./style.js";
7+
import {styles} from "./style.js";
88
import {basic, initializer} from "./transforms/basic.js";
99

1010
export class Mark {
@@ -72,7 +72,7 @@ export class Mark {
7272
this.marginLeft = +marginLeft;
7373
this.clip = maybeClip(clip);
7474
this.tip = maybeTip(tip);
75-
this.className = className ? maybeClassName(className) : null;
75+
this.className = string(className);
7676
// Super-faceting currently disallow position channels; in the future, we
7777
// could allow position to be specified in fx and fy in addition to (or
7878
// instead of) x and y.

test/output/classNameOnMarks.svg

Lines changed: 1 addition & 1 deletion
Loading

test/plots/class-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export async function classNameOnMarks() {
1212
marks: [
1313
Plot.barX(
1414
sales,
15-
Plot.groupY({x: "sum"}, {x: "units", y: "fruit", sort: {y: "x", reverse: true}, className: "fruitbars"})
15+
Plot.groupY({x: "sum"}, {x: "units", y: "fruit", sort: {y: "x", reverse: true}, className: "fruit units"})
1616
),
1717
Plot.ruleX([0])
1818
]

0 commit comments

Comments
 (0)