Skip to content

Which fields can contain param references when using parseSpec? #261

Answered by jheer
rickiesmooth asked this question in Q&A
Discussion options

You must be logged in to vote

Good question! Currently the mark logic treats Param values as scalars, so a string value is interpreted as a string literal as opposed to a column name. I think that is why you are seeing an error here.

Here is an alternative setup:

{
  await vg.coordinator().exec(
    vg.loadObjects('kpis', [
      { date: 1, visits: 5, clicks: 3 },
      { date: 2, visits: 10, clicks: 5 },
      { date: 3, visits: 7, clicks: 4 }
    ])
  );

  const globalSelection = vg.Selection.single();
  
  const kpi = vg.Param.value(vg.column('visits')); // value is explicitly a column
  const color = vg.Param.value('steelblue');
  
  return vg.plot(
    vg.lineY(vg.from('kpis', { filterBy: globalSelection }), {

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@rickiesmooth
Comment options

@mhkeller
Comment options

Answer selected by rickiesmooth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants