08.Dec.2009
For my Codebits project (more about it in the future) I needed to render some interactive line charts. We searched and experimented with some cool javascript libraries like Raphaël and PlotKit. But in the end, we settled for Open Flash Chart.
It has a really big variety of interactive charts and, specially, highly configurable and customizable. However, the main advantage was Ruby on Rails plugin integration. OFC2 4 Rails makes creating charts as simples as this:
# From http://openflashchart2.sentor.pl/chart_examples/line
class StatsController < ApplicationController
def index
@graph = ofc2(650,300, 'stats/line')
end
def line
title = OFC2::Title.new( :text => action_name.humanize )
line_dot = OFC2::Line.new( :values => [9,8,7,6,5,4,3,2,1,12] )
chart = OFC2::Graph.new
chart.title= title
chart << line_dot
render :text => chart.render
end
end
# In stats/index.html.erb
<%= @graph %>
A great and helpful find. What do you use for presenting charts in web applications?
If you enjoyed this post, consider subscribing to my RSS FeedSérgio Santos | Creative Commons | Powered by mephisto & micro theme | I like you :)
Leave a Comment
Follow this post comments with this RSS feed.