Skip to content

Commit

Permalink
no default identity fill if stroke channel
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed May 1, 2021
1 parent a720c1c commit ca998dd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
12 changes: 7 additions & 5 deletions src/marks/cell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {identity, indexOf, maybeTuple} from "../mark.js";
import {identity, indexOf, maybeColor, maybeTuple} from "../mark.js";
import {AbstractBar} from "./bar.js";

export class Cell extends AbstractBar {
Expand All @@ -25,10 +25,12 @@ export function cell(data, {x, y, ...options} = {}) {
return new Cell(data, {...options, x, y});
}

export function cellX(data, {x = indexOf, fill = identity, ...options} = {}) {
return new Cell(data, {...options, x, fill});
export function cellX(data, {x = indexOf, fill, stroke, ...options} = {}) {
if (fill === undefined && maybeColor(stroke)[0] === undefined) fill = identity;
return new Cell(data, {...options, x, fill, stroke});
}

export function cellY(data, {y = indexOf, fill = identity, ...options} = {}) {
return new Cell(data, {...options, y, fill});
export function cellY(data, {y = indexOf, fill, stroke, ...options} = {}) {
if (fill === undefined && maybeColor(stroke)[0] === undefined) fill = identity;
return new Cell(data, {...options, y, fill, stroke});
}
52 changes: 26 additions & 26 deletions test/output/highCardinalityOrdinal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/plots/high-cardinality-ordinal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function() {
type: "ordinal"
},
marks: [
Plot.cellX("ABCDEFGHIJKLMNOPQRSTUVWXYZ", {x: d => d})
Plot.cellX("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
]
});
}

0 comments on commit ca998dd

Please sign in to comment.