views:

16

answers:

0

I don't know why my code doesn't work.

I want to get in the same chart different lines which have different url sources.

function recupereData(url){
     var retourVar = "";
     dojo.xhrGet({
         url: url,
             handleAs: "json",
             load: function(data){
                     retourVar = data;
             }
     });
     return retourVar;
}
dojo.addOnLoad(function(){
    var chart10 = new dojox.charting.Chart2D("container");
    chart10.setTheme(dojox.charting.themes.Minty);
        data1 = recupereData("urlData1.php");
        data2 = recupereData("urlData2.php");
        //data3 = recupereData("urlData3.php");
        chart10.addPlot("default", {
        type: "Lines"
    });
    chart10.addAxis("x", {
        min: 0,
        max: 50,
        majorTick: { stroke: "black", length: 10 },
        minorTick: { stroke: "gray", length: 5 }
    });
    chart10.addAxis("y", {
        vertical: true,
        min: 0,
        max: 60,
        majorTick: { stroke: "black", length: 30 },
        minorTick: { stroke: "gray", length: 10 }
    });
    chart10.addSeries("Serie 1", {data : data1});
    chart10.addSeries("Serie 2", data2);
    //addSeries("Serie 3", data3)
    chart10.render();
});