在 jQuery TOOLS 选项卡中加载 Google 带注释的时间轴
我正在开发一个 jQuery 插件,使用 Google 带注释的时间轴可视化。
我有一个页面使用 jQuery TOOLS Tabs 来显示多页图表,我有很多页面已经使用 Web 服务通过静态 img 标签生成的图表进行创作,我的插件通过用 div 替换 img 标签,然后从同一服务中提取原始数据并将其放入该 div 上的 Google 图表中,将这些图像替换为可视化效果。
一切都运行良好,我的图表加载(缓慢),当它们触发就绪事件时,我将日期范围设置为过去两周。
我的问题是,当从另一个选项卡切换回主选项卡时,图表将返回显示整个时间线,而不仅仅是最近两周,并且就绪事件不会再次触发以触发我的日期范围选择代码。
有没有办法在切换选项卡的 jQuery 事件上强制更新所有图表?或者,当谷歌图表对象变得可见时,是否会触发一个事件?
更新:这似乎仅在 IE8 中有效,在选项卡之间切换时图表日期范围保持不变。我在 Firefox 4、Chrome(开发频道)和 Safari 5 中遇到了这个问题。
I'm working on a jQuery plugin to build up tabbed pages of charts using the Google Annotated Timeline Visualization.
I have a page using jQuery TOOLS Tabs to show multiple pages of charts, I have numerous pages already authored using charts generated by a web service through static img tags, my plugin replaces those images with a visualization by replacing the img tag with a div and then pulling the raw data from the same service and dropping it into the Google chart on that div.
Everything works pretty well, my charts load up (slowly) and when they fire the ready event I set the date range to be the last two weeks.
My problem is that when switching back to the main tab from another tab the charts return to showing the entire timeline, not just the last two weeks and the ready event does not fire again to trigger my date range selection code.
Is there a way to force an update to all the charts on the jQuery event of switching tabs? Alternatively is there an event that fires on a google chart object when it becomes visible?
Update: This appears to work ONLY in IE8, the chart date ranges stay when switching between tabs. The issue i'm having crops up in Firefox 4, Chrome (dev channel) and Safari 5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过在切换选项卡时完全重新加载图表来解决这个问题,这很慢并且有点令人沮丧,但它确实有效。
I solved this by reloading the charts completely when I switch tabs, it's slow and slightly frustrating but it does work.