[Kibana/Vega] Map signals latitude, longitude & zoom

Hi,

I'm trying to modify the values of the latitude, longitude and zoom signals in order to have a global view of France and then, after a certain time (5s), zoom on a city (Paris in the example below). And back to the original view, and zoom, ...
And I'm getting various results, but not the one I want.

Here's the code:

{
	$schema:https://vega.github.io/schema/vega/v5.17.0.json

	config:{
		kibana:{
			type:map
			zoom:5.5
			latitude:46.5
			longitude:3.15
			delayRepaint:true
		}
	}

	signals:[
		{name:"scheduler",init:'0',on:[{events:"timer{5000}",update:"if(scheduler==2,0,scheduler+1)"}]}
		{name:"longitude",update:"if(scheduler=='0'||scheduler=='2',3.15,2.325)"}
		{name:"latitude",update:"if(scheduler=='0'||scheduler=='2',46.5,45.61)"}
		{name:"zoom",update:"if(scheduler=='0'||scheduler=='2',5.5,10)"}
	]
}

When checking the signal values with VEGA_DEBUG.view.getState(), they are coherent with the code but the visualisation doesn't follow.
Each signal change independently functions.
But if I try all of them at the same time, depending on their order in the signals block, I can see a mix of changes (ex.: only zoom, or zoom and latitude but not longitude...) but not all three.
Tried by using a different timer signal for each signal, but no change.

Also, when for example latitude and longitude changes are taken into account, I see the visualisation move first for latitude, then for longitude. The visualisation doesn't "jump" directly to the new (latitude, longitude).
Is there a way to make the move "smoothly"?

Regards.

This question might be better suited on the Vega GitHub Issues page.

If you look at this in the Vega Editor and click on Signal View and Record Signal Changes you can see they all change independently so it appears that is normal functionality built into Vega.

My only guess right now would possibly make the data into an array and just call the specific element. So the data would all update at the same time and you just reference the element you needed. Not even sure if that's possible, just saying that is what I would explore.

Hi,

Thanks for the answer.
Not used to the Vega Editor, I'll have a look at it.
And post an issue on Vega GitHub.

Regards.

Hi,

I took a closer look at the vega documentation and it seems that signals are updated sequentially. So the behaviour is normal...

Still I managed to do what I wanted by creating the following signal:

{name:"sigrepaintMap",on:[{events:"timer{2000}",update:"setMapView([sigLongitude,sigLatitude],sigZoom)"}]}

setMapView() modifies all three signals at the same time.

The info was found here: GitHub - nyurik/leaflet-vega: Leaflet layer based on Vega visualization grammar.

Regards.

1 Like

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