{"action":"closed","issue":{"url":"https://api.github.com/repos/nnnick/Chart.js/issues/1312","labels_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1312/labels{/name}","comments_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1312/comments","events_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1312/events","html_url":"https://github.com/nnnick/Chart.js/issues/1312","id":95138890,"number":1312,"title":"Clear canvas before write chart","user":{"login":"meron1122","id":2895090,"avatar_url":"https://avatars.githubusercontent.com/u/2895090?v=3","gravatar_id":"","url":"https://api.github.com/users/meron1122","html_url":"https://github.com/meron1122","followers_url":"https://api.github.com/users/meron1122/followers","following_url":"https://api.github.com/users/meron1122/following{/other_user}","gists_url":"https://api.github.com/users/meron1122/gists{/gist_id}","starred_url":"https://api.github.com/users/meron1122/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meron1122/subscriptions","organizations_url":"https://api.github.com/users/meron1122/orgs","repos_url":"https://api.github.com/users/meron1122/repos","events_url":"https://api.github.com/users/meron1122/events{/privacy}","received_events_url":"https://api.github.com/users/meron1122/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-15T08:55:34Z","updated_at":"2015-12-25T22:58:01Z","closed_at":"2015-12-25T22:58:01Z","body":"I use code like this\r\n```javascript\r\n$.ajax({\r\n        type: \"GET\",\r\n        url: url,\r\n        dataType: \"json\",\r\n        error: function () {\r\n            showFlash(\"error\", \"Wystąpił nieoczekiwany błąd podczas pobierania wykresu\");\r\n        },\r\n        statusCode: {\r\n            200: function (data) {\r\n                $(\".stat-pie-chart-panel\").show();\r\n                // Get the context of the canvas element we want to select\r\n                var ctx = document.getElementById(\"hoursPerDateUserCanvas\").getContext(\"2d\");\r\n                var hoursPerUserToday = new Chart(ctx).Pie(data, {\r\n                    responsive: true,\r\n                    //maintainAspectRatio: !2,\r\n                    tooltipTemplate: function (valuesObject) {\r\n                        // do different things here based on whatever you want;\r\n                        var hours = Math.floor(valuesObject.value / 60);\r\n                        var minutes = valuesObject.value % 60;\r\n                        return valuesObject.label + \" (\" + ((hours < 10 && hours >= 0) ? '0' : '') + hours +\r\n                            \":\" + ((minutes < 10 && minutes >= 0) ? '0' : '') + minutes + \")\";\r\n                    }\r\n                });\r\n\r\n            }\r\n        }\r\n    });\r\n```\r\nAjax request -> draw chart.\r\nIt's works fine but if I call AJAX once again chart was written in front of old, and i have some buggy view.\r\nMaybe before libary draw chart, it should clear canvas?"}}