c3js / c3js/c3

Can't get "timeseries" to display with weekly intervals

Open
#2,812 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Basically I'm trying to build something of a gantt chart that shows the last 30 days.

- D3.js: 5.16.0
- C3.js: 0.7.20
- [CodePen](https://codepen.io/brianjenkins94/pen/wvGqVYe)

See the 2 comments below on the solutions that I thought should have worked:

```javascript
c3.generate({
"bindto": "#chart1",
"data": {
"type": "bar",
"json": data,
"keys": {
"x": "ticketNumber",
"value": ["startDate", "endDate"]
},
"groups": [
["startDate", "endDate"]
],
"colors": {
"startDate": "transparent",
}
},
"axis": {
"x": {
"type": "category",
"tick": {
"values": [],
}
},
"y": {
"type": "timeseries",
"min": Date.now() - 1000 * 60 * 60 * 24 * 30,
"max": Date.now(),
"tick": {
// Neither of these appear to change anything:
//"culling": true,
//"fit": true,
"format": d3.timeFormat("%B %d, %Y"),
"outer": false,
// Nor does this:
//"values": (function() {
// const values = [];
//
// for (const x = new Date(Date.now() - 1000 * 60 * 60 * 24 * 30); x < Date.now(); x.setDate(x.getDate() + 1)) {
// if (x.getDay() === 0) {
// values.push(x);
//
// x.setDate(x.getDate() + 6)
// }
// }
//
// return values;
//})()
}
},
"rotated": true
},
"legend": {
"hide": true
}
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.