{"action":"created","issue":{"url":"https://api.github.com/repos/novus/nvd3/issues/349","labels_url":"https://api.github.com/repos/novus/nvd3/issues/349/labels{/name}","comments_url":"https://api.github.com/repos/novus/nvd3/issues/349/comments","events_url":"https://api.github.com/repos/novus/nvd3/issues/349/events","html_url":"https://github.com/novus/nvd3/issues/349","id":22552043,"number":349,"title":"Updating with no data does not clear old data from the chart.","user":{"login":"jgrund","id":458717,"avatar_url":"https://avatars.githubusercontent.com/u/458717?v=3","gravatar_id":"","url":"https://api.github.com/users/jgrund","html_url":"https://github.com/jgrund","followers_url":"https://api.github.com/users/jgrund/followers","following_url":"https://api.github.com/users/jgrund/following{/other_user}","gists_url":"https://api.github.com/users/jgrund/gists{/gist_id}","starred_url":"https://api.github.com/users/jgrund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgrund/subscriptions","organizations_url":"https://api.github.com/users/jgrund/orgs","repos_url":"https://api.github.com/users/jgrund/repos","events_url":"https://api.github.com/users/jgrund/events{/privacy}","received_events_url":"https://api.github.com/users/jgrund/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2013-11-12T21:33:46Z","updated_at":"2015-01-12T10:17:33Z","closed_at":null,"body":"If a chart is populated with data and then update is called after the data has been emptied, the noData text will overlay the existing data.\r\n\r\nConsider if the current data should be cleared from the chart as it can be confusing to see both at the same time.\r\n\r\nTo reproduce (altered from http://nvd3.org/ghpages/multiBar.html):\r\n\r\n```\r\nvar chart;\r\nvar datas = data();\r\n\r\nnv.addGraph(function() {\r\n    chart = nv.models.multiBarChart();\r\n\r\n    chart.xAxis\r\n        .tickFormat(d3.format(',f'));\r\n\r\n    chart.yAxis\r\n        .tickFormat(d3.format(',.1f'));\r\n  \r\n    d3.select('#chart svg')\r\n        .datum(datas)\r\n      .transition().duration(500).call(chart);\r\n  \r\n    nv.utils.windowResize(chart.update);\r\n  \r\n    return chart;\r\n});\r\n\r\nwindow.setTimeout(function () {\r\n  datas.length = 0;\r\n  \r\n  chart.update();\r\n}, 3000);     \r\n``` "},"comment":{"url":"https://api.github.com/repos/novus/nvd3/issues/comments/69550176","html_url":"https://github.com/novus/nvd3/issues/349#issuecomment-69550176","issue_url":"https://api.github.com/repos/novus/nvd3/issues/349","id":69550176,"user":{"login":"liptga","id":1070360,"avatar_url":"https://avatars.githubusercontent.com/u/1070360?v=3","gravatar_id":"","url":"https://api.github.com/users/liptga","html_url":"https://github.com/liptga","followers_url":"https://api.github.com/users/liptga/followers","following_url":"https://api.github.com/users/liptga/following{/other_user}","gists_url":"https://api.github.com/users/liptga/gists{/gist_id}","starred_url":"https://api.github.com/users/liptga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liptga/subscriptions","organizations_url":"https://api.github.com/users/liptga/orgs","repos_url":"https://api.github.com/users/liptga/repos","events_url":"https://api.github.com/users/liptga/events{/privacy}","received_events_url":"https://api.github.com/users/liptga/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T10:17:33Z","updated_at":"2015-01-12T10:17:33Z","body":"I do simply this in my \"update\" function before calling the chart update function:\r\n```javascript\r\nif ( data.length == 0 ) {\r\n     d3.select('svg').html(\"\");\r\n}\r\n\r\n//do normal chart update call here...\r\n```\r\n\r\nYou may need to select your svg different way. In my case that was the only one in the frame."}}