Highcharts - 关于整个图表宽度的问题 [英] Highcharts - issue about full chart width

查看:793
本文介绍了Highcharts - 关于整个图表宽度的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Highcharts柱状图,我希望它是100%宽度响应图表。容器是一个简单的< div> ,没有任何格式。当文档加载时,图表总是固定宽度为600x400像素的大小。如果我调整窗口或切换到另一个浏览器选项卡,图表填充宽度,并成为响应全宽图表,就像我想要的。如果我重新加载页面,它是固定宽度了。我试图设置宽度到容器和图表,但是,没有什么帮助。如果我将容器div移动到父div的上一层,它工作。如何使图表在页面加载时变为全宽?

I'm using Highcharts column chart and I want it to be 100% width responsive chart. The container is a simple <div> with no any formatting. When the document loads, the chart is always fixed width 600x400px size. If I resize window or switch to another browser tab, the chart fills the width and becomes responsive full width chart just like I wanted. If I reload page, it's fixed width again. I tried setting width to both container and chart, however, nothing helps. If I move the container div one level above the parent div, It works. How to make the chart become full width on page load also?

感谢

推荐答案

图表的宽度取自 jQuery.width(container),所以如果你有一些隐藏的标签或类似的图表,宽度将是未定义的。在这种情况下,系统会设置默认宽度和高度(600x400)。

Chart's width is taken from jQuery.width(container), so if you have chart in some hidden tabs or something similar, width will be undefined. In that case default width and height are set (600x400).

这篇关于Highcharts - 关于整个图表宽度的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆