vegadeneb

Passing a Signal to another signal


I have a signal that defines the start of my data

{
  "name": "initialScrollStart",
  "init": "data('xExt').length > 0 ? data('xExt')[0].s : 0"
}

and I would like to pass it to another signal which is defined like so:

{
  "name": "scrollDomainStart",
  "value": 1711906200000,
  "on": [
    {
      "events": {"signal": "scrollTimer"},
      "update": "scrollRun ? scrollDomainStart + 600 : scrollDomainStart"
    },
  ]
}

currently the value is one that I hardcoded to be the value that is produced by the initial scroll start signal.

The idea here is that this starts at the start of my dataset and updates the bounds of the axis to act as if moving through a timeline. normally I'd be using the Init but this signal's value needs to be incrementing as well through update which is mutually exclusive with "init".

I've also tried adding a second update block to scroll domain start but it didn't seem to work.

    {
      "events": {"signal": "initialScrollStart"},
      "update": "initialScrollStart"
    }

Solution

  • Hmm, I guess the documentation is just a little confusing.

    {
          "name": "scrollDomainStart", "init":"initialScrollStart",
          "on": [
            {
              "events": {"signal": "scrollTimer"},
              "update": "scrollRun ? scrollDomainStart + 60000 : scrollDomainStart"
            }
          ]
        }
    

    init does work fine as the update is within the event handler rather than the properties of the signal.