Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

paddingOuter gets me a huge outer padding

I have a bar graph at http://hahnsb0579.liveblog365.com/ and currently having an issue with the paddingOuter.

I get a huge padding at the top if I set .paddingOuter(0.11).
but if I change it to .paddingOuter(0.10), seems like it’s just working fine.
I’ve been trying to solve this issue for 2 days already but couldn’t solve it.

The key piece of code related to this issue is as below.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

const yScale0 = d3.scaleBand()
                .domain(nexMeritDataObjBefore.members.map(function (e) {
                    return e.name;
                }))
                .rangeRound([0, yRangeMax])
                .paddingOuter(0.11)
                .paddingInner(0.2)
                .align(0.8)

>Solution :

The documentation for band.round (which is used by rangeRound) says:

Note that if the width of the domain is not a multiple of the cardinality of the range, there may be leftover unused space, even without padding!

Therefore, a simple solution is just using range instead:

.range([0, yRangeMax])
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading