最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Highcharts + Bootstrap .table-responsive issue - Stack Overflow

programmeradmin4浏览0评论

When I put my chart inside of Bootstrap's .table-responsive the chart doesn't fill the entire td. Here's a jsFiddle of the problem. As you might see I've set the width to 100%, and this worked in the grid.

There seems to be a strange bug aswell, when I open the chrome console with "Inspect element" the problem is solved (happens in the jsFiddle aswell).

How can I make the chart fill the entire <td> by default?

When I put my chart inside of Bootstrap's .table-responsive the chart doesn't fill the entire td. Here's a jsFiddle of the problem. As you might see I've set the width to 100%, and this worked in the grid.

There seems to be a strange bug aswell, when I open the chrome console with "Inspect element" the problem is solved (happens in the jsFiddle aswell).

How can I make the chart fill the entire <td> by default?

Share Improve this question edited Mar 4, 2014 at 17:19 Jack Bonneman 1,80518 silver badges24 bronze badges asked Mar 3, 2014 at 13:44 justanotherhobbyistjustanotherhobbyist 2,1904 gold badges29 silver badges40 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You'll have to set the width setting of chart after initialization. After initialization, Highcharts only adapts on a resize event (try it out, if you resize the window it will change width), so you might want to trigger an resize event.

Here is a jsFiddle (ab)using a resize event: http://jsfiddle/b9DMn/1/

Highcharts does automatically gets the width of its container when its creating its chart, but if you put a breakpoint there you'll see that the table cells are still divided equally at that point in time. In fact, it is the chart that triggers the table to grow the right cell. If you can fixate the cell width, that would probably help too.

Here is a jsFiddle fixating the width of the cells, so they don't grow and shrink when content gets added: http://jsfiddle/b9DMn/2/

发布评论

评论列表(0)

  1. 暂无评论