Len5inG
Len5inG

Reputation: 11

Highcharts Chart is not completely hidden if the smartGWT Layout id hidden

I build an app using smartGWT (3.1) (GWT: 2.5).

To hold changes to the various views (scrollbar-position in ListGrids etc.) I add all the views to the main canvas and just change their visibility (show() / hide())

  (hide() all children then show() the one which was selected in the menu)

This works fine until I use hichcharts (gwt.highcharts-1.5.0.jar / highcharts.js -> 2.3.5). no difference if I wrap the Chart in a smartGWT or GWT widget, when I hide the views some elements of the chart stays visible.

Ledgend-background, Ledgend-lines, and some dots from the data-points stays visible. It happens in firefox 18.0.2 and IE 9. In Chrome (24.0.1312.57 m) it works.

I try TabSet aswell. when i switch tabs (which should hide the 'old' tab) the same elements of the chart stays visible.

besides of the visibility-problem the still active Listener from the chart are another problem.

summary: highcharts chart do not hide proper when parent-widgets hide (in firefox & IE).

Upvotes: 1

Views: 742

Answers (2)

livinston
livinston

Reputation: 1338

I had the same issue. I solved it by adding a tabSelectedHandler to the tabSet and inside that I show or hide the charts using StockChart.setVisible(boolean) depending on the selected tab.

tabSet.addTabSelectedHandler(new TabSelectedHandler()
{
    @Override
    public void onTabSelected(TabSelectedEvent event)
    {
        if (event.getTab().getTitle().equals("Charts"))
        {
            chart.setVisible(true);
        }
        else
        {
            chart.setVisible(false);
        }
    }
});

Upvotes: 1

gpapaz
gpapaz

Reputation: 909

For the display issues, and since you didn't provide any code example, I have used the wrapper provided on GWT Highcharts forum. With correct usage of hide/show calls (e.g. when tab is selected or deselected, call show or hide, respectively) I have managed to overcome the issue described in all browsers.

Upvotes: 1

Related Questions