JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css">
<h4>timestamps from influxDB</h4>
<div id="chart"></div>
<h4>example from C3js.org </h4>
<div id="chart2"></div>
JavaScript
var chart2 = c3.generate({
bindto: '#chart',
data: {
x: 'x',
columns: [
['x', '2015-09-30T12:21:41.447494312Z','2015-09-30T12:21:43.843041049Z','2015-09-30T12:21:45.232790712Z','2015-09-30T12:21:46.354395782Z','2015-09-30T12:21:47.71844462Z','2015-09-30T12:21:49.161363528Z'],
['data1', 30, 200, 100, 400, 150, 250]
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
}
}
});
var chart2 = c3.generate({
bindto: '#chart2',
data: {
x: 'x',
// xFormat: '%Y%m%d', // 'xFormat' can be used as custom format of 'x'
columns: [
['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'],
// ['x', '20130101', '20130102', '20130103', '20130104', '20130105', '20130106'],
['data1', 30, 200, 100, 400, 150, 250]
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
}
}
});