Original C3.js example:
https://c3js.org/samples/chart_stanford.html
I am getting the following console log error in my C3.js Stanford Chart:
c3.js:2349 Failed to parse x '2019-09-10 08:15:51' to Date object
in all of my JSON values.
I know this has something to do with xFormat, which I have added in the keys: area of Data:, but I am still receiving the same error.
var data = [
{
"Time": "2019-09-10 08:15:51",
"Range Gate": 26,
"Velocity": 44
},
{
"Time": "2019-09-10 08:16:51",
"Range Gate": 46,
"Velocity": 47
},
{
"Time": "2019-09-10 08:17:51",
"Range Gate": 55,
"Velocity": 50
},
{
"Time": "2019-09-10 08:18:51",
"Range Gate": 1,
"Velocity": 54
},
{
"Time": "2019-09-10 08:19:51",
"Range Gate": 11,
"Velocity": 54
}
];
Same occurs with this dataset:
var data = [
{
"Time": "08:15:51",
"Range Gate": 26,
"Velocity": 44
},
{
"Time": "08:16:51",
"Range Gate": 46,
"Velocity": 47
},
{
"Time": "08:17:51",
"Range Gate": 55,
"Velocity": 50
},
{
"Time": "08:18:51",
"Range Gate": 1,
"Velocity": 54
},
{
"Time": "08:19:51",
"Range Gate": 11,
"Velocity": 54
}
];
var chart = c3.generate({
size: {
height: 600,
width: 800 * 1.12
},
data: {
json: data,
mimeType: 'json',
epochs: 'Velocity',
keys: {
x: 'Time',
xFormat: '%H:%M:%S',
value: ['Range Gate', 'Velocity']
},
type: 'stanford'
},
legend: {
hide: true
},
point: {
focus: {
expand: {
r: 5
}
},
r: 2.5
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%H:%M:%S'
},
show: true,
label: {
text: 'Time',
position: 'outer-center'
},
min: 0,
max: 61,
padding: {
top: 0,
bottom: 0,
left: 0,
right: 0
},
},
y: {
show: true,
label: {
text: 'Range Gate',
position: 'outer-middle'
},
min: 0,
max: 60,
tick: {
values: d3.range(0, 65, 10)
},
padding: {
top: 5,
bottom: 0,
left: 0,
right: 0
},
}
},
stanford: {
scaleMin: 1,
scaleMax: 10000,
scaleFormat: 'pow10',
padding: {
top: 15,
right: 0,
bottom: 0,
left: 0
}
}
});
c3.js:2349 Failed to parse x '2019-09-10 08:15:51' to Date object
c3.js:2349 Failed to parse x '2019-09-10 08:16:51' to Date object
etc.