Guys,
My apologies for the pain points. I will update the documentation and hopefully this will make it clearer. Lots changes
in 2.1.x and I need to be more diligent with this project documentation.
Thanks for sticking with it and please report back if you have anymore install issues !
-Fernand
ZiYa Installation and first Chart Creation
1) Update your gem version to 1.3.1
2) Add git as a source
> gem sources -a
http://gems.github.com3) Install the ziya gem
> sudo gem install derailed-ziya
4) In your web app, to setup ziya
> ziyafy --charts
5) Creating a ziya initializer
config/initializers/ziya.rb
gem 'derailed-ziya', '~> 2.1.0'
require 'ziya'
# Initializes the ZiYa Framework
Ziya.initialize(
:logger => RAILS_DEFAULT_LOGGER,
:themes_dir => File.join( File.dirname(__FILE__), %w[.. .. public charts themes])
)
6) Create a controller and define a chart callback
app/controllers/blee_controller.rb
class BleeController < ApplicationController
helper Ziya::HtmlHelpers::Charts
helper Ziya::YamlHelpers::Charts
# Callback from the flash movie to get the chart's data
def load_chart
# Create a bar chart with 2 series composed of 3 data points each.
# Chart will be rendered using the default look and feel
chart = Ziya::Charts::Bar.new
chart.add( :axis_category_text, %w[2006 2007 2008] )
chart.add( :series, "Dogs", [10,20,30] )
chart.add( :series, "Cats", [5,15,25] )
respond_to do |fmt|
fmt.xml { render :xml => chart.to_xml }
end
end
end
7) Create an associated view
app/views/blee/index.html.erb
<!-- Defines the necessary tag to embed a flash movie in your html page.
This will callback to your controller to fetch the necessary xml. -->
<%= ziya_chart load_chart_url -%>
8) Define a named route
map.load_chart '/blee/load_chart', :controller => 'blee', :action => 'load_chart'