Accepted answer

Currently your best bet is to create a fake group. Really the .data method on the charts is supposed to do this, but it doesn't work for charts that derive from the stack mixin.


I believe you are asking a few questions here. I will try to answer the main question: how do you add data to a dc chart.

I created an example here:

In this example I simply add random data to the crossfilter, though this could easily be adapted to pull data from the server:

function AddData(){
  var q = Math.floor(Math.random() * 6) + 1;
  currDate = currDate.add('month', 1);
  cf.add( [{date: currDate.clone().toDate(), quantity: q}]);  
  $("#log").append(q + ", ");

I call this method once a second. Once it completes, I reset the x domain and redraw the chart.

  lineChart.x(d3.time.scale().domain([startDate, currDate]));
}, 1000);

I recommend trying to get this working in isolation before trying to add the complexity of multiple y-axis scales.

Related Query