Skip to content

Commit cc1635c

Browse files
mbostockchaichontat
authored andcommitted
channel label override (observablehq#1838)
1 parent b70755c commit cc1635c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/mark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export class Mark {
4646
Object.entries(channels)
4747
.map(([name, channel]) => {
4848
if (isOptions(channel.value)) {
49-
// apply scale overrides
50-
const {value, scale = channel.scale} = channel.value;
51-
channel = {...channel, scale, value};
49+
// apply scale and label overrides
50+
const {value, label = channel.label, scale = channel.scale} = channel.value;
51+
channel = {...channel, label, scale, value};
5252
}
5353
if (data === singleton && typeof channel.value === "string") {
5454
// convert field names to singleton values for decoration marks (e.g., frame)

test/plots/tip-format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function tipFormatPairedLabel() {
6161
}
6262

6363
export async function tipFormatPairedLabelChannel() {
64-
return tip({length: 1}, {x1: Object.assign([0], {label: "Low"}), x2: Object.assign([1], {label: "High"})});
64+
return tip({length: 1}, {x1: {value: [0], label: "Low"}, x2: {value: [1], label: "High"}});
6565
}
6666

6767
export async function tipFormatPairedLabelScale() {

0 commit comments

Comments
 (0)