-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Bar charts: Allow xUnits to depend on width/height / override on render #970
Comments
I really hate |
I think the problem is more that the chart cannot determine a sane default width for the bars (hence the xUnits). Here's what the chart looks like when there's no xUnits (bulky, too wide): With xUnits & rescale on width/height change, I see no difference. Changing the width/height without having to |
Right, I wish there were a good way to determine bar widths without I just double-checked, and calling I've solved the svg resize-on-redraw problem in 2.0 beta 15. Let me go ahead and push that now - please let me know if it helps. |
Yep, now changing the width/height works as expected using |
Yep, this issue is fixed, closing. |
Great, thanks for the cogent and precise reports as always! |
Use-case: composite chart that consists of multiple bar charts. The extent of values for these figures can differ significantly as they are drawn dynamically. That is also why I've had problems in determining the correct xUnits as in one case an integer precision is the correct, while in another it could be fractions of a thousand.
To overcome this problem, I use a value
45
forxUnits
. This works reasonably well if the figure width/height are adequate.The problem now: Once the chart is initially drawn to some width/height, the xUnits is locked and cannot be overridden by setting it again and calling
render()
.The first figure is the initial draw (
xUnits=45
). The second figure is larger but still uses the same xUnits value: as you can see, the bars are too narrow. If I could resetxUnits
to have it depend on the new width/height and then call render, the bar width could be more appropriate.I really wish
dc.js
will address the resize support in the coming versions. For the time being, are there any workarounds for my problem? One solution that comes to mind is to completely erase the figure and then create it from scratch, but that seems excessive.The text was updated successfully, but these errors were encountered: