Home › Forums › Report Bugs › Line Graph Point Connection Bug › Reply To: Line Graph Point Connection Bug
@saul_romero,
data.sort((a,b)=>a-b); works on array but not on array of objects. You need to sort it manually to handle it. Please chek out the code-snippet to sort datapoints below.
data.sort((a,b)=>a-b);
for (var i = 0; i < dataPoints.length - 1; i++) { if (dataPoints[i].x > dataPoints[i + 1].x) { var temp = dataPoints[i]; dataPoints[i] = dataPoints[i + 1]; dataPoints[i + 1] = temp; i = 0; } }
Please check this JSFiddle for complete code.
Also please refer to this documentation page for tutorial on dynamically updating chart from JSON data.
— Vishwas R