parseSpec and selection #240
-
I'm trying to use parseSpec and pass it an selection that's created outside of the spec, so something: const globalSelection = vg.Selection.intersect();
const specs = {
plot: [
{
mark: "areaY",
data: {
from: "kpis",
filterBy: "global",
},
x: "date",
y: "visits",
stroke: "steelblue"
},
],
};
vg.parseSpec(
{
...specs,
params: {
global: { select: "intersect" },
},
},
{
options: { params: [["global", globalSelection]] },
}
); when I try Is that possible, or am I using mosaic wrong? For context, I'm trying to create a date filter that would update all my clients to filter the same date range. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
In your spec,
Correction: The above is not true, Here is a working example. I believe this is the relevant code IMO |
Beta Was this translation helpful? Give feedback.
In your spec,
filterBy: "$global"
is correct.But your params may not be.
Try removing
options
and use justparams
Correction: The above is not true,
$
is not needed. see comment below.Here is a working example.
https://github.com/mingfang/mosaic-svelte/blob/master/src/routes/mosaic/%2Bpage.svelte#L35
I believe this is the relevant code
https://github.com/uwdata/mosaic/blob/main/packages/vgplot/src/spec/parse-spec.js#L374
IMO
I don't agree that we should be forced to use
$
for selections.Also the
$
conflicts with Svelte's use of$
.