codesuki / react-d3-components

D3 Components for React
http://codesuki.github.io/react-d3-components/example.html
MIT License
1.63k stars 205 forks source link

add tickFormat as prop to BarChart #90

Closed mskeving closed 8 years ago

mskeving commented 8 years ago

Bug

Currently there is no way to pass in a custom tickFormat function to BarChart unless you include it in your x or y scale. However, Axis is set up to check if a tickFormat prop is defined independent of scale.

Fix

Allow BarChart to receive a tickFormat prop. This allows you to customize your tick labels without having to worry about figuring out what the rest of xScale entails.

Tested

I tested this with a graph I've been working on. I only wanted to show every 4th tick label, which I can now do by passing in my own function as a tickFormat prop to BarChart. If no tickFormat prop is defined, business continues as usual.

screenshot 2016-02-15 21 30 17
codesuki commented 8 years ago

Very nice pullreq, easy to understand. Thank you!