barchart on filter, first bar not disappearing correctly, animation wrong.
See original GitHub issueI’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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
D3.js bar chart animation not exiting correctly - Stack Overflow
The problem though that I am running into is that the right most bar chart is getting removed instead, another bar is pushed...
Read more >How to Use Animation in Bar Chart on Load in Chart JS
In this video we will explore how to use animation in bar chart on load in chart js. Chart.js has some great animation...
Read more >Bars not rendering or disappearing while and after dragging
I've created a bar chart using BarChartView. The view displays work hours per day. Unfortunately, some bars are not rendered at all -...
Read more >Labels disappearing during animation. - Tableau Community
I tried to create a similar running bar chart by following the steps shown here, and its working fine for me.
Read more >Trying to create animated bar plot with sliding bars that ...
I've been struggling to create an animated data over time bar chart for months now. My goal is to have bars that slide...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, there are a lot of problems with the animated transitions.
Rather than attempt to diagnose the particular problem you’re facing here, can I ask you to try out one of the feature branches which will go into dc.js 2.1?
I’ve set up a temporary branch
bar-transitions
: https://github.com/dc-js/dc.js/tree/bar-transitionsOr if you want a direct http link, you can use this: https://rawgit.com/dc-js/dc.js/bar-transitions/dc.js
The big difference is key-based joins. But there are many other refinements to the transitions as well.
Yeah I’m using DC within a ES6 app that uses webpack and node. It’s working alright right now, but I can’t switch to other branches (as far as I know) and it’s for a client so it needs to be perfectly stable. Next month sounds good, I just ask so I can give my client a (rough) timeline about the issue. They’re using it only for company stuff only so it’s not that important that it works perfectly right away.