{"action":"created","issue":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/8277","repository_url":"https://api.github.com/repos/bokeh/bokeh","labels_url":"https://api.github.com/repos/bokeh/bokeh/issues/8277/labels{/name}","comments_url":"https://api.github.com/repos/bokeh/bokeh/issues/8277/comments","events_url":"https://api.github.com/repos/bokeh/bokeh/issues/8277/events","html_url":"https://github.com/bokeh/bokeh/issues/8277","id":363693138,"node_id":"MDU6SXNzdWUzNjM2OTMxMzg=","number":8277,"title":"bokehjs - glyph renderer sticks to the length of the dataset with which it was initialized","user":{"login":"jayesh-bhoot","id":1915507,"node_id":"MDQ6VXNlcjE5MTU1MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/1915507?v=4","gravatar_id":"","url":"https://api.github.com/users/jayesh-bhoot","html_url":"https://github.com/jayesh-bhoot","followers_url":"https://api.github.com/users/jayesh-bhoot/followers","following_url":"https://api.github.com/users/jayesh-bhoot/following{/other_user}","gists_url":"https://api.github.com/users/jayesh-bhoot/gists{/gist_id}","starred_url":"https://api.github.com/users/jayesh-bhoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayesh-bhoot/subscriptions","organizations_url":"https://api.github.com/users/jayesh-bhoot/orgs","repos_url":"https://api.github.com/users/jayesh-bhoot/repos","events_url":"https://api.github.com/users/jayesh-bhoot/events{/privacy}","received_events_url":"https://api.github.com/users/jayesh-bhoot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-25T17:38:40Z","updated_at":"2018-12-24T19:50:53Z","closed_at":null,"author_association":"NONE","body":"### Software version info\r\n\r\nVersion: **bokehjs** 0.13.0 (used standalone, without its python counterpart)\r\nBrowsers: Firefox, Chromium at least\r\n\r\n### Observed behaviour\r\n\r\nOnce initialized with a dataset (ColumnDataSource) of a certain length, a glyph renderer (I tried line and circle) sticks to that length as a ceiling for subsequent updates to the datasource. For examples,\r\n\r\n1. If initialized with dataset of length 0, `{x: [], y: []}`, the glyph renderer never plots a glyph no matter how many times you update the underlying datasource.\r\n\r\n2. If initialized with dataset of length 5, the renderer will always plot only the first 5 datapoints.\r\n\r\n### Expected Behaviour\r\n\r\nThe initial dataset length should not matter to any subsequent updates. The renderer should plot whatever length of dataset updates are passed to it, provided that the basic assumption of equal column length is honoured.\r\n\r\n### Example Code\r\n\r\nThis issue is best demonstrated in this jsfiddle: http://jsfiddle.net/bLgj4vc7/3/\r\n\r\nMore details on the related stackoverflow question and discovery of this bug posted as an answer: https://stackoverflow.com/questions/52463345/renderer-not-updating-glyph-on-plot-in-bokehjs/52503686\r\n\r\n### Current workaround\r\n\r\ninitialize the renderer with a dataset filled with NaNs, which has a length equal or more than the maximum number of datapoints you want to plot for a single dataseries.\r\n\r\nSo, if in a line glyph, I wish to plot maximum 100 datapoints, then:\r\n\r\n````\r\nconst plot = Bokeh.Plotting.figure()\r\n\r\nconst maxDataPoints = 100 // maximum number of points I want for this glyph\r\nconst emptyData = Array().fill().map(_ => NaN)\r\nconst cds = new Bokeh.ColumnDataSource({x: emptyData, y: emptyData})  \r\nconst renderer = plot.line({field: 'x'}, {field: 'y'}, {source: cds, line_width: 2})\r\n\r\n// now any subsequent updates to datasource of renderer will update its glyph on the plot.\r\nrenderer.data_source.data = {\r\n  x: dataLengthLessOrEqualToMaxDataPoints.x,\r\n  y: dataLengthLessOrEqualToMaxDataPoints.y\r\n}\r\n````"},"comment":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/comments/449766858","html_url":"https://github.com/bokeh/bokeh/issues/8277#issuecomment-449766858","issue_url":"https://api.github.com/repos/bokeh/bokeh/issues/8277","id":449766858,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTc2Njg1OA==","user":{"login":"complyue","id":15646573,"node_id":"MDQ6VXNlcjE1NjQ2NTcz","avatar_url":"https://avatars2.githubusercontent.com/u/15646573?v=4","gravatar_id":"","url":"https://api.github.com/users/complyue","html_url":"https://github.com/complyue","followers_url":"https://api.github.com/users/complyue/followers","following_url":"https://api.github.com/users/complyue/following{/other_user}","gists_url":"https://api.github.com/users/complyue/gists{/gist_id}","starred_url":"https://api.github.com/users/complyue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/complyue/subscriptions","organizations_url":"https://api.github.com/users/complyue/orgs","repos_url":"https://api.github.com/users/complyue/repos","events_url":"https://api.github.com/users/complyue/events{/privacy}","received_events_url":"https://api.github.com/users/complyue/received_events","type":"User","site_admin":false},"created_at":"2018-12-24T19:50:53Z","updated_at":"2018-12-24T19:50:53Z","author_association":"NONE","body":"I found it may because that at https://github.com/bokeh/bokeh/blob/0ea25b0117f2983a0a9487b85f957a79d6e386e8/bokehjs/src/lib/models/sources/cds_view.ts#L59\r\n, `this.source` is still `null`, don't know why but thus there's another workaround as well:\r\n```js\r\nconst renderer = plot.line({field: 'x'}, {field: 'y'}, {source: cds, line_width: 2})\r\nrenderer.view.connect_signals(); \r\n```\r\n"}}
{"actor":{"display_login":"complyue"}}