当包含在基于jQuery的选项卡中时,Google图表的加载极小 [英] Google Chart loads extremely small when included in jQuery-based tabs

查看:153
本文介绍了当包含在基于jQuery的选项卡中时,Google图表的加载极小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Google的折线图,几乎完全像演示 - 只有数据已更改 - 在此jQuery选项卡插件内,无需修改。也许50%的时间,图表将加载在400x200,即使它已被指定加载在700x250。包含的div将具有适当的宽度和高度,但是由API呈现的图表将在400x200的内部加载。

I am using Google's line chart almost exactly as the demo - only the data has changed - inside of this jQuery tab plugin with no modification. Maybe 50% of the time, the chart will load at 400x200 even though it has been specified to load at 700x250. The containing div will have the proper width and height, but the chart as rendered by the API will load inside of that at 400x200.

我怀疑这是因为标签是在API尝试呈现时显示。因此,它试图渲染在它认为null的东西,因此强制自己进入最小的默认分辨率。

I suspect this is because the tabs aren't being displayed when the API tries to render. Because of that, it tries to render in something it considers null and therefore forces itself into the smallest default resolution.

我的想法是,如果图表的显示可以延迟到相应的选项卡被点击,它会解决问题。可悲的是,我不知道如何做到这一点,我的研究没有成果。我能找到的最近的是此主题 ,但我没有找到任何真正的答案。

My thought is that if the display of the chart can be delayed until the appropriate tab is clicked, it would resolve the problem. Sadly, I have no idea how to do that, and my research hasn't been fruitful. The closest I could find is this thread, but I didn't find any real answers there.

如果你有任何建议,我会很感激,我很乐意跟进更多信息

I'd appreciate any advice if you have any, and I'd be glad to follow up with more information if necessary.

推荐答案

更改图表选项,根据需要设置宽度和高度

change chart options to set the width and height as you need

var options = {
          title: 'Company Performance'
          ,width:900
          ,height:500
        };

这篇关于当包含在基于jQuery的选项卡中时,Google图表的加载极小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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