开发者

Insert database data into Google charts?

开发者 https://www.devze.com 2023-03-30 22:59 出处:网络
I\'m thinking about going with Google charts for a project I\'m working on. I have all my data on my own server and so I was wondering what is the best way to go about inserting this data into a chart

I'm thinking about going with Google charts for a project I'm working on. I have all my data on my own server and so I was wondering what is the best way to go about inserting this data into a chart, there are a few alternatives:

  1. Create th开发者_如何学运维e DataTable object from data that is provided inline. That is, print all the data into the HTML document. This will crowd out everything else since I have a lot of data, but I don't know if this is important. This way we can avoid one HTTP request.
  2. Dynamically create a .js files for every request, holding the data, and letting it be included with a script tag in the document.
  3. Retrieve the data using ajax (Google suggests this in their documentation)
  4. Using the chartwrapper and adding a datasource pointing to my own server. This would be equivalent to the above, I suppose, and functionally equivalent to (2).

So what is the most common solution? What do you usually solve this?


I wouldnt worry about crowding out your data. Printing it out into a javascript datatable wont be visible to the user, and the browser wont care. However I would suggest you only print out what you need for each page so you dont have more than required.

I think probably any of your solutions are fine, so pick the one that suits you best.

0

精彩评论

暂无评论...
验证码 换一张
取 消