0
我想创建一个图表,其中x轴中的值是字符串而不是整数。 目前我有什么看起来像这样:x轴中的字符串
10 |
8 |
4 |
0 |__________
1 3 5
,我想让它像这样:
10 |
8 |
4 |
0 |____________________________
January February March
我使用NVD3图表。任何帮助,将不胜感激。
我会传递数据,但目前我手动。
function profiles() {
var profiles = [];
profiles.push({x:1,y:5});
profiles.push({x:2,y:3});
profiles.push({x:3,y:9});
profiles.push({x:4,y:6});
profiles.push({x:5,y:6});
profiles.push({x:6,y:8});
profiles.push({x:7,y:4});
profiles.push({x:8,y:7});
profiles.push({x:9,y:5});
profiles.push({x:10,y:8});
profiles.push({x:11,y:6});
profiles.push({x:12,y:12});
return [{
values: profiles,
key: "Profiles",
color: "#ff7f0e"
}];
}
而不是x:1我想x:1月例如。
你在数据中传递日期吗?你可以在问题中发布你的代码片段吗? – shabeer90
这个例子可能有助于http://nvd3.org/ghpages/discreteBar.html – Adween