I have been working with dc.js for the past few weeks, but there is one problem that I just cannot understand.
I want to be able to change the scales of four different diagrams based on one diagram with a brush filter. Sort of:
priorityTotChart .width(2*w/3).height(h/3) .margins({top: 10, right: 50, bottom: 20, left: 40}) .dimension(dateDim) .group(priorityTotal) .centerBar(true) .gap(1) .x(d3.time.scale().domain([minDate,maxDate])) .elasticY(true) .brushOn(true); var translate = 3; priority1Chart.width(w/3) .height(h/6) .transitionDuration(300) .margins({top: 10, right: 50, bottom: 25, left: 40}) .dimension(dateDim) .group(priority1) .mouseZoomable(false) .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.months) .elasticY(true) .brushOn(false) .ordinalColors(["red"]) .rangeChart(priorityTotChart) .yAxisLabel("Hits per day") .renderArea(true) .renderlet(function (chart) { chart.selectAll("g._1").attr("transform", "translate(" + translate + ", 0)"); }); priority2Chart.width(w/3) .height(h/6) .transitionDuration(300) .margins({top: 10, right: 50, bottom: 25, left: 40}) .dimension(dateDim) .group(priority2) .mouseZoomable(false) .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.months) .elasticY(true) .brushOn(false) .ordinalColors(["orange"]) .rangeChart(priorityTotChart) .yAxisLabel("Hits per day") .renderArea(true) .renderlet(function (chart) { chart.selectAll("g._1").attr("transform", "translate(" + translate + ", 0)"); }); priority3Chart.width(w/3) .height(h/6) .transitionDuration(300) .margins({top: 10, right: 50, bottom: 25, left: 40}) .dimension(dateDim) .group(priority3) .mouseZoomable(false) .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.months) .elasticY(true) .brushOn(false) .ordinalColors(["blue"]) .rangeChart(priorityTotChart) .yAxisLabel("Hits per day") .renderArea(true) .renderlet(function (chart) { chart.selectAll("g._1").attr("transform", "translate(" + translate + ", 0)"); }); priority4Chart.width(w/3) .height(h/6) .transitionDuration(300) .margins({top: 10, right: 50, bottom: 25, left: 40}) .dimension(dateDim) .group(priority4) .mouseZoomable(false) .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.months) .elasticY(true) .brushOn(false) .ordinalColors(["green"]) .rangeChart(priorityTotChart) .yAxisLabel("Hits per day") .renderArea(true) .renderlet(function (chart) { chart.selectAll("g._1").attr("transform", "translate(" + translate + ", 0)"); });
However, this method does not work, since only the last chart that uses .rangeChart(priorityTotChart) is .rangeChart(priorityTotChart) .
I can get around this problem by making each chart depend on the range of the previous chart, i.e. priority1Chart has .rangeChart(priorityTotChart) , and priority2Chart has .rangeChart(priority1Chart) , etc., but this method is very slow. So, I was hoping there was a better way to achieve the same effect?
Thanks in advance!