Module ChartsHelper
In: app/helpers/charts_helper.rb
File:charts_helper.rb
(C):Hipposoft 2008, 2009
Purpose:Help views use the charts controller.

          11-Mar-2008 (ADH): Created.

Methods

Constants

CHART_TYPE_PIE = 0

Public Instance methods

Return an HTML <img> tag which includes a Gruff-generated pie chart summarising a task based on the given duration, committed and not committed hours, using the given width and height (pixels). The height of the generated image tends to depend on Gruff, so it‘s only given the width. If you wish to have the image appear undistorted, generate one at the given width, check its actual height then use that value from then on.

[Source]

    # File app/helpers/charts_helper.rb, line 46
46:   def charthelp_image( duration, committed, not_committed, width, height )
47:     return image_tag(
48:       charthelp_image_url( duration, committed, not_committed, width ),
49:       {
50:         :size  => "#{ width }x#{ height }",
51:         :alt   => "Overview",
52:         :align => "left"
53:       }
54:     )
55:   end

Return an image URL which will resolve to a pie chart summarising a task based on the given duration, committed and not committed hours, using the given width (pixels).

[Source]

    # File app/helpers/charts_helper.rb, line 18
18:   def charthelp_image_url( duration, committed, not_committed, width )
19: 
20:     # Rails routes don't like "." appearing in the middle of a URL.
21:     # "CGI.escape()" doesn't touch them, so change them manually to
22:     # underscores for maximum inoffensiveness! The controller changes
23:     # them back.
24: 
25:     duration      = duration.to_s.sub( '.', '_' )
26:     committed     = committed.to_s.sub( '.', '_' )
27:     not_committed = not_committed.to_s.sub( '.', '_' )
28: 
29:     return chart_url(
30:       CHART_TYPE_PIE,
31:       :width         => width,
32:       :duration      => duration,
33:       :committed     => committed,
34:       :not_committed => not_committed
35:     )
36:   end

[Validate]