는 당신이 필요로하는 것은이 같은 복수의 X 축과 선형 차트, 어떤 도움을 appresiate 될 것입니다.
여기에 날짜를 추가해야 할 것 같아서 데이터와 날짜가 포함 된 배열을 전역으로 만들었습니다.
하단의 기능은 새로운 날짜와 데이터를 배열에 푸시합니다.
이러한 변수를 c3js로로드하려면 concat 함수를 사용하십시오.
//Declare three x axes, and a dataset for each axis.
var periodOne = ['2013-01-01', '2013-01-04', '2013-01-07','2013-01-11','2013-01-15'];
var periodTwo = ['2013-01-02', '2013-01-04', '2013-01-06','2013-01-08', '2013-01-10','2013-01-13', '2013-01-15','2013-01-18', '2013-01-22'];
var periodThr = ['2013-01-05', '2013-01-10', '2013-01-15','2013-01-20', '2013-01-25'];
var xOne = [12,31,14,13,34];
var xTwo = [11,13,14,23,63,27,21,19,15];
var xThr = [12,32,13,13,23];
var chart = c3.generate({
data: {
xs:{
//Declare the axes
'Winter 08,09': 'x1',
'Winter 09,10': 'x2',
'Winter 10,11': 'x3'
},
columns: [
['x1'].concat(periodOne),
['x2'].concat(periodTwo),
['x3'].concat(periodThr),
['Winter 08,09'].concat(xOne),
['Winter 09,10'].concat(xTwo),
['Winter 10,11'].concat(xThr)
]
},
axis: {
x: {
type: 'timeseries'
}
}
});
//You don't need this for multiple x axes, it's just to push data to arrays
function push(oneValue, oneDate, twoValue, twoDate, thrValue, thrDate){
periodOne[periodOne.length] = oneDate;
xOne[xOne.length] = oneValue;
periodTwo[periodTwo.length] = twoDate;
xTwo[xTwo.length] = twoValue;
periodThr[periodThr.length] = thrDate;
xThr[xThr.length] = thrValue;
chart.load({
columns: [
['x1'].concat(periodOne),
['x2'].concat(periodTwo),
['x3'].concat(periodThr),
['Winter 08,09'].concat(xOne),
['Winter 09,10'].concat(xTwo),
['Winter 10,11'].concat(xThr)
]
});
}
//Use this function to push new data
push(13, '2013-01-19', 23, '2013-01-24', 17, '2013-01-30');
각 색상별로 여러 날짜가 있습니까? 또는 라인 - 당신은 그것을 보면서. \ – Todd
또한, 당신이 원한다면 더 구체적 일 수 있습니까? – Todd
나는 timeseries 차트를 만들 필요가있다. http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/spline-irregular- 시각/. 여기에 각 행의 날짜/값을 설정할 수 있습니다. '이름 '블루 라인', 데이터 : [ [중 Date.UTC (1970, 9, 27), 0]},' 어떻게이 c3js로 할 수있는 ? – wpanin