jQuery UI Tabs and Highcharts display/rendering issue

前端 未结 13 2369
长发绾君心
长发绾君心 2020-12-28 18:57

Anyone ever used the tabs (jquery-ui-1.8.9) and pie charts from Highcharts 2.1.4 together? To put it simply, I have multiple tabs, where each tab s

13条回答
  •  情深已故
    2020-12-28 19:24

    I had a jQuery accordion that was opening with garbled charts... this was my solution:

    first is stuffed the charts in a global: window.myNamespace.charts.#{container_id}, and then in my accordion i do this:

    $('#my-accordion').accordion
      ...,
      change: () ->
        chartId = ui.newContent.find('.highcharts-container').parent().attr('id')
        window.myNamespace.charts[chartId].setSize(248,220) if chartId?
    

    the above is coffeescript, but it should be easy enough to translate...

    basically i'm calling setSize on the chart to set it to the size it already is... this has the effect of cleaning up the chart after it opens... which i'll admit is just a workaround... ideally highcharts fixes the bug and uses the size i'm giving them instead of trying to calculate the size from a hidden element

提交回复
热议问题