0

我正在尝试使用离散条形图为电子邮件活动设置分析,我刚刚发现 nvd3 有一个奇怪的错误,即任何值为 1000 或更高的数据点都无法正确呈现。

这是jsfiddle

http://jsfiddle.net/aMnSb/

 var data = [{
key: "Cumulative Return",
values: [
    {"label" : "delivered","value" : "999","color" : "458ec1",},{"label" : "opened","value" : "176","color" : "65a1cb",},{"label" : "clicked","value" : "8","color" : "7fb1d4",},{"label" : "unopened","value" : "487","color" : "aacce3",},{"label" : "bounced","value" : "357","color" : "eec4cc",},{"label" : "unsubscribed","value" : "1","color" : "e39ba9",},                 ]

}];

有效,但这不起作用

var data_large = [{
    key: "Cumulative Return",
    values: [
        {"label" : "delivered","value" : "1000","color" : "458ec1",},{"label" : "opened","value" : "176","color" : "65a1cb",},{"label" : "clicked","value" : "8","color" : "7fb1d4",},{"label" : "unopened","value" : "487","color" : "aacce3",},{"label" : "bounced","value" : "357","color" : "eec4cc",},{"label" : "unsubscribed","value" : "1","color" : "e39ba9",},                    ]
}];
4

1 回答 1

1

您看到这种行为是因为 JSON 中的数字实际上不是数字,而是字符串(用引号括起来)。如果您删除 JSON 中数字周围的引号,它会起作用。

于 2013-03-05T18:41:08.990 回答