Skip to content

Commit e9e08c2

Browse files
authored
the object opacity channel should opt-out of the opacity scale too (#1571)
1 parent 5674bd2 commit e9e08c2

File tree

6 files changed

+272
-0
lines changed

6 files changed

+272
-0
lines changed

src/channel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function inferChannelScale(name, channel) {
5151
break;
5252
case "fillOpacity":
5353
case "strokeOpacity":
54+
case "opacity":
5455
channel.scale = scale !== true && isEvery(value, isOpacity) ? null : "opacity";
5556
break;
5657
case "symbol":
Lines changed: 81 additions & 0 deletions
Loading
Lines changed: 81 additions & 0 deletions
Loading

test/output/opacityDotsUnscaled.svg

Lines changed: 81 additions & 0 deletions
Loading

test/plots/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export * from "./movies-rating-by-genre.js";
164164
export * from "./multiplication-table.js";
165165
export * from "./music-revenue.js";
166166
export * from "./npm-versions.js";
167+
export * from "./opacity.js";
167168
export * from "./ordinal-bar.js";
168169
export * from "./penguin-annotated.js";
169170
export * from "./penguin-culmen-array.js";

test/plots/opacity.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import * as d3 from "d3";
2+
import * as Plot from "@observablehq/plot";
3+
4+
export function opacityDotsFillUnscaled() {
5+
return Plot.dotX(d3.ticks(0.3, 0.7, 40), {
6+
fill: "black",
7+
r: 7,
8+
fillOpacity: Plot.identity
9+
}).plot();
10+
}
11+
12+
export function opacityDotsStrokeUnscaled() {
13+
return Plot.dotX(d3.ticks(0.3, 0.7, 40), {
14+
stroke: "black",
15+
r: 3.5,
16+
strokeWidth: 7,
17+
strokeOpacity: Plot.identity
18+
}).plot();
19+
}
20+
21+
export function opacityDotsUnscaled() {
22+
return Plot.dotX(d3.ticks(0.3, 0.7, 40), {
23+
fill: "black",
24+
r: 7,
25+
opacity: Plot.identity
26+
}).plot();
27+
}

0 commit comments

Comments
 (0)