dc.js icon indicating copy to clipboard operation
dc.js copied to clipboard

added caution message for mouse-zoomable conflict with elasticX

Open privateOmega opened this issue 5 years ago • 5 comments

@gordonwoodhull I found that I was unable to zoom-in to my graph even with mouseZoomable(true) and documentation didn't explicity specify this case.

After some googling I found your answer in SO, and I thought users in future shouldn't be wasting time on this. The commit contains update in documentation and rebuild docs.

This can be removed once the below is the case.

dc.js should only "elast" the X domain once (on render) if both options are set

privateOmega avatar Nov 25 '19 07:11 privateOmega

Thanks @privateOmega! Related: #987, elasticX is not compatible with focus chart.

I am tempted to do what is probably expected and turn off elasticX after the first render, in either case.

(Or perhaps, since it would also be surprising for a parameter to change on its own, define elasticX as only active on render not redraw, if either of these features are enabled.)

gordonwoodhull avatar Nov 25 '19 14:11 gordonwoodhull

@gordonwoodhull Since you have plans to fix it. I am abandoning the PR.

privateOmega avatar Nov 26 '19 10:11 privateOmega

I’m going to reopen this as a reminder to fix this. I’m currently on vacation but I think it will be a quick fix when I get back.

Otherwise I think we would have to document it in at least three places!

gordonwoodhull avatar Nov 26 '19 13:11 gordonwoodhull

@gordonwoodhull Sure. Sounds perfect.

privateOmega avatar Nov 26 '19 14:11 privateOmega

I started this on the elasticX-only-render branch, if anyone wants to try it out.

So far I am seeing focus charts getting set to [x1, 1] instead of [x1, x2], and getting reset to either [0, 1] or [1, 1] when the selection is cleared, so I clearly missed something.

Besides calculating the domain only on render, it also sets _originalDomain when rendered. (mouseZoomable charts will not allow the domain to exceed the original domain, and also return to the original domain when the focus is cleared.)

Everything works and I have converted many of the examples to use elasticX instead of setting the domain manually.

I did see a performance regression on the "focus dynamic interval" example, which I'll need to look into before releasing this (as 3.2, to be merged into 4.0, also to be released soon).

gordonwoodhull avatar Dec 13 '19 17:12 gordonwoodhull