-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Placement on x-axis #35
Comments
Wow that's very weird! Thanks for the report. |
Thanks for the details! Any reason you pass is in as string? Just for clarification. |
Thinking of it. If you pass a string the default scales will be ordinal and what you want is linear, which will be generated automatically if you pass numbers. So if you want to pass strings and have a linear scale you might make a scale yourself with the correct settings and pass it to the graph. |
I'm passing the values as string because they're not necessarily numbers (could be dates, numbers, strings...) |
At the moment it's automatically decided by looking at a single data point in https://github.com/codesuki/react-d3-components/blob/master/src/DefaultScalesMixin.jsx Supported are ordinal, numerical and date scales by default. But what you pass in yourself is not limited of course. |
The x-axis offset for ordinal scales is being caused by bar padding in _makeOrdinalXScale of DefaultScalesMixin.jsx. Bar padding defaults to 0.5, which is why it shows up correctly for bar charts but not for any other chart type. If you pass barPadding={1} as a property to charts (other than bar charts), it should fix the issue. |
Good catch! |
Hi,
Thanks for the good job with this library.
One thing I noticed that you probably want to know is that the data points are shifted (to the left) for most charts (actually all the charts I tried except the bar chart).
See screenshots:
Seems that points are placed to the top-left of the bars (in bar chart), whereas it should be at the top-center? Of course, the bigger the chart, the more important the shift.
The text was updated successfully, but these errors were encountered: