0
var taskTypes = ["slot1", "slot2", "slot3","slot4","slot1","slot2","slot6"];
var y = d3.scale.ordinal()
.domain(taskTypes)
.rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);
我是做
var rectTransform = function(d) {
return "translate(" + x(d.termStartDate) + "," + y(d.slotName) + ")";
};
,它是未來正確的,但現在我正在
var y = d3.scale.ordinal()
.domain(d3.range(0, taskTypes.length))
.rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);
現在
var rectTransform = function(d) {
return "translate(" + x(d.termStartDate) + "," + y(d.slotName) + ")";
};
其中d.slotName
= slot1或slot2或slot3或任何其他值y(d.slotName)
正在返回未定義,任何建議如何使其工作?
嗨@henry ..你回答了http://stackoverflow.com/questions/30049087/d3-js-need-repeated-values-on-yis軸上的查詢,這是同一件事的延續 – sachin
嗨,感謝隊友,我明白了,並解決了這個問題。 – sachin