JSFiddle - React, Tailwind, and code Playground

by sdk8

JavaScript

var testdata = [{
		"x": [
			"Jan-10",
			"Feb-10",
			"Mar-10",
			"Apr-10",
			"May-10"
		],
		"y": [
			"100.0",
			"25.0",
			"100.0",
			"60.0",
			"500.0"
		],
		"xf": "Jan-10",
		"xl": "May-10",
		"yf": "100.0",
		"yl": "500.0",
		"xtitle": "day",
		"ytitle": "rs"
	},
	{
		"x": [
			"Jan-11",
			"Feb-11",
			"Mar-11",
			"Apr-11",
			"May-11"
		],
		"y": [
			"450.0",
			"650.0",
			"300.0",
			"70.0",
			"360.0"
		],
		"xf": "Jan-11",
		"xl": "May-11",
		"yf": "450.0",
		"yl": "360.0",
		"xtitle": "day",
		"ytitle": "rs"
	}
];
        
        if(testdata.length > 0){
          console.log(testdata);
          console.log(JSON.stringify(testdata));
          var outarr = [];
          for(var i = 0; i < testdata[0].x.length; i++) {
            outarr.push(
            {
            "x": testdata[0].x[i],
            "y": testdata[0].y[i]
            })
			}
		console.log(outarr);
		console.log(JSON.stringify(outarr));
}