{"action":"created","issue":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/2419","repository_url":"https://api.github.com/repos/chartjs/Chart.js","labels_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2419/labels{/name}","comments_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2419/comments","events_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2419/events","html_url":"https://github.com/chartjs/Chart.js/issues/2419","id":151868008,"number":2419,"title":"Line chart: manually limit x-axis tick labels","user":{"login":"nielssj","id":1209767,"avatar_url":"https://avatars.githubusercontent.com/u/1209767?v=3","gravatar_id":"","url":"https://api.github.com/users/nielssj","html_url":"https://github.com/nielssj","followers_url":"https://api.github.com/users/nielssj/followers","following_url":"https://api.github.com/users/nielssj/following{/other_user}","gists_url":"https://api.github.com/users/nielssj/gists{/gist_id}","starred_url":"https://api.github.com/users/nielssj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nielssj/subscriptions","organizations_url":"https://api.github.com/users/nielssj/orgs","repos_url":"https://api.github.com/users/nielssj/repos","events_url":"https://api.github.com/users/nielssj/events{/privacy}","received_events_url":"https://api.github.com/users/nielssj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-29T13:40:27Z","updated_at":"2016-04-29T14:05:56Z","closed_at":null,"body":"Hello,\r\nI'm building a line chart with a high number of data points (for the sake of example 10) and I would like to draw lines based on all 10 data points, but I would like to limit the number of x-axis tick labels to exactly 5 (every second data point). Here's the simplified version of what I'm trying to do:\r\n```\r\nvar lineChart = new Chart(cnvLineChart, {\r\n    type: 'line',\r\n    data: {\r\n        labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\r\n        datasets: [\r\n            {\r\n                label: \"Data set 1\",\r\n                data: [11, 22, 33, 44, 55, 66, 77, 88, 99, 100]\r\n            },\r\n            {\r\n                label: \"Data set 2\",\r\n                data: [111, 122, 133, 144, 155, 166, 177, 188, 199, 1100]\r\n            }\r\n        ]\r\n    },\r\n    options: {\r\n        scales: {\r\n            xAxes: [{\r\n                ticks: {\r\n                    stepSize: 2,\r\n                    autoSkip: false\r\n                },\r\n                type: 'linear',\r\n                position: 'bottom'\r\n            }]\r\n        }\r\n    }\r\n});\r\n```\r\n\r\nBy default line chart uses categorical scale on the x-axis. But as far as I can understand I need a linear scale to get access to the `ticks.stepSize` option. However, when i set the type to `linear` as shown above, my script breaks and gets into an infinite rendering loop.\r\n\r\nI searched through issues and found https://github.com/chartjs/Chart.js/issues/2228 where someone suggests to make a tick callback and return an empty string for every second tick. This works, but then I still end up with a really finely granulated grid, which I would prefer followed the tick labels.\r\n\r\nAny idea how I can accomplish this?"},"comment":{"url":"https://api.github.com/repos/chartjs/Chart.js/issues/comments/215726745","html_url":"https://github.com/chartjs/Chart.js/issues/2419#issuecomment-215726745","issue_url":"https://api.github.com/repos/chartjs/Chart.js/issues/2419","id":215726745,"user":{"login":"etimberg","id":6757853,"avatar_url":"https://avatars.githubusercontent.com/u/6757853?v=3","gravatar_id":"","url":"https://api.github.com/users/etimberg","html_url":"https://github.com/etimberg","followers_url":"https://api.github.com/users/etimberg/followers","following_url":"https://api.github.com/users/etimberg/following{/other_user}","gists_url":"https://api.github.com/users/etimberg/gists{/gist_id}","starred_url":"https://api.github.com/users/etimberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etimberg/subscriptions","organizations_url":"https://api.github.com/users/etimberg/orgs","repos_url":"https://api.github.com/users/etimberg/repos","events_url":"https://api.github.com/users/etimberg/events{/privacy}","received_events_url":"https://api.github.com/users/etimberg/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T14:05:56Z","updated_at":"2016-04-29T14:05:56Z","body":"@nielssj in the callback if you return `null` or `undefined` the grid line will also be hidden"}}