Simple tutorial for a non-rocket scientist?

0 views
Skip to first unread message

bubba_baloo

unread,
Jul 22, 2008, 12:27:23 AM7/22/08
to ZiYa Plugin
Hi there -

Is there a really, really simple (I mean like dumb-as-a-stump stupid)
tutorial out there somewhere? I started the day really excited -
thinking that I was going to add some cool charting to my web site.
After having spent an entire day trying to figure all of this out, I'm
just tired and disheartened. Why is it so difficult to find a
"starting from zero" reference?

I used the example:

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]

And, yes, I got the chart to render. But now what? I've been puzzling
over the documentation, admiring ziya.liquidrail.com but unable to
gather much from it, searching google like mad.

I'm sorry to kvetch. I'd really like to figure this out. I'm really
impressed with what I believe the possibilities to be. I just need
something that doesn't go from zero to 100 in 0.001 seconds.

Thanks.

Fernand Galiana

unread,
Jul 22, 2008, 12:52:39 AM7/22/08
to ziya-...@googlegroups.com
Hi Bubba,

   Thanks for the post! The whole ziya site is published and available for documentation.

   I've done my best to document the code and throwing a couple sample sites together, so
   folks can take it from there...

   What exactly are you trying to accomplish ?

-Fernand

bubba_baloo

unread,
Jul 22, 2008, 1:42:13 AM7/22/08
to ZiYa Plugin
I'm building a healthy living, community web site. Amongst the things
a person can do is track various biometrics (e.g., weight, blood
glucose, etc.) Currently, a person is able to enter or upload data
(say, from a pedometer or spirometer) into what amounts to a personal
health record. The person can view the data in table format. I would
like to be able to present the data in graphical format showing
biometric values over time (e.g., weight loss/gain, blood sugar
control, etc.) I would also like to compare values to goals or
recommended boundaries and against various population averages.

My data structures are set up in a way in which it is not difficult to
derive date/value pairs (e.g., a person's exercise log, or caloric
intake, or blood pressure). And, I image that I'd be able to figure
out how to substitute "HgA1c", [a, b, c, d] (where a, b, c, d, etc
represent readings) for "Dogs", [10, 20, 30] - although I haven't
conquered that beast yet.

But then, it starts getting fuzzy.

- Where are the stylesheets kept? How does the hierarchy work?
- What is this magic with routes and the index? What if I want charts
smeared across many pages/controllers?
- You have many beautiful animations (bouncing titles, etc.). How are
these achieved?
- How do I extend (if at all) certain look and feel elements (say,
making bar charts have a glossy sheen)?

You tool seems powerful, yet mysterious. It's not that the
documentation isn't there. It's more a matter of digestibility. It
would be lovely if there were a way to build up knowledge/
understanding one block at a time so that the full power of your work
could be unleashed.

Many thanks!


On Jul 21, 9:52 pm, "Fernand Galiana" <fernand.gali...@gmail.com>
wrote:
> Hi Bubba,
>
>    Thanks for the post! The whole ziya site is published and available for
> documentation.
>
>    I've done my best to document the code and throwing a couple sample sites
> together, so
>    folks can take it from there...
>
>    What exactly are you trying to accomplish ?
>
> -Fernand
>

Fernand Galiana

unread,
Jul 22, 2008, 9:05:41 AM7/22/08
to ziya-...@googlegroups.com
Hi Bubba,

   See annotations below....

-Fernand

On Mon, Jul 21, 2008 at 11:42 PM, bubba_baloo <bubba...@yahoo.com> wrote:

I'm building a healthy living, community web site. Amongst the things
a person can do is track various biometrics (e.g., weight, blood
glucose, etc.) Currently, a person is able to enter or upload data
(say, from a pedometer or spirometer) into what amounts to a personal
health record. The person can view the data in table format. I would
like to be able to present the data in graphical format showing
biometric values over time (e.g., weight loss/gain, blood sugar
control, etc.) I would also like to compare values to goals or
recommended boundaries and against various population averages.

My data structures are set up in a way in which it is not difficult to
derive date/value pairs (e.g., a person's exercise log, or caloric
intake, or blood pressure). And, I image that I'd be able to figure
out how to substitute "HgA1c", [a, b, c, d] (where a, b, c, d, etc
represent readings) for "Dogs", [10, 20, 30] - although I haven't
conquered that beast yet.

I think you are good here. Setup methods on your various models to retrieve an
array of values for your chart time base. Nothing too special here....

But then, it starts getting fuzzy.

- Where are the stylesheets kept? How does the hierarchy work?

The stylesheets are  stored under public/charts/styles. There should be a couple of
default themes dir aka default and commando. These are for example sake. You can
create your own theme dir and start moving stuff per your desired charts look and feel.
They work in a similar way as a cascading stylesheet. There is a tutorial app on the
ZiYa site that gives you some directions on what style properties do.

Say you have a column chart setup as follows.

chart = Ziya::Charts::Column.new( license, "my_col_chart" )
chart.add( :theme, "my_themes" )

Upon rendering ZiYa will look for the following stylesheets

1 /public/charts/styles/my_themes/my_col_chart.yml
2 /public/charts/styles/my_themes/column_chart.yml
3 /public/charts/styles/my_themes/base.yml

If you don't specify an instance chart name ie my_col_chart only 2 and 3 will be loaded.

Each stylesheets can specify properties that will be overridden at a higher level. For ex
if you want to change the color of the legends from the base from green to red then for all
column charts you will need to add a column_chart.yml file which would contain the following:

<%= chart :column %>
  <%=comp :legend_label %>
       color: ff0000

Now all column charts legend's text will be red.


- What is this magic with routes and the index? What if I want charts
smeared across many pages/controllers?

The index page is meant to setup the ziya_helper and declare that a page contains a chart.
Once the page is loaded the ziya helper code will make a callback to a controllers action to fetch the
appropriate xml to display the chart. The preferred way to set this up is by creating a named route
to your controller action that produced the xml. You can reuse the same chart on multiple pages if
you choose too. The setup will alway look the same. I would suggest using partials and including
them in the various pages that display the same charts.

For example:

routes.rb

map.load_chart  'pedometers/load_chart', :controller => "pedometers", :action => 'load_chart'

pedometers/index.html.erb

<%= ziya_chart( load_pedometer_url,
      :id        => "pedometers",
      :bgcolor   => "#000000,
      :size      => '400x300' -%> 

Once index is loaded a callback to pedometers/load_chart will be executed to fetch the chart
xml


- You have many beautiful animations (bouncing titles, etc.). How are
these achieved?

 Very simple - For example if you want your column chart to animate the columns to drop
when loading you can add the following to my_column_chart.yml

<%=comp :chart_transition %>
   type: drop
   delay: 0.5

- How do I extend (if at all) certain look and feel elements (say,
making bar charts have a glossy sheen)?

At this time, there are no constructs for setting up a glossy look and feel.


You tool seems powerful, yet mysterious. It's not that the
documentation isn't there. It's more a matter of digestibility. It
would be lovely if there were a way to build up knowledge/
understanding one block at a time so that the full power of your work
could be unleashed. 

Yes - there is a bit of a curve there initially, but once you've got the basic
concept, it all works in the same fashion...

Hang in there !!

Reply all
Reply to author
Forward
0 new messages