Syntax Error "Unable to parse vega config to JSON"

I am concatenating a string in workshop to inject a value for a vega signal into the spec. I am using the / reference in the variable transformation in Workshop.

I and my dev collegues can see the resulting plot. All of our users cannot. They can see the objects and can even look in the workshop editing mode for the vegaSpec-String - which is correct. And still, the browser spits out the following error. The browser versions are exactly the same.

Copilot blames this section:

So it seems that the / referencing does not work the same for all users?

How is the number computed that is being injected into the spec? If you make that just a static numeric variable do they still see the issue? Another option is to write a function that returns your spec, that would help isolate whether the issue is with the variable transform concat logic.

That number comes from an numeric input widget which has 1.2 as the default static value…
Still, it is strange that it works for me and my peer developers but not for others. I have a lot of priviledges in the platform. Worst case, it has something to do with permissions? The user group can edit the workshop themselves though and I checked with the permissions feature that they can access all function references etc.

It’s true, it is very strange that this works for you and not others, and the only explanation feels like permissions. I get errors in the vega spec like this when there is an extra comma at the end of the final item of a list or object. The JSON parsing that is done here is not very forgiving in that way. Can you inspect the generated spec of the users and make sure there is nothing extraneous?

I just confirmed with the user that the variable transformation was the cause. Apparently, injecting the output of the numeric input widget caused inconsistent behavior where the dependency injection with / did not work properly… I will use a function to make sure this wont happen again, but I am also a little sad that it seems to be a fragile feature

What was being injected that caused it not to work? We are tracking a feature request internally to allow you to directly reference variables in your spec, and have added a +1 on your behalf, since that would mean you don’t need to use variable transforms.

1 Like

Sounds great! I wanted to parametrize the plot by assiging variables to vega signal values. In this particular case it was about setting a value for an annotation arrow on an axis.

Talking about feature requests, could you also create a feature parity to the vega inplementation in quiver? Workshop does not provide the ability to scale the chart to the div around it, and the svg exports are not there. Also, output signals for vega (not vega-lite) would be great <3

Best,
Florian

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