Skip to content
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

[BUG?] Bar graph showing one dataset's bars in wrong column #3828

Closed
keithpickering opened this issue Jan 25, 2017 · 6 comments
Closed

[BUG?] Bar graph showing one dataset's bars in wrong column #3828

keithpickering opened this issue Jan 25, 2017 · 6 comments

Comments

@keithpickering
Copy link

I'm totally stumped with this one. Here's the data being sent to chartjs:

{
  "labels": [
    "12\/11\/2016","12\/13\/2016","12\/15\/2016","12\/16\/2016","12\/18\/2016",
    "12\/20\/2016","12\/22\/2016", "12\/27\/2016","12\/29\/2016","12\/30\/2016"
  ],
  "datasets": [
    {
      "data": [0, 7, 0, 9, 0, 8, 0, 5, 0, 5],
      "label": "December 2016",
      "backgroundColor": "rgb(0,149,218)"
    },
    {
      "data": [11, 0, 8, 0, 8, 0, 5, 0, 4, 0],
      "label": "November 2016 Comparison",
      "backgroundColor": "rgb(0,167,124)"
    }
  ]
}

As far as I can tell this absolutely abides by the required structure. However, when the chart renders, it looks like this:
capture
(This screenshot is with a barValueSpacing of 20, but I've tried several configurations and it never seems to help)

The first green bar has a value of 11, and it should be displayed in the 12/11/2016 column alongside the 0 value for the December 2016 dataset. What is going on here?

@etimberg
Copy link
Member

Are you using a time axis as the x axis? If so, this is a known issue. See #3263, #2415.

@keithpickering
Copy link
Author

I'm not using the type: "time" setting. My x-axis label array is being fed straight into the plugin. Is the time axis something that is automatically set? I don't think that's the problem; I'm pretty sure I tried overriding the label array with random strings (not dates) and it still didn't render properly.

I should note that when the bars are hovered over, they display the correct dataset. They're just rendering too far to the right for some reason.

@etimberg
Copy link
Member

The time axis is not automatically set. Could you put this in a jsfiddle for debugging?

@keithpickering
Copy link
Author

keithpickering commented Jan 26, 2017

How confusing...the jsfiddle works exactly as expected: https://jsfiddle.net/4yhpfpn2/1/ (Replaced the 0 values with 0.1 to make them easier to see)

Is there anything you could think of that could interfere with chartjs's ability to draw bars in the correct location?

@etimberg
Copy link
Member

That's interesting. I don't know what could cause that to happen. Are you able to share the original case at all?

@etimberg
Copy link
Member

etimberg commented Mar 8, 2017

Closing since there is no test case

@etimberg etimberg closed this as completed Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants