{"action":"created","issue":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/4584","repository_url":"https://api.github.com/repos/chartjs/Chart.js","labels_url":"https://api.github.com/repos/chartjs/Chart.js/issues/4584/labels{/name}","comments_url":"https://api.github.com/repos/chartjs/Chart.js/issues/4584/comments","events_url":"https://api.github.com/repos/chartjs/Chart.js/issues/4584/events","html_url":"https://github.com/chartjs/Chart.js/issues/4584","id":246577956,"number":4584,"title":"Chart.js TimeScale determineStepSize runs into endless loop whith responsive mode on small mobile displays","user":{"login":"azarus","id":5852531,"avatar_url":"https://avatars2.githubusercontent.com/u/5852531?v=4","gravatar_id":"","url":"https://api.github.com/users/azarus","html_url":"https://github.com/azarus","followers_url":"https://api.github.com/users/azarus/followers","following_url":"https://api.github.com/users/azarus/following{/other_user}","gists_url":"https://api.github.com/users/azarus/gists{/gist_id}","starred_url":"https://api.github.com/users/azarus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azarus/subscriptions","organizations_url":"https://api.github.com/users/azarus/orgs","repos_url":"https://api.github.com/users/azarus/repos","events_url":"https://api.github.com/users/azarus/events{/privacy}","received_events_url":"https://api.github.com/users/azarus/received_events","type":"User","site_admin":false},"labels":[{"id":32309884,"url":"https://api.github.com/repos/chartjs/Chart.js/labels/Category:%20Bug","name":"Category: Bug","color":"fc2929","default":false},{"id":32309885,"url":"https://api.github.com/repos/chartjs/Chart.js/labels/Inactive:%20duplicate","name":"Inactive: duplicate","color":"cccccc","default":false},{"id":609933107,"url":"https://api.github.com/repos/chartjs/Chart.js/labels/Time%20Scale","name":"Time Scale","color":"f9d0c4","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-07-30T11:22:36Z","updated_at":"2017-10-12T04:38:32Z","closed_at":"2017-10-12T04:38:32Z","author_association":"NONE","body":"FILE: **src/scales/scale.time.js**\r\nhttps://github.com/chartjs/Chart.js/blob/release/src/scales/scale.time.js#L142\r\n```\r\n/**\r\n\t * Determines how we scale the unit\r\n\t * @param min {Number} the scale minimum\r\n\t * @param max {Number} the scale maximum\r\n\t * @param unit {String} the unit determined by the {@see determineUnit} method\r\n\t * @return {Number} the axis step size as a multiple of unit\r\n\t */\r\n\tfunction determineStepSize(min, max, unit, maxTicks) {\r\n\t\t// Using our unit, figoure out what we need to scale as\r\n\t\tvar unitDefinition = interval[unit];\r\n\t\tvar unitSizeInMilliSeconds = unitDefinition.size;\r\n\t\tvar sizeInUnits = Math.ceil((max - min) / unitSizeInMilliSeconds);\r\n\t\tvar multiplier = 1;\r\n\t\tvar range = max - min;\r\n\r\n\t\tif (unitDefinition.steps) {\r\n\t\t\t// Have an array of steps\r\n\t\t\tvar numSteps = unitDefinition.steps.length;\r\n\t\t\tfor (var i = 0; i < numSteps && sizeInUnits > maxTicks; i++) {\r\n\t\t\t\tmultiplier = unitDefinition.steps[i];\r\n\t\t\t\tsizeInUnits = Math.ceil(range / (unitSizeInMilliSeconds * multiplier));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlet stepCounts = 0;\r\n\t\t\twhile (sizeInUnits > maxTicks && maxTicks > 0) {\r\n\t\t\t\t++multiplier;\r\n\t\t\t\tif(stepCounts > 1000)\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\tsizeInUnits = Math.ceil(range / (unitSizeInMilliSeconds * multiplier));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn multiplier;\r\n\t}\r\n\r\n```\r\n\r\nThis is the magic function that runs into an endless loop.\r\nSince the sizeInUnits is always overriden its always bigger than mxaTicks\r\n\r\n![MaxTicks SizeIn Units](https://i.imgur.com/3bhgoh5.png)\r\nOn the picture above \r\nSize in units is always 1, and Maxticks is 0.31..."},"comment":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/comments/336018626","html_url":"https://github.com/chartjs/Chart.js/issues/4584#issuecomment-336018626","issue_url":"https://api.github.com/repos/chartjs/Chart.js/issues/4584","id":336018626,"user":{"login":"azarus","id":5852531,"avatar_url":"https://avatars2.githubusercontent.com/u/5852531?v=4","gravatar_id":"","url":"https://api.github.com/users/azarus","html_url":"https://github.com/azarus","followers_url":"https://api.github.com/users/azarus/followers","following_url":"https://api.github.com/users/azarus/following{/other_user}","gists_url":"https://api.github.com/users/azarus/gists{/gist_id}","starred_url":"https://api.github.com/users/azarus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azarus/subscriptions","organizations_url":"https://api.github.com/users/azarus/orgs","repos_url":"https://api.github.com/users/azarus/repos","events_url":"https://api.github.com/users/azarus/events{/privacy}","received_events_url":"https://api.github.com/users/azarus/received_events","type":"User","site_admin":false},"created_at":"2017-10-12T04:38:32Z","updated_at":"2017-10-12T04:38:32Z","author_association":"NONE","body":"@kilowhisky use the latest version. We actually ended up implementing our own charts due to lack of support for features such as zooming, bad performance and bugs like this."}}
{"actor":{"display_login":"azarus"}}