Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8043963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:04:42+00:00 2026-06-05T05:04:42+00:00

I`m facing a problem with Gruff and Rails. Examples on the site fail with:

  • 0

I`m facing a problem with Gruff and Rails.
Examples on the site fail with:

ZeroDivisionError: divided by 0
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:1066:in `label'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:590:in `setup_graph_measurements'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:532:in `setup_drawing'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:508:in `draw'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/line.rb:53:in `draw'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:487:in `write'
from (irb):8
from /home/prikha/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:04:43+00:00Added an answer on June 5, 2026 at 5:04 am

    I had the same problem.
    The way i solve it is the following:
    ZeroDivisionError appears in 1066 line of gruff/base.rb
    Let’s look at this file closer

    label = if (@spread.to_f % @marker_count.to_f == 0) || !@y_axis_increment.nil?
    

    So, ZeroDivisionError was caused by the fact that @marker_count property was equal to zero. I know, it’s not the best solution, but i’ve added an explicit assignment
    @marker_count = <non-zero value> before drawing graph.
    So, now example from site looks like:

    #!/usr/bin/ruby
    require 'rubygems'
    require 'gruff'
    
    g = Gruff::Line.new
    g.title = "My Graph" 
    
    g.data("Apples", [1, 2, 3, 4, 4, 3])
    g.data("Oranges", [4, 8, 7, 9, 8, 9])
    g.data("Watermelon", [2, 3, 1, 5, 6, 8])
    g.data("Peaches", [9, 9, 10, 8, 7, 9])
    g.marker_count = 4 #explicitly assign value to @marker_count
    g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}
    
    g.write('my_fruity_graph.png')
    

    It works fine for me. I know that it’s not the general solution for the problem, but this hack can help you to deal with that library up until this error will be fixed by developers.

    ADD
    @market_count is a count of markers on vertical axis. So you can play with this property to prettify your graph.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing problem when migrate my web app project from development server to live
I'm facing problem in showing FolderBrowserDialog instance created and called from a non-UI thread.
I am migrating an applciation from windows to linux. I am facing problem with
I have facing problem in listview i am getting data from server and after
I am facing problem adding and deleting DataRows from a DataTable that is meant
I am learning MATLAB and am facing problem about extracting most significant bits from
I am facing problem in retrieving long value from PostgreSQL I use the following
I am facing problem in order by, I am fetching the records from SQL
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file
i am facing problem with ipv6 validations and ipv4 validations in JavaScript please help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.