{"action":"created","issue":{"url":"https://api.github.com/repos/vega/vega/issues/1305","repository_url":"https://api.github.com/repos/vega/vega","labels_url":"https://api.github.com/repos/vega/vega/issues/1305/labels{/name}","comments_url":"https://api.github.com/repos/vega/vega/issues/1305/comments","events_url":"https://api.github.com/repos/vega/vega/issues/1305/events","html_url":"https://github.com/vega/vega/issues/1305","id":327088296,"number":1305,"title":"Removing line marks from the scenegraph once thier datum is removed.","user":{"login":"rmcgregor1990","id":7824682,"avatar_url":"https://avatars3.githubusercontent.com/u/7824682?v=4","gravatar_id":"","url":"https://api.github.com/users/rmcgregor1990","html_url":"https://github.com/rmcgregor1990","followers_url":"https://api.github.com/users/rmcgregor1990/followers","following_url":"https://api.github.com/users/rmcgregor1990/following{/other_user}","gists_url":"https://api.github.com/users/rmcgregor1990/gists{/gist_id}","starred_url":"https://api.github.com/users/rmcgregor1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmcgregor1990/subscriptions","organizations_url":"https://api.github.com/users/rmcgregor1990/orgs","repos_url":"https://api.github.com/users/rmcgregor1990/repos","events_url":"https://api.github.com/users/rmcgregor1990/events{/privacy}","received_events_url":"https://api.github.com/users/rmcgregor1990/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-28T17:53:10Z","updated_at":"2018-05-28T19:03:02Z","closed_at":null,"author_association":"NONE","body":"Hey,\r\n\r\nI'm trying to make a live line plot with a scrolling window of the last 30 seconds on the x axis.\r\nMy spec looks like this:\r\n```json\r\n{\r\n  \"$schema\": \"https://vega.github.io/schema/vega/v3.json\",\r\n  \"autosize\": \"pad\",\r\n  \"padding\": 20,\r\n  \"signals\": [\r\n    {\r\n      \"name\": \"xDomain\",\r\n      \"value\": [\r\n        0,\r\n        0\r\n      ]\r\n    }\r\n  ],\r\n  \"data\": [\r\n    {\r\n      \"name\": \"livedata\"\r\n    }\r\n  ],\r\n  \"scales\": [\r\n    {\r\n      \"name\": \"time\",\r\n      \"type\": \"time\",\r\n      \"range\": \"width\",\r\n      \"domain\": {\r\n        \"signal\": \"xDomain\"\r\n      }\r\n    },\r\n    {\r\n      \"name\": \"y\",\r\n      \"type\": \"linear\",\r\n      \"range\": \"height\",\r\n      \"domain\": {\r\n        \"data\": \"livedata\",\r\n        \"field\": \"y\"\r\n      }\r\n    }\r\n  ],\r\n  \"axes\": [\r\n    {\r\n      \"orient\": \"bottom\",\r\n      \"scale\": \"time\"\r\n    },\r\n    {\r\n      \"orient\": \"left\",\r\n      \"scale\": \"y\"\r\n    }\r\n  ],\r\n  \"marks\": [\r\n    {\r\n      \"type\": \"line\",\r\n      \"from\": {\r\n        \"data\": \"livedata\"\r\n      },\r\n      \"clip\": true,\r\n      \"encode\": {\r\n        \"update\": {\r\n          \"x\": {\r\n            \"scale\": \"time\",\r\n            \"field\": \"time\"\r\n          },\r\n          \"y\": {\r\n            \"scale\": \"y\",\r\n            \"field\": \"y\"\r\n          },\r\n          \"defined\": {\r\n            \"signal\": \"datum.time > xDomain[0]\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\nI'm achieving the live time scrolling animation by updating the ```xDomain``` signal with\r\n```javascript\r\nview.signal(\"xDomain\", [Date.now() - 30e3 -200, Date.now() - 200]);\r\n``` \r\nvia the view API and calling .run() in the browser ```requestAnimationFrame``` callback.\r\n\r\nThe backing data source ```livedata``` is updated every ~100ms via the view API call:\r\n```javascript\r\nview.change('livedata', view.changeset().remove(()=>true).insert(livedata))\r\n```\r\nHere the ```livedata``` variable only contains the last ~30sec of the stream with old data being dropped.\r\n\r\nThis initially works pretty well, the data is smoothly plotted over time (which each re-render taking ~4ms on my machine).\r\nHowever when left for any period of time it becomes very sluggish with the render time steadily increasing. I believe this is due to the marks on the scene-graph not being removed even after the data backing them has gone. Hence they build up over time and bring the renderer to its knees.\r\n\r\nSo my Question is:\r\nIs there any way to removed marks from the scene-graph after their datum has gone?\r\n\r\nI'm basically looking for something akin to d3s\r\n```javascript\r\n.exit().remove()\r\n```\r\nI however not find anything in the documentation regarding this.\r\n\r\nCheers,\r\nRob"},"comment":{"url":"https://api.github.com/repos/vega/vega/issues/comments/392587792","html_url":"https://github.com/vega/vega/issues/1305#issuecomment-392587792","issue_url":"https://api.github.com/repos/vega/vega/issues/1305","id":392587792,"user":{"login":"rmcgregor1990","id":7824682,"avatar_url":"https://avatars3.githubusercontent.com/u/7824682?v=4","gravatar_id":"","url":"https://api.github.com/users/rmcgregor1990","html_url":"https://github.com/rmcgregor1990","followers_url":"https://api.github.com/users/rmcgregor1990/followers","following_url":"https://api.github.com/users/rmcgregor1990/following{/other_user}","gists_url":"https://api.github.com/users/rmcgregor1990/gists{/gist_id}","starred_url":"https://api.github.com/users/rmcgregor1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmcgregor1990/subscriptions","organizations_url":"https://api.github.com/users/rmcgregor1990/orgs","repos_url":"https://api.github.com/users/rmcgregor1990/repos","events_url":"https://api.github.com/users/rmcgregor1990/events{/privacy}","received_events_url":"https://api.github.com/users/rmcgregor1990/received_events","type":"User","site_admin":false},"created_at":"2018-05-28T19:03:02Z","updated_at":"2018-05-28T19:03:02Z","author_association":"NONE","body":"Yeah I'm pretty sure its the marks not being pruned.\r\nHere's a graph of length of the data source vs the length of the marks array within the scenegraph:\r\n![marks](https://user-images.githubusercontent.com/7824682/40626652-e097c7bc-62b1-11e8-8d4a-d94352d5e88c.png)\r\n"}}
{"actor":{"display_login":"rmcgregor1990"}}