-
Notifications
You must be signed in to change notification settings - Fork 323
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
Is Google Charts setOnLoadCallback supported? #200
Comments
HI @ToddMinear , I believe you have to write that function as in this example: https://developers.google.com/chart/interactive/docs/drawing_charts Unfortunately I don't have a lot of experience with Google Charts, but that doesn't look like an issue in the Smashing side, so I guess there isn't much else that we could do to help you |
Thanks @kinow ! I've used Smashing for years but I've never had to dig this deep into widgets. I did thoroughly read those docs, but with Smashing I don't quite get how to go from the erb file (where I load the google charts), to the coffee file (which I see has the call to google.visualization.Barchart in it). I've tried things like this (but I feel like I'm grasping at straws and guessing at function calls):
I see there are a few widgets on the Additional Widgets page that use Google Charts (they use the old API) by @machadolab and by @lizer. If I get this solved I'll post my solution. |
Thanks! I'm a bit pressed for time at the moment, but if you have a public Git repo with your dashboard I can try to take a look later (can't promise though, sorry). But I believe you are going in the right direction, look at the other widgets, at the JS library doc, and try to come up with another widget (or update an outdated widget 🙂 )
Right, the The widgest are linked by the "data-view". That attribute (like The widget's main entry point is the And the data is made available from jobs. The job will emit an event (with Now it's up to you to have a CoffeeScript, html scss, or other JS/etc files in a widget, have GoogleCharts loaded & configured when the widget is instantiated (or globally if needed! sometimes you have to add global JS and load in your erb), and finally have the widget ready to react when data is made available and to probably tell the GoogleCharts JS object about new data. Hope that helps 👋 |
Hello,
Thanks for Smashing!
I've researched/read/googled and can't find a solution - I'm hoping someone can give me a hint or point me in the right direction.
I'm using Google Charts in a bar widget. Half the time it works just fine, the other half of the time the widgets show with no data.
I'm pretty sure it's because I don't have the google.charts.setOnLoadCallback correct.
I have:
And Google Charts documentation says I should use:
Of course drawChart is undefined. I've tried to create my own drawChart() but I can't figure out what functions to call.
Here's a screenshot of the errors I'm seeing:
Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: