Home Forums Chart Support multiple sets of datapoints Reply To: multiple sets of datapoints



It is possible to create a multi-series chart with data from an XML file by looping through the XML data as shown in the code-snippet below,

$(data).find("point").each(function () {
    var $dataPoint = $(this);
    var x = $dataPoint.find("x").text();
    var y1 = $dataPoint.find("y1").text();
    var y2 = $dataPoint.find("y2").text();
    dps1.push({x: parseFloat(x), y: parseFloat(y1)});
    dps2.push({x: parseFloat(x), y: parseFloat(y2)});

The format of the dataPoints in the XML file (e.g. data.xml) should be:


Kindly take a look at this CodeSandbox for a working example.

Multi-series Chart using XML data

Adithya Menon
Team CanvasJS