DC.js热图cols和行过滤不起作用

时间:2015-12-30 08:37:17

标签: javascript json d3.js dc.js crossfilter

我有一张热图,由于某些原因我不能选择行和列。我可以选择单独的盒子,但选择不可见(即其他盒子不会变灰) 该代码几乎是the example的复制粘贴,但是是其他4个图的一部分。 我使用v2.1.0-dev(从Github大约2天)

我在某处看到它可能与需要序数的音阶有关,但我不确定如何在热图中设置它...

我的热图代码:

parameters

@orderColumn  int ,
@orderDir  varchar(20),
@start  int ,
@limit  int


select * from items
WHERE        (items.status = 1) 
order by 

CASE WHEN @orderColumn = 0 AND @orderdir = 'desc' THEN items.[category] END DESC,    
CASE WHEN @orderColumn = 0 AND @orderdir = 'asc' THEN items.[category] END ASC,    
CASE WHEN @orderColumn = 1 AND @orderdir = 'desc' THEN items.[category] END DESC,
CASE WHEN @orderColumn = 1 AND @orderdir = 'asc' THEN items.[category] END ASC,
CASE WHEN @orderColumn = 2 AND @orderdir = 'desc' THEN items.[category] END DESC,
CASE WHEN @orderColumn = 2 AND @orderdir = 'asc' THEN items.[category] END ASC

OFFSET @start ROWS FETCH NEXT @limit ROWS ONLY

一些数据:

var dayBurnChart = dc.heatMap("#day-heat-map");
var dayDim = ndx.dimension(function(d) {return [+d.DayWeek, +d.Week]});
var dayTotal = dayDim.group().reduceSum(function(d) {return +d.afzet;});

dayBurnChart
    .width(450).height(250)
    .dimension(dayDim)
    .group(dayTotal)
    .keyAccessor(function(d) {return +d.key[0];})
    .valueAccessor(function(d) {return +d.key[1];})
    .colorAccessor(function(d) {return +parseFloat(d.value).toFixed(2);})
    .colsLabel(function(d) {return weekNames[d]; })
    .colors(["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8"])
    .calculateColorDomain();

Date Parser:

var data = [
    {"date": "1-10-2015",   "afzet": 603.58},
    {"date": "2-10-2015",   "afzet": 523.25},
    {"date": "3-10-2015",   "afzet": 392.92},
    {"date": "4-10-2015",   "afzet": 420.5},
    {"date": "5-10-2015",   "afzet": 574.66},
    {"date": "6-10-2015",   "afzet": 478.03},
    {"date": "7-10-2015",   "afzet": 586.3},
    {"date": "8-10-2015",   "afzet": 539.46}
];

0 个答案:

没有答案