{"action":"created","issue":{"url":"https://api.github.com/repos/rrag/react-stockcharts/issues/56","labels_url":"https://api.github.com/repos/rrag/react-stockcharts/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/rrag/react-stockcharts/issues/56/comments","events_url":"https://api.github.com/repos/rrag/react-stockcharts/issues/56/events","html_url":"https://github.com/rrag/react-stockcharts/issues/56","id":130424619,"number":56,"title":"Feature request / help needed : Setting a gap between ticks for Y","user":{"login":"Pinxie","id":15984761,"avatar_url":"https://avatars.githubusercontent.com/u/15984761?v=3","gravatar_id":"","url":"https://api.github.com/users/Pinxie","html_url":"https://github.com/Pinxie","followers_url":"https://api.github.com/users/Pinxie/followers","following_url":"https://api.github.com/users/Pinxie/following{/other_user}","gists_url":"https://api.github.com/users/Pinxie/gists{/gist_id}","starred_url":"https://api.github.com/users/Pinxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pinxie/subscriptions","organizations_url":"https://api.github.com/users/Pinxie/orgs","repos_url":"https://api.github.com/users/Pinxie/repos","events_url":"https://api.github.com/users/Pinxie/events{/privacy}","received_events_url":"https://api.github.com/users/Pinxie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-01T17:22:09Z","updated_at":"2016-02-02T10:29:10Z","closed_at":"2016-02-02T10:15:40Z","body":"I would like to put any gap I want for Y ticks. Here is an example with a 42 gap :\r\n\r\n![gapyaxis](https://cloud.githubusercontent.com/assets/15984761/12724553/b5f25f52-c90e-11e5-9770-7c76f7c69bff.png)\r\n\r\nI managed to do this but I'm not happy with how I have done it and it leads to bugs, particulary with zooming. What I did is that, when rendering, I get the previous domain for the Y axis (which I know is the root of the problem):\r\n\r\n`let yScale = self.refs[myChartRef].yScale();`\r\n\r\nget Min / max value: \r\n\r\n`let top = yScale.domain()[1];`\r\n`let bottom = yScale.domain()[0];`\r\n\r\nthen, the short of it, is that I construct an array of values for my ticks, feeding them to YAxis tickValues.\r\n\r\nOf course, when zooming and resetting zoom, it doesn't work, because the domain is limited to the chart when it was zoomed. The problem is that I can't predict the bottom / top values inside render() function (I guess browsing all my data points would be really overkill just for this)\r\n\r\nI was thinking to make a callback to setState which would get the yScale domain, then setState with the correct top & bottom values. Is that the correct approach?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rrag/react-stockcharts/issues/comments/178498982","html_url":"https://github.com/rrag/react-stockcharts/issues/56#issuecomment-178498982","issue_url":"https://api.github.com/repos/rrag/react-stockcharts/issues/56","id":178498982,"user":{"login":"rrag","id":10691183,"avatar_url":"https://avatars.githubusercontent.com/u/10691183?v=3","gravatar_id":"","url":"https://api.github.com/users/rrag","html_url":"https://github.com/rrag","followers_url":"https://api.github.com/users/rrag/followers","following_url":"https://api.github.com/users/rrag/following{/other_user}","gists_url":"https://api.github.com/users/rrag/gists{/gist_id}","starred_url":"https://api.github.com/users/rrag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrag/subscriptions","organizations_url":"https://api.github.com/users/rrag/orgs","repos_url":"https://api.github.com/users/rrag/repos","events_url":"https://api.github.com/users/rrag/events{/privacy}","received_events_url":"https://api.github.com/users/rrag/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T10:29:10Z","updated_at":"2016-02-02T10:29:10Z","body":"in 0.4, there will be a `yTicks={...}` in the `Chart`.\r\n`yTicks` would accept either an array or a `function(domain, plotData) { /* calculate ticks */ return [tick1, tick2]; }`\r\n\r\nThe function seems to solve your problem natively, no?"}}