google-chart icon indicating copy to clipboard operation
google-chart copied to clipboard

Error handling for missing loader or missing chart package

Open naoak opened this issue 8 years ago • 6 comments

Hi. I'd like to handle the title error cases.

An extreme case, Great Firewall blocks any connections to gstatic.com. Is there any way to handle this kind of errors?

naoak avatar Jul 01 '16 08:07 naoak

Additionally, if gstatic.com site is down, loading loader.js blocks whole scripting until it is timeouted. I think we should load external scripts by IronJsonpLibraryBehavior as it used to be.

naoak avatar Jul 04 '16 03:07 naoak

I tried rewriting the codes by using IronJsonpLibrary, but it did not go well because loader.js does not support jsonp loading...

naoak avatar Jul 04 '16 06:07 naoak

Yes, that was the original reason that the google-api-loader was dumped. But then the loader.js did not support being loaded more than once...

We could do some magic, but not being able to access gstatic.com is probably an issue specific to only the great firewall... so it doesn't really make sense to me to do so in this component. I think it makes the most sense for the new loader to have a compatible component that we could make use of here.

Until then, you may just need to fork your own copy that is able to work around it until a permanent solution is available.

wesalvaro avatar Jul 10 '16 12:07 wesalvaro

@wesalvaro Thanks for your clarification and suggestion. Actually, I've already created its fork here, that works fine for now. I've not tried, but I might be able to do the similar by lazy loading google-chart component itself.

naoak avatar Jul 11 '16 02:07 naoak

Unfortunately, I've decided to not use google chart due to the performance issue. I was using this component for drawing a simple line chart, but this component loaded so many library files which are totally almost 1MB without gzipped. I could not ignore the payload just for the one chart.

I might not participate, but I hope google-chart for further development. If you think you don't need this feature, please feel free to close. Thank you till now.

naoak avatar Aug 03 '16 07:08 naoak

I'm not sure how that's possible. It loads only the necessary amount of data for Google Visualizations for a line chart.

Here is my network panel for the chart demo page. The demo page loads all possible chart packages and data for demo purposes. Loading all packages It only loads ~425KB for everything. Most of it is in the UI module. Here is the network panel for loading only a line chart. Loading only Line chart It only loads ~325KB for a line chart. The content looks gzip encoded to me, too.

Of course, maybe the biggest part of these downloads is features you are not directly utilizing, features like DataTables, DataViews, Queries, Formatters, localization, cross-browser support etc.

For a simple line chart there are probably other much smaller and still sufficient libraries, though. Which did you decide to go with?

wesalvaro avatar Aug 05 '16 06:08 wesalvaro