I have made a grid system using flex and now I insert some charts. And I try to use simple(display: flex).
When I increase the width of the screen, myChart must increase too and conversely, when i minimize .
When I increase worked correct, but when minimize, myChart didn't minimized too
I think. problem, that I use FlexBox, but answer i can't find.
Flexbox is so poorly supported in IE that I would actually recommend you to avoid it.
Besides that I have had major issues with responsive and flexbox (in Firefox and Chrome).
I think this should work if you put a div inside the flexbox container and put the canvas inside that.
@simonbrunel thoughts?
@Zulfia73 @EmilMoe can you share a fiddle that showcase this issue?
@simonbrunel I do not have any examples. Just added my experience that I had issues as well. I completely removed flexbox as it gives too many issues in IE and Edge.
As far as I remember the problem is that I need manually to redraw the graphs on resize when they are in flexbox.
It makes me think about the flex box and truncated text issue (specs): you should try to set min-width: 0
on the div (grid cells) containing charts (examples w/o min-width and w/ min-width).
@simonbrunel it might work, I read about that as well, but unfortunately the support in IE and Edge is so poor that I decided to avoid flexbox.
Closing as out of date / answered per the conversation above
documenting this for future reference:
i am seeing this on chrome 59 (electron 1.7.9). when the chart is inside of a flex container, the initial size is fine. and the responsive bits respond well to increases in the size of the container. but the chart does not respond to decreases in container size. i note this also by attaching an onResize
handler to the chart. i get callbacks for increases, but not for decreases.
https://jsfiddle.net/pgg9pz7c/1/
try growing the width of the window. observe that both charts respond well, growing in size; now try shrinking the width of the window. observe that only the lower chart responds well. the upper one, contained in a flexbox, does not respond to the shrinkage.
i also observe this behavior in firefox 57, in addition to the chrome embedded in electron 1.7.9
for future reference, the above suggestion of min-width: 0
seems to resolve this issue. not on the immediate container of the chart, but on the flex parent.
@starpit see my comment above (jsfiddle with min-width)
thanks @simonbrunel
yes, the fix requires a min-width attr in the case of nested flex boxes. thanks!
Just wanted to say thanks to @simonbrunel as well
i have been trying to find a fix for this for a while... Thank you!
Can confirm min-width: 0
on the container of the chart does the trick. Thanks @simonbrunel!
Nice @simonbrunel, thank you!
It makes me think about the flex box and truncated text issue (specs): you should try to set
min-width: 0
on the div (grid cells) containing charts (examples w/o min-width and w/ min-width).
thanks for this!
Most helpful comment
It makes me think about the flex box and truncated text issue (specs): you should try to set
min-width: 0
on the div (grid cells) containing charts (examples w/o min-width and w/ min-width).