Plot conditional control over marks?

This there a way to have to plots conditional?

I have a check box the returns a flag but I can’t work out how to get the marks conditional.

The statement I have:

marks: [
    Plot.ruleY([120]), Plot.ruleX([-80]),, {x1: "x1", y1: "y1", x2: "x2", y2: "y2", stroke: "rgba(0,0,0,.03)"}),, dotOptions),

I tried: => (check=='yes')?data.lines:null, {x1: "x1", y1: "y1", x2: "x2", y2: "y2", stroke: "rgba(0,0,0,.03)"}),
// and, () => (check=='yes')?{x1: "x1", y1: "y1", x2: "x2", y2: "y2", stroke: "rgba(0,0,0,.03)"},{}),

But no luck.

you could try two things: one, have [] as data:‘yes’) ? data.lines : [], options)

the second, to remove the mark altogether:

check==‘yes’ ?, options) : []

let me know if this works for you

1 Like

Thanks, I was not checking my array correctly as checkboxes uses arrays, so I needed to do


Perhaps you want to use Inputs.toggle instead, since it returns a Boolean?

1 Like

I always forget this one too.

I had more that one condition so used checkboxes here.