Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading and No data to display are overlapped. #4588

Closed
fizerkhan opened this issue Sep 19, 2015 · 11 comments
Closed

Loading and No data to display are overlapped. #4588

fizerkhan opened this issue Sep 19, 2015 · 11 comments

Comments

@fizerkhan
Copy link

@fizerkhan fizerkhan commented Sep 19, 2015

I uses option of loading: true to show the message of Loading while fetching the data. I also uses no-data-to-display.js module to display a message for pie chart.

But no data to display is message shown along with Loading message. Can we hide no data to display message while loading?

@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Sep 21, 2015

That snippet should do the thing:

    chart: {
        events: {
            load: function() {
                this.showLoading(); // show loading message
                this.hideNoData();  // hide no data message
            }
        }  
    },

But for some reasons it doesn't work: http://jsfiddle.net/594ntok2/ Looks like chart.events.load is called before event added this way: H.addEvent(chart, 'load', handleNoData); (from no-data-to-display.js module).

@jandillmann
Copy link

@jandillmann jandillmann commented Jun 8, 2016

Is there a workaround for this? Having both messages shown overlapping doesn't make much sense…

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Jun 9, 2016

@oysteinmoseng
Copy link
Member

@oysteinmoseng oysteinmoseng commented Jun 9, 2016

@jandillmann: The most "politically correct" workaround is perhaps to override chart.hasData to return true once data is being loaded. Alternatively, you can override chart.showNoData to do nothing. Remember to restore the old functions when loading has finished if you still want the no-data message to appear (e.g. when hiding series). Demo: http://jsfiddle.net/594ntok2/1/.

@oysteinmoseng oysteinmoseng self-assigned this Jun 9, 2016
@oysteinmoseng oysteinmoseng added this to the 5.0.11 milestone Mar 29, 2017
@jon-a-nygaard jon-a-nygaard modified the milestones: 5.0.12, 5.0.11 May 18, 2017
@TorsteinHonsi TorsteinHonsi removed this from the 5.0.12 milestone May 23, 2017
@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented May 23, 2017

Is this still valid? Can't reproduce it.

@oysteinmoseng
Copy link
Member

@oysteinmoseng oysteinmoseng commented May 23, 2017

@TorsteinHonsi Seems valid, see master demo vs bugfix demo.

@oysteinmoseng
Copy link
Member

@oysteinmoseng oysteinmoseng commented May 23, 2017

Note that Chart.hasData should return chart.loadingShown, not false. That fix-commit seems to just delete the return statement, but the actual code line in bugfix is chart.loadingShown; // #4588. None of the series have data, but don't show message if we are loading.

@scottadmi
Copy link

@scottadmi scottadmi commented Aug 17, 2017

This solution does not seem to address the case in which the graph is initially displayed empty (with the no data message), and the chart showLoading() is subsequently called (to indicate data refresh is being attempted) - in which case neither or "load" or "redraw" event are fired to reassess this message.

@KacperMadej
Copy link
Contributor

@KacperMadej KacperMadej commented Aug 17, 2017

@scottadmi Could you provide a live demo for the case?

@scottadmi
Copy link

@scottadmi scottadmi commented Aug 18, 2017

The second chart demonstrates this case. In our real usage, we poll for the presence of data at certain intervals, but show the user "loading" during these attempts so they are aware which creates the odd effect in the second pane if there was no data initially.

http://jsfiddle.net/bjooth9q/2/

@KacperMadej
Copy link
Contributor

@KacperMadej KacperMadej commented Aug 18, 2017

In this case before showing the loading info you could hide the no-data label - http://jsfiddle.net/bjooth9q/3/ This doesn't require redrawing of a chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants