Vega: Use values from "data" for a signal definition

Hello everyone,

I was wondering whether it is possible to use a specific value from "data" within a signal - for instance, to define the initial value of a slider. I tried this:

  "data": [
    {
      "name": "testvalue",
      "values": [{"first": "40"}]
    }
  ],
  "signals": [
    {
      "name": "testslider",
      "value": {"signal": "data('testvalue')[0].first"},
      "bind": {
        "input": "range",
        "min": 0,
        "max": 100,
        "step": 1
      }
    }
  ]

But it does not work - I get [Object object] as the initial value. However, this works perfectly fine in, for instance, x-coordinate-values within marks. Is there another solution to use values from other sources within signal definitions?

Thanks,
vega_user

Hi Anna,

I took a look into this a bit, but it's honestly a question that's probably best asked in the Vega forum. I'd drop it in there, as it's not a Kibana-specific question.

That said, I wasn't able to figure out how to get the signal's value to have access to the global data structures. "value": "datum" Worked, but it's not what you're looking for! I don't think that you can put the value { "signal": ...} Where you are. I think you need to put a direct expression there: "value": "time('Jan 1, 2008')" For example.

But as I said, the Vega folks should be able to answer this much better than I!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.