question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Signal scale updates on initialization

See original GitHub issue

I would like to have a signal that computes scaled coordinates once, when the scale is initialized with a valid domain and range, and then no longer reacts to any further updates to the scale.

In the following spec, if react is true, only a single warning is printed which suggests that the signal is correctly marked as dependent on the scale. However, setting react to false produces a single [undefined, undefined] which suggests that the signal is no longer being topologically evaluated after the scales are initialized? It’s unclear to me if this is a bug or by design and, if the latter, how I would accomplish my desired outcome.

{
  "$schema": "https://vega.github.io/schema/vega/v4.json",
  "width": 200,
  "height": 200,
  "data": [
    {
      "name": "source_0",
      "url": "data/cars.json"
    }
  ],
  "signals": [
    {
      "name": "box_x",
      "update": "warn('box_x', [scale(\"x\", 100),scale(\"x\", 150)])",
      "react": false
    }
  ],
  "scales": [
    {
      "name": "x",
      "type": "linear",
      "domain": {"data": "source_0", "field": "Horsepower"},
      "range": [0, {"signal": "width"}]
    }
  ]
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jheercommented, Oct 18, 2018

There are internal use cases for bridging event streams with the dataflow graph, but no JSON-spec level use cases I know of other than initialization.

0reactions
jheercommented, Mar 15, 2019

Addressed with the init signal property, released in Vega v4.4.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initialize a bound signal with expression · Issue #1435 - GitHub
I need to be able to initialize bound signals using an expression. ... Signal scale updates on initialization #1433.
Read more >
Initialization of Signal, State, and Parameter Data ... - MathWorks
Model a system that reinitializes states during execution, which means that the application can restart the entire system. · Store initial values in...
Read more >
Extreme Memorization via Scale of Initialization - OpenReview
Our empirical investigation reveals that increasing the scale of initialization correlates with misalignment of representations and gradients across examples ...
Read more >
Signals | Vega
≥ 4.4 An initialization expression for the value of the signal. This expression will be invoked once and only once. The init and...
Read more >
vega - Changing domain or label from signal more than once
When vegaEmbed first initializes from the spec, everything comes up fine. In the javascript console, the signal update expression prints out the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found