{"action":"created","issue":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/3349","repository_url":"https://api.github.com/repos/chartjs/Chart.js","labels_url":"https://api.github.com/repos/chartjs/Chart.js/issues/3349/labels{/name}","comments_url":"https://api.github.com/repos/chartjs/Chart.js/issues/3349/comments","events_url":"https://api.github.com/repos/chartjs/Chart.js/issues/3349/events","html_url":"https://github.com/chartjs/Chart.js/pull/3349","id":178642667,"number":3349,"title":"Adding padding by config to chart.js","user":{"login":"carlesnunez","id":5639972,"avatar_url":"https://avatars.githubusercontent.com/u/5639972?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesnunez","html_url":"https://github.com/carlesnunez","followers_url":"https://api.github.com/users/carlesnunez/followers","following_url":"https://api.github.com/users/carlesnunez/following{/other_user}","gists_url":"https://api.github.com/users/carlesnunez/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesnunez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesnunez/subscriptions","organizations_url":"https://api.github.com/users/carlesnunez/orgs","repos_url":"https://api.github.com/users/carlesnunez/repos","events_url":"https://api.github.com/users/carlesnunez/events{/privacy}","received_events_url":"https://api.github.com/users/carlesnunez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-22T15:30:47Z","updated_at":"2016-09-22T16:26:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chartjs/Chart.js/pulls/3349","html_url":"https://github.com/chartjs/Chart.js/pull/3349","diff_url":"https://github.com/chartjs/Chart.js/pull/3349.diff","patch_url":"https://github.com/chartjs/Chart.js/pull/3349.patch"},"body":"Hello all.\r\n\r\nAs I tell on #3257 and #3332 I've been investigated how to make a hotfix to  solve that. I saw three strange behaviors:\r\n\r\n1- The data breaks if have heavy changes, for example:\r\n````javascript\r\n[0, 10, 70, 30, 20, 12, 50, 200, 200, 200, 200, 200]\r\n````\r\n2- The 'error' is always the half of the height of our borderWidth.\r\n\r\n3- That error may was introduced when we changed the line 36 of core.layoutService.js on the next [COMMIT](https://github.com/chartjs/Chart.js/commit/798f643fab383872486880a6dc47ed181741f417)\r\n\r\nIn second place I saw two strange padding vars inside the function 'update' of the core.layoutService:\r\n\r\nAround the line 29 we have the function and on lines 35 and 36 we have the strange vars.\r\n````javascript\r\n// The most important function\r\n\t\tupdate: function(chartInstance, width, height) {\r\n\r\n\t\t\tif (!chartInstance) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar xPadding = 0;\r\n\t\t\tvar yPadding = 0;\r\n````\r\nI have been seen what the function does with that vars, specially with yPadding. I couldn't se any useful calc done with yPadding. In my opinion here is the problem. We always maintain the yPadding to 0 and IMHO it was an error applied in another version of that file [HERE](https://github.com/chartjs/Chart.js/commit/798f643fab383872486880a6dc47ed181741f417) .\r\n\r\nThe solution is that follows and I developed that because is the demand behind the developer of [that commit](https://github.com/chartjs/Chart.js/commit/798f643fab383872486880a6dc47ed181741f417) deleted the line.\r\n\r\nTHAT'S A HOTFIX, I WILL MAKE A PR AND IF IT IS APPROVED IT WILL BE THE SOLUTION\r\n\r\nIf you apply that code you will can set your padding on the styles config of the chart, also, if you don't apply any config he will take a default based on the chart height.\r\n\r\nConfig prop example:\r\n````javascript\r\npadding: {\r\n  x: 5,\r\n  y: 4\r\n},\r\n`````\r\nYou have more info on the code."},"comment":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/comments/248954910","html_url":"https://github.com/chartjs/Chart.js/pull/3349#issuecomment-248954910","issue_url":"https://api.github.com/repos/chartjs/Chart.js/issues/3349","id":248954910,"user":{"login":"carlesnunez","id":5639972,"avatar_url":"https://avatars.githubusercontent.com/u/5639972?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesnunez","html_url":"https://github.com/carlesnunez","followers_url":"https://api.github.com/users/carlesnunez/followers","following_url":"https://api.github.com/users/carlesnunez/following{/other_user}","gists_url":"https://api.github.com/users/carlesnunez/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesnunez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesnunez/subscriptions","organizations_url":"https://api.github.com/users/carlesnunez/orgs","repos_url":"https://api.github.com/users/carlesnunez/repos","events_url":"https://api.github.com/users/carlesnunez/events{/privacy}","received_events_url":"https://api.github.com/users/carlesnunez/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T16:26:12Z","updated_at":"2016-09-22T16:26:12Z","body":"The main objective of have the default data 2 and 5 is to avoid the problem of have charts out of bounds on charts with so different data."}}
{"actor":{"display_login":"carlesnunez"}}