https://jsfiddle.net/2nuhdrf0/488/ 关于这个小提琴
为什么这样做
select2
.dimension(dateDimension)
.group(dateDimension.group())
.multiple(true)
.controlsUseVisibility(true)
.title(kv => kv.key)
而不是
select2
.dimension(yearDimension)
.group(yearDimension.group())
.multiple(true)
.controlsUseVisibility(true)
.title(kv => kv.key)
意味着过滤在第一种情况下有效,而在第二种情况下无效?
当维度都返回整数
var dateDimension = cf.dimension(function(d) { return d.Created.getFullYear() })
var yearDimension = cf.dimension(function(d){
// alert(typeof(d.Year))
return +d.Year})
var sales = remove_empty_bins(yearDimension.group().reduceSum(function(d) {return d.sales;}));
var gp = remove_empty_bins(yearDimension.group().reduceSum(function(d) {return d.gp;}));