c3js/c3

Missing column in bar chart derived from data.json where the x value is 'empty'

thehouseoffung opened this issue · 0 comments

C3 version: 0.7.11
D3 version: 5.14.2
Browser: Chrome Version 94.0.4606.81 (Official Build) (x86_64)
OS: macOs Mojave Version 10.14.6

Observed: The chart seems to want to filter out a column but is always filtering out the last column.

Expected: Keep the column entirely, or filter out the 'empty' column specifically.

Screen Shot 2021-10-13 at 4 43 04 PM

Code snippet:

var chart = c3.generate({
  data: {
    json: [
      {name: 'www.site1.com', upload: 200, download: 200, total: 400},
      {name: '', upload: 100, download: 300, total: 400},
      {name: 'www.site3.com', upload: 300, download: 200, total: 500},
      {name: 'www.site4.com', upload: 400, download: 100, total: 500}
    ],
    type:'bar',
    keys: {
      x: 'name', // it's possible to specify 'x' when category axis
      value: ['upload', 'download']
    }
  },
  axis: {
    x: {
      type: 'category'
    }
  }
});