You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1331,6 +1331,7 @@ In addition to the [standard mark options](#marks), the following optional chann
1331
1331
* **y** - the vertical position; bound to the *y* scale
1332
1332
* **width** - the image width (in pixels)
1333
1333
* **height** - the image height (in pixels)
1334
+
* **imageRendering** - the [image-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering) attribute
1334
1335
1335
1336
If either of the **x** or **y** channels are not specified, the corresponding position is controlled by the **frameAnchor** option.
1336
1337
@@ -1523,6 +1524,40 @@ If an **interval** is specified, such as d3.utcDay, **x1** and **x2** can be der
1523
1524
1524
1525
The rect mark supports the [standard mark options](#marks), including insets and rounded corners. The **stroke** defaults to none. The **fill** defaults to currentColor if the stroke is none, and to none otherwise.
1525
1526
1527
+
### Pixel
1528
+
1529
+
#### Plot.pixel(*data*, *options*)
1530
+
1531
+
<!-- jsdoc pixel -->
1532
+
1533
+
```js
1534
+
Plot.pixel(triplets, {x:"0", y:"1", fill:"2"})
1535
+
```
1536
+
1537
+
Returns a new raster image with samples at coordinates *x* and *y* optionally set to the given *fill* color and *opacity*. The image is created as a canvas and inserted into the chart as an image with a [data-url](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) href.
1538
+
1539
+
The **x** and **y** options are both required, as a constant or as a channel, and mapped to the quantitative scales *x* and *y*. Each sample is represented by a rectangular fill from position ﹤x − ½, y − ½﹥ to position ﹤x + ½, y + ½﹥, minus any insets, and possibly rounded to the closest pixel on the underlying canvas to avoid anti-aliasing artifacts.
1540
+
1541
+
The pixel mark supports the following options:
1542
+
1543
+
* **fill** - the sample’s color, as a constant or a channel
1544
+
* **fillOpacity** - the sample’s opacity, as a constant or a channel
1545
+
* **opacity** - alias for fillOpacity
1546
+
* **mixBlendMode** - controls both the [mix-blend-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) attribute of the image, and the [globalCompositeOperation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation) for composing overlapping samples
1547
+
* **imageRendering** - the [image-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering) attribute, defaults to pixelated
1548
+
* **pixelRatio** - the canvas pixel ratio, defaults to [devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
1549
+
* **round** - whether the scaled coordinates are rounded, defaults to true
1550
+
* **inset** - inset of the mark in screen pixels, defaults to zero; note: this length is measured independently of the mark’s pixelRatio
1551
+
* **insetTop** - inset the top edge
1552
+
* **insetRight** - inset the right edge
1553
+
* **insetBottom** - inset the bottom edge
1554
+
* **insetLeft** - inset the left edge
1555
+
1556
+
Only a few common mark options are supported: **dx**, **dy**, **ariaDescription**, **clip**, and **pointerEvents**. All the options related to the **stroke** (**strokeOpacity**, **paintOrder**…) are ignored, as are **shapeRendering** (but, see imageRendering), **href** and **target**.
0 commit comments