我会将数据绑定到我的轴刻度上(由序数比例尺生成),以便在鼠标悬停事件中稍后使用。
我不想显示它,只是绑定它:
这是可能的,还是我需要欺骗一些东西?
我不想显示它,只是绑定它:
//data what I would like to bind on each tick (eg. "<0,1" tick binded to 10
//"<0,2" tick binded to 28
//"<0,3" tick binded to 4
//...
var data = [10,28,4,6,10,65,87,54, 9, 1,45];
//what is display on tick
this.xLabelsValues = ["<0,1", "<0,2", "<0,3", "<0,4", "<0,5",
"<0,6", "<0,7", "<0,8", "<0,9", "<1", "=1"];
this.x = d3.scale.ordinal()
.rangeRoundBands([0, this.width], .1);
this.x.domain(chart.xLabelsValues);
this.svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + this.height + ")")
.call(this.xAxis);
//my event
this.svg.selectAll(".tick").on("mouseover", this.mouseover);
this.mouseover = function(d, e){
//I want my binded data here!
};
这是可能的,还是我需要欺骗一些东西?