DeLynn Berry

0 notes

ZiYa Plugin

I’m about two weeks late getting this announcement out, but I wanted to point everyone to a new Rails plug-in that I have been working on with Fernand Galiana. It’s name is ZiYa (after the Turkish impressionist painter Nazmi Ziya Güran), and its purpose is to make using the XML/SWF Charts library a snap with your Rails project.

Here’s how to get a sample bar chart in your current Rails project:

Step 1.

Install the ZiYa plug-in:

[ruby] script/plugin install svn://rubyforge.org/var/svn/liquidrail/plugins/ziya/trunk

Step 2

Include the ZiYa module into a controller that will be responsible for generating the chart:

class ChartsController < ApplicationController
include Ziya
end

Step 3

Create the action that will be used to generate the XML document for the chart. Please note, this action will be used by a new or existing action, it will not be the same action that your users load in their browser.

def posts_chart
chart = Ziya::Charts::Bar.new
render :text => chart
end

Step 4

In the view template for the client facing action, use ZiYa’s gen_chart helper method to embed your chart into the view:

<%= gen_chart(“posts_chart”, :url_for(:controller => “charts”, :action => “posts_chart”), “#ffffff”, 400, 300) %>

Step 5

Refresh your browser to see the default bar chart.

To make getting up to speed on all the capabilities of this plug-in and the XML/SWF Library we have put together a great support site. We have generated documentation, a bunch of sample charts, an introductory video and a really great training application that allows you to play with the YML chart styling capabilities. You can also checkout the project page over on RubyForge. There’s also a Google Group that we’ve created specifically for ZiYa discussion. Please post any questions or comments that you have regarding the plug-in there.

So, download the plug-in and get charting your data. This is a must have feature for an application that needs to impress their managers!

Filed under plugins rails ziya