Billboard.js: Chart doesn't get smaller in flex container

Created on 28 Oct 2017  路  9Comments  路  Source: naver/billboard.js

Description

The charts generally resize like they should, but in a flex container they get bigger, but not smaller

Steps to check or reproduce

https://codepen.io/forsakenharmony/pen/LzKJpV?editors=0010

Open page, resize browser

Most helpful comment

@ForsakenHarmony check out the milestone.

The coming release will be Dec. 15th.

All 9 comments

thanks @ForsakenHarmony for the report. I'll try to check the issue soon. :)

Did you have time to check it yet?

Hi, sorry to be late. I鈥檓 spending time for other issue, after finishing that I鈥檒l be into for this :)

For resize, internally is binded resize event to window.

Then when resize happens, it flows:
→ onresize callback (if option is set) → .flush() → onresized callback (if option is set)

This issue is related with the #155 and need to look more detail on .flush() API.
I'll dig into it, and will comment again when there's an update.

For size adjustment, it try to get its parent node width value.
To get that, it uses:

  • element.getBoundingClientRect().width or
  • element.offsetWidth in case of error.

https://github.com/naver/billboard.js/blob/a9a1e0918a53a2d77d43b58e5d55e9b619df7ea2/src/internals/size.js#L88-L99

But, figure out that in some cases(like this one), it's returning wrong value.
window.innerWidth is smaller than the value which was retrived.

So, for that circumstances, will be updated to use window.innerWidth instead.

Cool
when are you gonna release it?

@ForsakenHarmony check out the milestone.

The coming release will be Dec. 15th.

it still seems broken
check the pen

@ForsakenHarmony, for resizing it takes from the bound element's parent's width value.

At the initialization, it will take the current width value of the rendered element.
So, in this case will get the correct width, but when chart is rendered, the parent will remain same width as chart's width, because the chart width will remain same as before without changing.

To fulfill with your need, add additional CSS style width property value on each column.

.column{width:50%}

And will work as below.
resize

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madflow picture madflow  路  4Comments

mafar picture mafar  路  4Comments

SoYoung210 picture SoYoung210  路  5Comments

stevenmusumeche picture stevenmusumeche  路  3Comments

imbyungjun picture imbyungjun  路  5Comments