Create google chart and convert to image server

I currently have Google charts implemented in several places on my site and I can convert them to images and upload them. It was easy.

Now I hope to create these diagrams and convert them to images on the server.

I searched many times, and I had no examples of this, and there were no questions either, which makes me think that this is impossible.

I know that these diagrams are usually created at runtime using javacript in a client browser, so I think I am wondering if there is a way to run javascript on my server without a browser, and also create and save these images

I was told about server-side javascript yesterday, until then I had no idea that it exists, but could this be an option?

Is there a way to emulate a browser in .NET and display an image? Can I launch a browser on a server and get an image?

Is there any other way to do this?

Or is this idea simply impossible?

+2
javascript c # google-visualization charts
source share
2 answers

One option you have is to use a browser without a browser to execute code locally, and then extract the image from it. Take a look at PhantomJS examples to see what is possible.

http://phantomjs.org/examples/

If you need to run this from time to time, it would be ok to just use standalone phantomjs for every request you need, but if you are going to use it often, look at the screenshot projects listed here http://phantomjs.org/related-projects .html

Some of them start the node server, so you do not need to run phantom all the time, and this will save you runtime. It is worth it if you first try to create a standalone solution and find that it is too slow.

+2
source share

PhantomJS is an option that works well. My team at vida.io developed a cloud-based image creation solution for a website. It is optimized for svg (in particular, for visualizing d3.js data). But it can be used to create an image for any element within the website.

Check out our web interface:

http://image.vida.io/

You can use our server or run your own. Server stack - nodejs.

+2
source share

All Articles