2

这是我的代码,我有 xaxis1,其中包含月份名称:一月..十二月。我想让每个月份的值可选,所以我添加了这个功能:

d3.select(".xAxis1") //selecting xAxis1 division
.selectAll(".major")  //select all the tiket defined on it
.on("click",clickMe)  //applay the function on clik to each value

 function clickMe(){alert("I've been clicked!")}

但它不起作用?!有任何想法吗?

4

2 回答 2

1

如果有人需要同样的代码:http: //vida.io/documents/LD3gAW64tv5yYj3yf

于 2013-10-01T13:50:46.230 回答
0

我不擅长 d3js,但为什么你不尝试。

d3.select(".xAxis1") //selecting xAxis1 division
.on("click",clickMe);  //applay the function on clik to each value

d3.selectAll(".major")  //select all the tiket defined on it
.on("click",clickMe)  //applay the function on clik to each value

 function clickMe(){alert("I've been clicked!")}

当我查看您的代码时,我认为这".xAxis1"是不正确的,应该是 ".axis1"

于 2013-09-30T23:04:08.477 回答