Visual Database Explorer in Ruby
… svg code here
DOCTYPE is only supposed to be sent once and it is supposed to be the first thing we send back to the client. We met the second requirement (check the htmlHeader in step 1), but we don’t want to resend the DOCTYPE within the graphs generated by Scruffy. Here is a quick hack to remove the first two lines:
svg = graph.render(:width => 800).split(”\n”)
session.print svg[2, svg.size].join(”\n”)
We split the SVG code on the newline character and effectively discard the first two lines (and put the code back together with join) when we send the code back to the client. Now we are all done, point your browser to your homemade data visualization tool and explore the data! Here is a few more interesting screenshots from my dataset:
About this entry
- Published:
- 11.12.06 / 11pm
- Category:
- Projects, Ruby on Rails, Ruby
Related Posts
- 01.12 Loading Netflix Dataset into SQL
- 19.07 Web pages… again!
- 24.11 Google / Yahoo Sitemaps in Rails
- 10.09 Faster Pagination in Rails
- 07.09 Validating URL/URI in Ruby on Rails























Entries RSS
[…] Ilya Grigorik has put together a great article explaining how he has used Ruby, along with the Scruffy graphing library, to develop a basic visual database explorer. Last night I wrote a quick database explorer for one of my projects (screenshot above). I had a database of lead stories for BBC, Yahoo News and NY Times over a period spanning Sept. 2004 to Aug. 2005 and I wanted to juxtapose and visualize different queries. The concept is simple, given two words (ex: war / peace), I wanted to see some aggregate calculations over the available document corpus. […]
[…] read more | digg story Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages. […]
[…] Free/Open Source Software What’s Next in Linux Desktop Standardization? Questions I鈥檇 like to see asked about the Microsoft-Novell deal OpenOffice .org 2.1 Released The Pre-Installed Linux Vendor Database Visual Database Explorer in Ruby […]
Well, it seems that the storm has subsided. My little visualization app. grazed the front pages of digg and del.icio.us last night. Combined, they literally brought this server to its knees. Apologies to anyone who faced the dreaded Wordpress error page. I’ve learned my lesson - time to make some adjustments on the backend!
Also, welcome to all the new RSS subscribers!
[…] A how-to for a quick visual database explorer in Ruby. Learn how to build a quick threaded web-server, access SQL databases from Ruby, and how to create SVG graphs on the fly. The result.. A dynamic visual browser to help you find that needle in the haystack of information hidden away in your databases!read more | digg story […]
[…] igvita.com 禄 Blog Archive 禄 Visual Database Explorer in Ruby (tags: ruby database graph visualization rails programming howto) […]
Haha your blog has turned quite popular! Congrats on all the technical hits!