Home Forums Feature Requests & Feedback two csv in the same chart

two csv in the same chart

Viewing 4 posts - 1 through 4 (of 4 total)
  • #23246

    HI,

    I want creating one chart with two CSV files.

    code js :

    $.ajax({
    type: “GET”,
    url: “test1.csv”,
    dataType: “text”,
    success: function (data) {
    processCSV1(data, “3000”, “3000”, “Info1”);
    }
    });

    $.ajax({
    type: “GET”,
    url: “test2.csv”,
    dataType: “text”,
    success: function (data) {
    processCSV1(data, “3000”, “000”, “Info1”);
    }
    });

    function processCSV1(allText, containerID, titleText, axYTitle) {
    var allLinesArray = allText.split(“\n”);
    if (allLinesArray.length > 0) {
    var dataPoints1 = [];
    var dataPoints2 = [];
    for (var i = 0; i <= allLinesArray.length – 1; i++) {
    var rowData = allLinesArray[i].split(“;”);
    dataPoints1.push({
    label: rowData[0],
    y: parseFloat(rowData[1])
    });

    dataPoints2.push({
    label: rowData[0],
    y: parseFloat(rowData[1])
    });
    }

    var chart = new CanvasJS.Chart(containerID, {
    animationEnabled: true,
    zoomEnabled: true,
    title: {
    text: titleText,
    fontSize: 25
    },
    axisX: {
    title: “Graphe1”,

    },
    axisY: {
    title: axYTitle,
    },
    legend: {
    horizontalAlign: “center”,
    verticalAlign: “top”,
    fontSize: 15
    },
    data: [{
    type: “line”,
    markerType: “circle”,
    dataPoints: dataPoints1
    },
    {
    type: “line”,
    markerType: “circle”,
    dataPoints: dataPoints2

    }]

    });
    chart.render();
    }
    }

    it shows me that a curve, how i can do?

    #23251

    @lola123,

    Please take a look at this JSFiddle.

    Considering this to be a duplicate of this thread, hence closing it.

    __
    Priyanka M S
    Team CanvasJS

    #23278

    Thank you very much.

    How i can make to see several charts on the same page with “Multi Series Chart from External CSV Data”

    #23283

    @lola123,

    Please refer to this documentation on Render Multiple Charts in a Page for a step-by-step tutorial.

    __
    Priyanka M S
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.