Bar chart won’t render with specific plots

Expected Behavior

I would expect to be able to load data for a bar chart plotted against the x-axis. For example:

data: [
                            {x:"8/2017",y:2,
                            x:"9/2017",y:5}
                        ]

In this case, the particular dataset will plot on the x-axis for 8/2017 and 9/2017. If there are more possibilities on the x-axis (like 10/2017), it will just not plot there.

Current Behavior

Hard to explain – but basically it doesn’t do any plotting on those x-axis points.

Here’s a codepen example where Dataset 2 (red) is what I am trying to plot in a predetermined fashion:

https://codepen.io/anon/pen/RjjGZL

Context

Imagine plotting employee hours, where each bar represents an employee in a given month. Bob may show up once for each month he works, and the height of the bar is the hours worked that month. If Bob skips a month, I want to be able to plot accordingly, hence the strict data provided.

Environment

  • Chart.js version: 2.7.1
  • Browser name and version: Chrome 62.0.3202.94
  • Link to your project: private but codepen may help

Author: Fantashit

1 thought on “Bar chart won’t render with specific plots

Comments are closed.