Skip to content

Commit 7c15682

Browse files
authored
handle null lines (#2408)
* handle null lines * test dispatch case
1 parent 014f548 commit 7c15682

File tree

5 files changed

+858
-1
lines changed

5 files changed

+858
-1
lines changed

src/marks/tip.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ export class Tip extends Mark {
127127
format = formatChannels;
128128
}
129129

130+
// Format the tip text, skipping any nulls.
131+
const T = new Array(index.length);
132+
for (const i of index) T[i] = format.call(mark, i, index, sources, scales, values);
133+
index = index.filter((i) => T[i] != null);
134+
130135
// We don’t call applyChannelStyles because we only use the channels to
131136
// derive the content of the tip, not its aesthetics.
132137
const g = create("svg:g", context)
@@ -150,7 +155,7 @@ export class Tip extends Mark {
150155
this.setAttribute("fill-opacity", 1);
151156
this.setAttribute("stroke", "none");
152157
// iteratively render each channel value
153-
const lines = format.call(mark, i, index, sources, scales, values);
158+
const lines = T[i];
154159
if (typeof lines === "string") {
155160
for (const line of mark.splitLines(lines)) {
156161
renderLine(that, {value: mark.clipLine(line)});

0 commit comments

Comments
 (0)