Ziya plugin - Charting the rails...

Nice plugin, drop dead ugly logo for your site :slight_smile:

Ha !! Thanks. If you would like to contribute a nice logo we'll be
happy to oblige...

Take a look at SWF/XML Charts ( http://www.maani.us/xml_charts/ ) to
get more info on how the charts are constructed. The answer is "sort
of": the Flash chart component reads the XML data when it is rendered
on the screen (the URL to the XML appears in the HTML which embeds the
Flash object).

I am glad to see this plugin released as it means there is one less
thing I have to maintain in my code base. :slight_smile:


Thanks !!

We have tried to list the ZiYa plugin in most sites we knew off. If you
have suggestions
about other sites, we could list on that would be great.

Indeed ZiYa leverages XML/SWF Charts but hides the XML generation part
from the
developer. Within a couple of API calls you should be able to have a
chart rendered in
you web app. For instance in you controller you can do something like

    def sales
       chart = Ziya::Charts::Bar.new
       chart.add(:axis_category_text, %w{ 2002 2003 2004 2005 2006 })
       chart.add(:series, "Sales", [ 10, 15, 20, 25, 30 ])
       render :text => chart

   Then in your view code:

    <%= gen_chart( "sales_chart",
                   url_for( :controller => 'my_controller', :action =>
'sales' ),
                   "#ffffff", 400, 300 ) %>

   We've also leveraged YAML and ERB to enable you to style the chart
just like
   you would for HTML and stylesheets. The cool thing here ( so we
think... ) is
   that you can dynamically style your charts based on some model
   For example, if you want a certain aspect of the chart to change
color based
   on some threshold, you could override the style sheet with something
like this:

   <%=comp :series_color%>
      <%if @options[:sales] > 10%>
          colors: ff0000,aa0000
          colors: 0000bb,00cc00

     If this looks less than ideal you can also define a ZiYa helper
function which would render
     the code above as such:

    <%=comp :series_color%>
        <%= custom_colors @options[:sales]%>

   There is more info about that in the rdocs.
   Thanks for checking us out !!