I am currently creating a google chart via google visualization and I want to be able to refresh/update this chart on a button click. I've tried a lot of different ways to do this but none of it works so I'm looking for any suggestions that anybody can make. My current platform is ASP.net (with C#) and the google stuff is written in javascript/jquery (obviously). Thanks!
相关问题
- Is there a limit to how many levels you can nest i
- Sorting 3 numbers without branching [closed]
- How to toggle on Order in ReactJS
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
Gviz has the option to populate charts with JSON data, so, you can do this with jquery easily enough simply by making a call to your server to get a new set of data, having it return JSON, then passing this to a function that draws your charts.
Your jquery/javascript wil look something like this:
With regard to correctly formatting your JSON response, there are a couple of libraries out there to help you, though I don't know of anything specifically in the languages you mentioned. Here's one in python for example.
If you're struggling, you can just dump out all of your entries in an array as follows:
and use google.visualization.arrayToDataTable to interpret it when it arrives back from your server as JSON.
Hope that helps.