{"action":"created","issue":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/5776","repository_url":"https://api.github.com/repos/chartjs/Chart.js","labels_url":"https://api.github.com/repos/chartjs/Chart.js/issues/5776/labels{/name}","comments_url":"https://api.github.com/repos/chartjs/Chart.js/issues/5776/comments","events_url":"https://api.github.com/repos/chartjs/Chart.js/issues/5776/events","html_url":"https://github.com/chartjs/Chart.js/pull/5776","id":372024098,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0MzM5NjEw","number":5776,"title":"Make legend layouting respect padding at the start of columns","user":{"login":"jtagscherer","id":3198913,"node_id":"MDQ6VXNlcjMxOTg5MTM=","avatar_url":"https://avatars0.githubusercontent.com/u/3198913?v=4","gravatar_id":"","url":"https://api.github.com/users/jtagscherer","html_url":"https://github.com/jtagscherer","followers_url":"https://api.github.com/users/jtagscherer/followers","following_url":"https://api.github.com/users/jtagscherer/following{/other_user}","gists_url":"https://api.github.com/users/jtagscherer/gists{/gist_id}","starred_url":"https://api.github.com/users/jtagscherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtagscherer/subscriptions","organizations_url":"https://api.github.com/users/jtagscherer/orgs","repos_url":"https://api.github.com/users/jtagscherer/repos","events_url":"https://api.github.com/users/jtagscherer/events{/privacy}","received_events_url":"https://api.github.com/users/jtagscherer/received_events","type":"User","site_admin":false},"labels":[{"id":32309884,"node_id":"MDU6TGFiZWwzMjMwOTg4NA==","url":"https://api.github.com/repos/chartjs/Chart.js/labels/type:%20bug","name":"type: bug","color":"dd3300","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/chartjs/Chart.js/milestones/18","html_url":"https://github.com/chartjs/Chart.js/milestone/18","labels_url":"https://api.github.com/repos/chartjs/Chart.js/milestones/18/labels","id":3657117,"node_id":"MDk6TWlsZXN0b25lMzY1NzExNw==","number":18,"title":"Version 2.8","description":"[Release Notes](/chartjs/Chart.js/releases/tag/v2.8)","creator":{"login":"simonbrunel","id":3874900,"node_id":"MDQ6VXNlcjM4NzQ5MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/3874900?v=4","gravatar_id":"","url":"https://api.github.com/users/simonbrunel","html_url":"https://github.com/simonbrunel","followers_url":"https://api.github.com/users/simonbrunel/followers","following_url":"https://api.github.com/users/simonbrunel/following{/other_user}","gists_url":"https://api.github.com/users/simonbrunel/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbrunel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbrunel/subscriptions","organizations_url":"https://api.github.com/users/simonbrunel/orgs","repos_url":"https://api.github.com/users/simonbrunel/repos","events_url":"https://api.github.com/users/simonbrunel/events{/privacy}","received_events_url":"https://api.github.com/users/simonbrunel/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":14,"state":"open","created_at":"2018-09-16T09:41:05Z","updated_at":"2018-11-02T07:46:11Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2018-10-19T16:13:33Z","updated_at":"2018-11-09T17:30:34Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/chartjs/Chart.js/pulls/5776","html_url":"https://github.com/chartjs/Chart.js/pull/5776","diff_url":"https://github.com/chartjs/Chart.js/pull/5776.diff","patch_url":"https://github.com/chartjs/Chart.js/pull/5776.patch"},"body":"The `draw` function of chart legends introduces a vertical padding at the very beginning of each column:\r\n\r\nhttps://github.com/chartjs/Chart.js/blob/5816770e459284847be10d1d0c00e5a4ee2b8434/src/plugins/plugin.legend.js#L420-L424\r\n\r\nBefore individual items of a legend are being drawn, the `fit` function performs some layouting. This includes the calculation of how many columns of items will be needed to fit all items into a vertical legend. However, this calculation does not consider the aforementioned initial column padding. Instead, all new columns are assigned a height of `0`:\r\n\r\nhttps://github.com/chartjs/Chart.js/blob/5816770e459284847be10d1d0c00e5a4ee2b8434/src/plugins/plugin.legend.js#L272-L303\r\n\r\nIn some edge cases with specific amounts of legend items and chart heights, this lead to overflow bugs as seen in #5491. This pull request fixes this issue.\r\n\r\nFixes #5491"},"comment":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/comments/437434191","html_url":"https://github.com/chartjs/Chart.js/pull/5776#issuecomment-437434191","issue_url":"https://api.github.com/repos/chartjs/Chart.js/issues/5776","id":437434191,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzQzNDE5MQ==","user":{"login":"nagix","id":723188,"node_id":"MDQ6VXNlcjcyMzE4OA==","avatar_url":"https://avatars3.githubusercontent.com/u/723188?v=4","gravatar_id":"","url":"https://api.github.com/users/nagix","html_url":"https://github.com/nagix","followers_url":"https://api.github.com/users/nagix/followers","following_url":"https://api.github.com/users/nagix/following{/other_user}","gists_url":"https://api.github.com/users/nagix/gists{/gist_id}","starred_url":"https://api.github.com/users/nagix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagix/subscriptions","organizations_url":"https://api.github.com/users/nagix/orgs","repos_url":"https://api.github.com/users/nagix/repos","events_url":"https://api.github.com/users/nagix/events{/privacy}","received_events_url":"https://api.github.com/users/nagix/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T17:30:34Z","updated_at":"2018-11-09T17:30:34Z","author_association":"COLLABORATOR","body":"I think the calculation in `fit` is needed because the height of the legend box is determined by the size of other boxes but the width can change depending on the legend items (in case of 'left' and 'right' positions). The problem is that the result of the `fit` function also affects the positions and sizes of other boxes, so we need to stop calculation at some point.\r\n\r\n@jtagscherer Can you create a pull request for my repository? Then, I will merge it."}}
{"actor":{"display_login":"nagix"}}