开发者

Google Area Chart is not taking value as int

I'm using Google's Area Chart to dispaly a graph.

For some reason I'm not ble to use values past into the function:

I have the following code:

function SetAreaChartData(valueString) {

    //This works
    AreaChartData.setValue(0, 0, 'SomeName');
    AreaChartData.setValue(0, 1, 500);
    AreaChartData.setValue(0, 2, 500);
    AreaChartData.setValue(0, 3, 500);

    //This does not work

    // First I must "cast" the input to string in order to use the .split function
    var str = new St开发者_如何学Goring(valueString); 

    // Then I split the string in order to get an array of string
    val = str.split(",");

    AreaChartData.setValue(0, 0, 'SomeName');
    AreaChartData.setValue(0, 1, val[0]*1); //Multiply by one to cast it to integer
    AreaChartData.setValue(0, 2, val[1]*1);
    AreaChartData.setValue(0, 3, val[2]*1);
}

I've also tried using parseInt(val[0]), but that is not helping either.

Why won't .setValue recognize val[0] as an integer?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜