1
히트 맵 시각화를위한 색상 옵션을 추가하려고합니다.히트 맵의 색상 표를 동적으로 변경하는 방법
내가 드롭 다운 메뉴에서 링크를 클릭하면plotChart.selectAll(".cell")
.data(data)
.enter().append("rect")
.attr("class", "cell")
.attr("x", function (d) { return x(d.timestamp); })
.attr("y", function (d) { return y(d.hour); })
.attr("width", function (d) { return x(d3.timeWeek.offset(d.timestamp, 1)) - x(d.timestamp); })
.attr("height", function (d) { return y(d.hour + 1) - y(d.hour); })
.attr("fill", function (d) { return colorScale(d.value); });
, 내가 이렇게 :
이$(".colorMenu").click(function (event) {
event.preventDefault();
// remove # from clicked link
var addressValue = $(this).attr("href").substring(1);
// get color scheme array
var newColorScheme = colorDict[addressValue];
// update color scale range
colorScale.range(newColorScheme);
// here I need to repaint with colors
});
내 컬러 규모가 분위수 인 나는 처음에 미리 정의 된 색상 배열을 가지고 있고, 나는이 같은 사각형을 그릴 규모, 그래서 각 직사각형의 값을 찾기 위해 반전 함수를 사용할 수 없습니다. 데이터를 다시 읽지 않으려 고합니다. 직사각형의 채우기 색상을 어떻게 바꿀 수 있습니까? 내가 다시 데이터를 읽을 수 없다