当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to draw an historical frieze in d3.js

问题描述:

I have an json object like that :

{

"data":{

"2012-12-29":[

{"Dir":112.5,"Spd":2,"Spl":7,"Max":16},

{...}

{"Dir":"null","Spd":0,"Spl":1,"Max":null}

],

"2012-12-20":[

{"Dir":22.5,"Spd":2,"Spl":7,"Max":16},

{...}

{"Dir":"null","Spd":0,"Spl":1,"Max":null}

],

"2012-12-31":[

{"Dir":90,"Spd":2,"Spl":7,"Max":16},

{...}

{"Dir":"null","Spd":0,"Spl":1,"Max":null}

],

...

}

I would like draw each DATE on a X axis represented each DATE by a circle.

the Y valus is always : 0, all circle are on the X axes.

After I include D3.on("click",function (){...}) on each circle to show inner data.

In first step I make an array of DATE only:

var list=[];

for (var keydate in DATA) {

list.push(keydate);

i++;

}

after I would like draw my DATE but I do not know how to?

var svg = d3.select(container)

.append("svg")

svg.selectAll("circle")

.data(list)

.enter()

.append("circle")

分享给朋友:
您可能感兴趣的文章:
随机阅读: