0
개체의 각 키에 대한 데이터 형식을 동적으로 설정하려고합니다.내 데이터 객체의 키를 사용하여 c3.js 차트 데이터 유형을 어떻게 설정할 수 있습니까?
{"x":["2016-01-1", "2016-01-02", etc], "uniqueKey":[4234, 4324, etc], "uniqueKey2":[432, 543, etc], ... }
내가 잡아 어떤 데이터에 따라 달라집니다 키와 이름의 수 있지만 각 키의 그래프 데이터 형식을 설정해야합니다
목적은 같다.
function show_chart1(data) {
var json = JSON.parse(data);
var chart = c3.generate({
bindto: '#chart',
data: {
x: 'x',
xFormat: '%Y-%m-%d',
json: json,
#### need these to be the unique key names
types: {
uniqueKey: 'area-spline',
uniqueKey2: 'area-spline'
...
},
groups: [[uniqueKey, uniqueKey2, etc]]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
}
}
});
};
어떻게하면됩니까?