Monday, December 17, 2007

Google Chart API


This chart was made using Google Chart API.

After Playing for a while trying to generate the previous plot I couldn't use google API properly. I had to generate the plot on my personal website save it to disk and post it. This API is a great way to make real-time charts, but for some reason it doesn't work within blogger it must disabled for security issues or something.

There is a couple of things I don't like about the API, and some serious limitations so I will stick to gnuplot. but it's nice to have different options with different capabilities.

The biggest problem I find with this API is that you must format your data to make it compatible with the API. Lets say you are running a simulation, and your output data ranges from 1 Tesla to 7.24 Teslas dependent on Temperature, you will need to map the data from 1 to 100, label the chart appropriately so it reads 7.24 on the highest data point and make sure your Temperature interval is uniform. It's not a difficult transformation but it's annoying.

On the other hand, if you are running your simulation on a server, you can easily modify your program so it will write a preview output. Lets say 1 of every 100 points calculated goes to this preview output. And make a web page you can access from any computer with firefox. The web page will then plot in real time what this preview output file looks like. It's also possible to make a web page that will take track of several simulations running on different servers (computers).

The code used to generate the chart is:

<img src="
http://chart.apis.google.com/chart?
cht=lc
&chco=ff0000,00ff00,0000ff
&chs=200x125&chd=t:0,0,0.3,0.7,1.2|0,0.3,1.4,3.1,5.3|0,0.8,3.9,8.7,15.2
&chxt=x,y
&chxl=0:|0|1.0|2.0|1:||20||60||100"
>

1 comment:

Anonymous said...

I saw that your comment about the Google Chart API.

If you are interested in data analysis and visualization, you might also be interested in my book "Gnuplot in Action", which has a chapter on using Gnuplot for web dev and CGI scripts. You can pre-order it directly from the publisher: Manning: Gnuplot in Action.

If you want to learn more about the book and the author, check out my book page at Principal Value - Gnuplot in Action.

Let me know if you are interested in a review copy.