Skip to content

barchart on filter, first bar not disappearing correctly, animation wrong.  #1262

@akuji1993

Description

@akuji1993

I've been searching a lot in dc.js-related SO questions and github issues, but can't find an answer to this problem. I have the following barChart in my project. It's a pretty standard definition. In the following gif you can see what happens: http://imgur.com/a/ggnm4

When I filter data in another chart, the bars are moving and readjusting correctly, but the first bar of the chart only disappears when the animation is done. I have no idea how to solve this.

Chart definition is currently this:


chart
  .margins(this.margin)
  .width(this.width)
  .height(this.height)
  .group(fakeGroup)
  .dimension(dimension)
  .x(d3.scale.ordinal())
  .xUnits(dc.units.ordinal)
  .y(d3.scale.log().domain([minimum, this.getMax(yValue)])
    .range(this.height, 0)
    .nice()
    .clamp(true)
  )
  .xAxisLabel(this.xAxisLabel)
  .yAxisLabel(this.yAxisLabel)
  .elasticX(true)
  .title((d) => {return d.key + ': ' + d.value;})
  .ordinalColors(this.color)
  .on('renderlet', (chart) => {
    chart.selectAll('g.x text')
      .attr('dx', '-10')
      .attr('transform', 'rotate(-55)');
  })
  .on('filtered', (chart) => {
  });

chart.ordering((d) => -d.value);
chart.yAxis().ticks(15, ",d").tickSize(5, 10);

window.addEventListener("resize", () => {
  this.calculateSize();
  chart.width(this.width);
  chart.height(this.height);
  chart.transitionDuration(0);
  chart.rescale();
  chart.redraw();
  chart.transitionDuration(750);
});

Edit: I also can't seem to figure out, how I can get the yAxis to rescale on filter, so it gets down or upscaled on filter events. Any help with that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions