-1
我有一個多邊形的雷達圖表。現在我希望它們在鼠標懸停時被填充顏色,但只有當鼠標在路徑上時纔會填充顏色。當鼠標在多邊形內部時,它應該沒有填充。鼠標懸停只有在d3的路徑
到目前爲止,我試過
svg.selectAll('.polygon')
.data(scaledData)
.enter()
.append('svg:path')
.attr('d', radialLine)
.attr('stroke', function(d, i) {return colors(i);})
.attr('stroke-width', '3')
.attr('fill', 'none')
.on("mouseover", function(d) {
d3.select(this).style("fill", d3.select(this).attr('stroke')).attr('opacity', 0.3);
})
.on("mouseout", function(d) {
d3.select(this).style("fill", "none").attr('opacity', 1);
});
,當我在整個多邊形填充。此外,我希望中風保持不變,不改變其不透明度。
任何幫助表示讚賞
認爲你是在談論 d3.select(本).style( 「補」,d3.select(本).attr( '撫摸')) 這一部分,但只有這樣我得到的正確的顏色爲多邊形。 即使當我在多邊形的內部時,它仍然保持填充狀態 – maxze
我已經看到只有在3小時左右的時候才能看到:它實際上是'pointer-events',而不是'pointer-event'。哎呀。 – ccprog