react-c3js icon indicating copy to clipboard operation
react-c3js copied to clipboard

How to pass multiple timestamp Json data to c3 charts?

Open aashish-chaubey opened this issue 7 years ago • 0 comments

Hey,

I am trying to pass multiple Json data for the multiple line charts.

I know for the single line chart, line would pass the data as:

var data = {
    x: 'quantity1',
    json: this.state.data1,
    types: {
        quantity1: 'line'
    }
};

Here, in my case I want to draw two lines on the chart. Therefore I do this:

var data = {
    x: 'quantity1',     // this is the timestamp
    json: this.state.data1,
    json: this.state.data2,
   types: {
       quantity1: 'line',
       quantity2: 'line'
   };
};

I feel this is not the appropriate way to pass the data for the lines.

My timestamp data format in both the cases are:

{
    "Mon Apr 30 2018 00:00:00 GMT+0530 (India Standard Time)": 5.5,
    "Mon Apr 30 2018 00:30:00 GMT+0530 (India Standard Time)": 4.5,
    "Mon Apr 30 2018 01:00:00 GMT+0530 (India Standard Time)": 3.5,
    .... 
    ....
}

Please help me in this!

Thanks.

aashish-chaubey avatar Jul 30 '18 11:07 aashish-chaubey