Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x axis not changing on date range change #791

Closed
gordonwoodhull opened this issue Dec 11, 2014 · 3 comments
Closed

x axis not changing on date range change #791

gordonwoodhull opened this issue Dec 11, 2014 · 3 comments
Labels
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

Perhaps related to #790, in this case it looks like the scale is not changed correctly.
http://stackoverflow.com/questions/25710058/dc-js-x-axis-not-changing-on-date-range-change

It could be due to the too-complicated domain comparison code which will not work for dates because it uses !== (when comparison is not needed at all).

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Dec 11, 2014
@awojtas
Copy link

awojtas commented Jun 9, 2015

Also having similar issue. Have added an onClick handler to update xAxis when the crossfilter is changed but the x-axis labels don't update.

My onClick:
$('#dcChartTime').on('click', function(){
var minDate2 = timeDimension.bottom(1)[0].dtt;
var maxDate2 = timeDimension.top(1)[0].dtt;
console.log("Range from '" + minDate2.toString() + "' to '" + maxDate2.toString() + "'");
dcChartTime.x(d3.time.scale().domain([minDate2,maxDate2]));
dcChartTime.rescale();
dcChartTime.redraw();
});

This is after page load:
2015-06-09 12_06_46-mozilla firefox

And then I click "2014" on another pie chart, so the data is filtered but the graph isn't scaled:
2015-06-09 12_07_27-mozilla firefox

And then I trigger the onClick event by clicking somewhere in the graph itself and the chart becomes scaled but the x-axis isn't updated:
2015-06-09 12_08_14-mozilla firefox

I'm using the latest as of now 2.0 beta 11. The data is not able to be made public so I can't create a fiddle unfortunately.

@gordonwoodhull
Copy link
Contributor Author

Thanks @awojtas, I misunderstood this bug the first time around, so your images helped a lot.

It turns out that the axes did not respond to a rescale, only to a zoom event or a render. I have fixed this, and also made it unnecessary to call .rescale() when setting the x or y scales. (It is still necessary to call rescale when changing just the domain of the scale.)

@awojtas
Copy link

awojtas commented Jun 9, 2015

That was quick! Will keep an eye out for next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants