Need help resolving issues with bar chart #4701
-
I have to display a bar chart for timestamp (x-axis) and count (y-axis) data where x-axis has a scale of time. I want to clarify if the following behaviours can be resolved -
For example, the below bar chart is the same as the above except it has category type for its x-axis. The use of category type is needed to display the bars starting from one tick and ending at another. However, the tooltip for June 17 bar is displayed when the cursor hovers over the June 16 bar where the white circle is drawn. Is there a way to resolve tooltip position here?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi! Thanks for making the codesandbox!
|
Beta Was this translation helpful? Give feedback.
Hi! Thanks for making the codesandbox!
scale="time"
andtype="category"
are incompatible. d3 scale expects numerical data when using a timescale, or else data cannot be interpreted as a date. If you removescale="time"
the categorical chart works fine and is just that, a list of categories. As long as your data is in order and you don't need to interpolate this should work for your case. This is generally preferred with bar charts.