Vega mark vs view mouseout events - vega

I'm trying to write a Vega signal that stores data when you mouseover a particular mark, and then resets when you mouseout from the entire view.
I tried the following:
{
"name": "mysignal",
"on": [
{
"events": {
"source": "scope",
"type": "mouseover",
"markname": "layer_0_layer_0_marks"
},
"update": "datum"
},
{"events": {"source": "view", "type": "mouseout"}, "update": "null"}
]
}
But when you mouseout of the mark specified the signal gets set back to null, even though I didn't mouseout of the entire view. I have a full spec in the editor link below so you can observe the behaviour I'm talking about. My question is: Is there a way to prevent the signal from being set to null on mouseout from the mark, so that it only gets reset on mouseout from the whole view.
Open the Chart in the Vega Editor

Related

How to update the pop-up note via API

I'm trying to update the pop-up note via the API. I can easily update the top box (aka the Note) but I don't see how I go about updating the pop-up section. What's odd to me is that the Note doesn't even appear in the WSE, abut when I send the update it does work.
When I retrieve the record, it also doesn't appear to send the data that I have in the pop-up section, and I'm not even clear how I can add it to the WSE.
I've tried just adding it to the JSON update with a couple different names like this (tried popupnote, notepopup), and that still goes through, but only updates the top box:
"note": {
"value": "Travis Update Test!"
},
"notepopup": {
"value": "Travis Pop update Test!"
},
Anyone know if this is possible?
The answer from Acumatica Support is below. In short you need to add a custom field in the items sectionm for the 2 notes and it works perfectly. When loading the items, if you plan to serialize into this class, add this ?$custom=Item.NoteText,Item.NotePopupText to the end of your url:
{
"id": "2a113b2c-d87f-e411-beca-00b56d0561c2",
"custom": {
"Item": {
"NoteText": {
"type": "CustomStringField",
"value": "Regular note 2"
},
"NotePopupText": {
"type": "CustomStringField",
"value": "Popup note 2"
}
}
}
}

How to restructure positions of product media or remove all images using product api in Shopware

So I have an product and want to change the position of its images and swap the cover image, while adding some more images to the medias assigned to the product.
The media should look somewhat like this:
{
"media": [
{
"id": "a060944a2938442c8d461b3a0107ecf5",
"mediaId": "722d194bfbb84dc489f9f5b74da53bb3",
"position": 1
},
{
"id": "b060944a2938442c8d461b3a0107ecf6",
"mediaId": "822d194bfbb84dc489f9f5b74da53bb4",
"position": 2
}
],
"coverId": "a060944a2938442c8d461b3a0107ecf5"
}
and change to this:
{
"media": [
{
"id": "a060944a2938442c8d461b3a0107ecf5",
"mediaId": "722d194bfbb84dc489f9f5b74da53bb3",
"position": 3
},
{
"id": "b060944a2938442c8d461b3a0107ecf6",
"mediaId": "822d194bfbb84dc489f9f5b74da53bb4",
"position": 2
},
{
"id": "c060944a2938442c8d461b3a0107ecf7",
"mediaId": "922d194bfbb84dc489f9f5b74da53bb5",
"position": 1
}
],
"coverId": "b060944a2938442c8d461b3a0107ecf6"
}
I couldn't find a way to restructure the media positions and change the cover image.
So I tried to remove the media from the product, but the cover image stills stays even though the medias aren't connected to the product any more.
Also an UPDATE on the coverId doesn't seem to do the job either.
I used this to remove the images:
DELETE https://your-page.com/api/product/5efd4f22dc134ba7bf77c85f92fed0a9/media/b060944a2938442c8d461b3a0107ecf6
cover and media are two separate associations, so removing all media associations can still leave the cover association intact.
new ManyToOneAssociationField('cover', 'product_media_id', ProductMediaDefinition::class, 'id')
new OneToManyAssociationField('media', ProductMediaDefinition::class, 'product_id')
Notice how both refer to the definition ProductMediaDefinition. That means for coverId you have to provide the id of an existing product_media entity, not of a media entity.
If you have the id of a media entity, you can also create the product_media entity on the fly:
{
"id": "{productId}",
"cover": {
"mediaId": "{mediaId}"
}
}
If you want to remove the cover image without setting a new one, you can set coverId to null.

How to move tabs in Visual Studio Code with the keyboard?

I found the documentation here and here (under moveActiveEditor) for moving tabs, but I have trouble creating a key binding for it.
I created the following (for a Mac, so it uses cmd):
[
{
"key": "alt+cmd+right",
"command": "moveActiveEditor",
"args": {
"to": "position",
"value": i + 1
}
}
]
But when I hit that key command, the tab moves to the first tab position instead of moving one tab position to the right. So clearly, the value of i is 0, meaning it isn't returning the correct value of the current tab.
How can I get this to work?
You need to replace position with right and remove the value attribute:
[
{
"key": "alt+cmd+right",
"command": "moveActiveEditor",
"args": {
"to": "right"
}
}
]

Nested JSON and duplicate entries in Sencha Touch

We have a JSON string of articles, where each article has comments. Also, both the article and the comments contain the author/commenter information.
Because Sencha is using "id" as a model key, after Sencha loads the JSON (as shown below) the first article contains article.user but its comment objects do not contain it, e.g. comment.user does not exist. The question is how can we avoid that issue?
One approach we tried is to remove the id field from the user model and the JSON. Then, Sencha will create its own id values and in that case all the data is loaded. However, it seems that if we made a change to the article.user object we wouldn't see that change in the other user objects that (we know) correspond to the same user.
Another approach which would save bandwidth and solve the previous problem is to avoid having (potentially) multiple copies of the same user object by having a pointer to the object for those cases. In this case, the user object of the article would be loaded but the other instances would only contain a pointer to that object. The problem here is that we cannot remove the initial object.
What would be the standard way to approach this problem in Sencha Touch (2)?
{"articles": [
{
"id": "14338138",
"user_id": "1",
"title": "test",
"user": {
"id":"1545"
"first_name": "Joe",
"last_name": "Kae",
"status":"1"
},
"comments": [
{
"id": "1545",
"article_id": "14338138",
"says":"This is my first comment to my own article.",
"user": {
"id":"42",
"first_name": "Joe",
"last_name": "Kae",
"status": "1"
}
},
{
"id": "1546",
"article_id": "14338138",
"says":"This is my second comment to my own article.",
"user": {
"id":"42",
"first_name": "Joe",
"last_name": "Kae",
"status": "1"
}
}
]
}
]
});
Take a look at Sencha Docs Data.Association

Google Places API's search results with huge viewports

I have been trying out Google's new Places API. It's "Places Search" returns a list of places close to the latitude/longitude you provide. Each of the results has its actual lat/lang, and some also have "viewports", which are supposed to be the bounding boxes of larger places like stadiums and malls. However, inspecting the viewports on the map, they are way too big. For example, here is a query (it won't work because it doesn't have a real key):
https://maps.googleapis.com/maps/api/place/search/json?location=47.5932,-122.3318&radius=300&sensor=false&key=FOO
Here is part of the result JSON:
{
"status": "OK",
"results": [ {
"name": "Qwest Field",
"vicinity": "Occidental Ave S, Seattle",
"types": [ "stadium", "establishment" ],
"geometry": {
"location": {
"lat": 47.5959329,
"lng": -122.3317095
},
"viewport": {
"southwest": {
"lat": 47.5884079,
"lng": -122.3477169
},
"northeast": {
"lat": 47.6034568,
"lng": -122.3157021
}
}
},
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/stadium-71.png",
"reference": "CnRrAAAAwM6Pr_ER4VDFNlwg4_JrMxG9FGaqAXokpQXGot9OqzylWRX_NIPsptuMoIeHej9GUDp5otUTQifL-kyP5l0AM5u93PTV22U7-Xz-y_dHuWAjetviEBlo24JIGgWcnuExlE1FBh2FKkNzCdpyUdv7PRIQodCSeacFJtrl8ZkZ1wvfvxoUFCIvCrbknO6tEl3EewS1wrjl06M",
"id": "d4fd94323d3f462730123ac2c5eb91d0180bb819"
},
...
If you look at the lat/langs for the two corners, they are way apart.
I tried a few other places and they all had this problem. Has anybody noticed the same issue?
The 'viewport' property does not represent the bounding box of the place. It represents the recommended map view to use when displaying this place on a Google map. For large features, such as a state or a city it may approximate to the bounds of the feature, but for small features there is a minimum size (~500m across) that is returned, so that the map shows a wide enough area around the feature for a user to understand the location of the place in context.
Hope that helps,
Thor.