Change value of a datum field using signal

Hi,
I'm trying to have data that are relative to each one of my data. I've tried to use signal's data but i didn't managed to make them relative to one and only one value of my data.

i decided to add a field in my data values. now i'm trying to change the value of this field but i can't find a way to do so.

I've tried :

"signals": [
    {
      "name": "color_changer",
      "value": "",
      "on": [
        {
          "events": "rect:click",
          "update": "datum.color === 'red' ? datum.color ='white' : datum.color ='red'"
        }
      ]
    }
  ],

But this does not work and result in a parsing error.

if anyone has an idea, some help would be appreciate. Thanks by advance.

@Dzious Thanks for the question!
I'm not familiar with Vega but I think going through the Vega docs for signals and expressions might help you out here.
I've used the examples from those docs in the past and they work great!

Hi @cheiligers,
Thanks for your help.
Unfortunately, due to technical limitations i've had to gave up the visualisation i was trying to build.
Since this vega was designed for a real time data visualisation, this means it would be needed to refresh it every X seconds making it impossible to save the state of each component between two refreshes
Still that's good to know and i'll have a look at it later on
Once again thanks and have a great day

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