Project

General

Profile

Graphs plugin

Added by Brad Beattie about 15 years ago

Hey folks, I'm working on a graphs plugin for Redmine that augments the exiting SVG use (like in repository statistics). Attached is the first instance I've implemented: a graph of issues over time for a given target version.

Is there anything else anyone wants? These things seem relatively easy to implement.


Replies (104)

RE: Graphs plugin - Added by Andrew Chaika almost 15 years ago

I can't make it works normally on my Redmine (trunk).
On Windows IE8, Chrome, Firefox3 render same buggy image. What can be wrong?

RE: Graphs plugin - Added by Chaoqun Zou almost 15 years ago

Brad Beattie wrote:

Chaoqun Zou wrote:

And it would be better to make the issue menu selected in old and growth page.

Not sure how. Point to some example code or make a pull request on Github?

Add this line in controller:

class GraphsController < ApplicationController

    menu_item :issues, :only => [:issue_growth_graph,:issue_age_graph]

    before_filter :find_version, :only => [:target_version_graph]

RE: Graphs plugin - Added by Oleg Lozinskij almost 15 years ago

+1

when it will be added to redmine? :)

Not related to statistics, rather to SVG...

Would it be possible to have a SVG graph for projects and members, so to say: who is in the project?
All this present in organigramm chart, using SVG.

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Oleg Lozinskij wrote:

when it will be added to redmine? :)

If you're referring to Chaoqun's request for the issues tab association, it's already up on github as of yesterday.

Would it be possible to have a SVG graph for projects and members, so to say: who is in the project?

Are you talking about something like how the overview page shows a members list? I'm not sure I see the benefit of displaying that in SVG. I could see displaying as a list of avatars perhaps, but not SVG.

RE: Graphs plugin - Added by Thomas M almost 15 years ago

Andrew Chaika wrote:

I can't make it works normally on my Redmine (trunk).
On Windows IE8, Chrome, Firefox3 render same buggy image. What can be wrong?

I have installed the plugin today on 0.8.3 and I have the same behaviour.

Any idea ?

RE: Graphs plugin - Added by Oleg Lozinskij almost 15 years ago

Brad Beattie wrote:

Are you talking about something like how the overview page shows a members list? I'm not sure I see the benefit of displaying that in SVG. I could see displaying as a list of avatars perhaps, but not SVG.

The idea behind was to have an overview of project members. Yes, you are right -- there is no benefit for only one project, but in case more projects are used (in our case we have almost 30) -- it make sense, to show projects with members and their role in the project. Nice to have would be additional export (csv or pdf).

This chart could give a nice overview of project memberships, mainly for administrative purposes.

smth like: http://www.aisee.com/svg/justice.htm -- either with vertical or horizontal layout, the vertical imho is not that easy, as the it would require 2-pass algorithm to calculate needed space for boxes.

PS: maybe it is an offtopic here, but I saw graphs already been discussed here, so decided to use this one.

RE: Graphs plugin - Added by Minjie Zhu almost 15 years ago

Hi Brad,

This is a nice plugin and thanks for your great job :)

Here is some error reports in my environment.

When i use the graph functin in a project which dosn't hold any tickets , no graph will be showed and an internal error will be catched in the log file.

When I show the Open aging issues, the error report is:

Processing GraphsController#issue_age_graph (for xxx.xxx.xxx at 2009-05-13 13:45:14) [GET]
  Parameters: {"project_id"=>"71", "action"=>"issue_age_graph", "controller"=>"graphs"}

TypeError (nil can't be coerced into Bignum):
    /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/whiny_nil.rb:55:in `-'
    /lib/SVG/Graph/Plot.rb:208:in `field_width'
    /lib/SVG/Graph/Graph.rb:522:in `draw_x_labels'
    /lib/SVG/Graph/Graph.rb:488:in `draw_graph'
    /lib/SVG/Graph/Graph.rb:203:in `burn'
    /vendor/plugins/redmine_graphs/app/controllers/graphs_controller.rb:161:in `issue_age_graph'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in `send'
    ...

When I show the Total issues over time, the error report is:

Processing GraphsController#issue_growth_graph (for xxx.xxx.xxx.xxx at 2009-05-13 13:46:21) [GET]
  Parameters: {"project_id"=>"71", "action"=>"issue_growth_graph", "controller"=>"graphs"}

ActiveRecord::StatementInvalid (Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY project_id, date' at line 1: SELECT project_id, date(issues.created_on) as date, COUNT(*) as issue_count FROM issues WHERE project_id IN () GROUP BY project_id, date):
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:188:in `log'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:309:in `execute'
    ...

I guess that the first error occurs because there are no ticket can be found. So the the varible which contains the result tickts is set to be nil.

And the second one is because the syntax error of the SQL which is

SELECT project_id... FROM issues WHERE project_id IN () GROUP BY project_id, date):

I tried this with the last commit of your plugin (49400f166edaf35f032055f5d416e6dbf66eaff3) and the redmime devel r2737 with MySQL.

Regards.

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Thanks for pointing this out Minjie. Check out the latest commit on github. Should address this concern.

RE: Graphs plugin - Added by Minjie Zhu almost 15 years ago

Brad Beattie wrote:

Thanks for pointing this out Minjie. Check out the latest commit on github. Should address this concern.

Hi Brad,

I confirmed the last revision and it works well. Thank you so much!

Your solution is:

 If a project has no ticket, the graph function menu won't be shown.

But how about such a case:

  1. There is a project which has some tickets.
  2. User A go to the Issue tab, and the graph menu is shown.
  3. User B go to the same page and remove all the tickets.
  4. After user B's aciton, user A click the graph menu, and it will show a 404 page .
  5. User A: mmm...?

To solve this problem, my idea is:

  • Despite of the tickets, the graph menu is shown.
  • If there are no tickets in the project, the graph just show an area with no plot.
  • Or just show some text like "There are no tickets."

And one more thing:

The Total issues over time only show the current project tickets.
It will be nice if it can also show all the sub-project ticket together like this

Thank you for your great job :)

Regards.

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Minjie Zhu wrote:

  • Just show some text like "There are no tickets."
  • It will be nice if it can also show all the sub-project ticket together like this

Both done and pushed to git.

RE: Graphs plugin - Added by Minjie Zhu almost 15 years ago

Thank's for your prompt work.

Brad Beattie wrote:

Both done and pushed to git.

  • Just show some text like "There are no tickets."

This works fine :)

  • It will be nice if it can also show all the sub-project ticket together like this

It shows all projects' tickets in spite of my corrent hierarchy.
Sometimes we may want to see only current project and all sub-project tickets without parent projects and peers.

How about your think? :)

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Yeah, fixed.

RE: Graphs plugin - Added by Minjie Zhu almost 15 years ago

Brad Beattie wrote:

Yeah, fixed.

Hi Brad,

I confirmed your fix and it worked fine.
It's really a good plugin which our team is searching for.
Thank you so much :)

Here is my new problem.

Create a new project and add some new issues.
Then show the graph you will see the date-axis with all the same value.

I think because currently the plugin render the graph to fill the date-direction.
Maybe it will be nice the plugin only render the graph till the current date.

Same as The Total issues over time.

I will attach two screenshots to show the problem and my suggestion.

attachment:graph1.jpg!

attachment:graph2.jpg!

Regards.

RE: Graphs plugin - Added by Minjie Zhu almost 15 years ago

I made a mistake in the issue-axis of the second screenshot.
Let me reattatch it :)

RE: Graphs plugin - Added by Thomas M almost 15 years ago

I Brad,
I'm running current Trunk and I'm always having the "Black Background & No Style" error.

By the way commenting :no_css and :style_sheet in graph_controller.rb gives the graphs back.

RE: Graphs plugin - Added by ciaran jessup almost 15 years ago

I also get this fwiw, the commenting out also 'fixes' it for me :)

RE: Graphs plugin - Added by Tommy L. almost 15 years ago

Hi,

I try to install the Graphs plugins, but we are not friends yet.

This is part of my production.log: http://www.chiparus.net/tmp/production.log

I had to downgrade rails from 2.2 to 2.1 btw when i upgraded redmine 0.8.3 to 0.8.4. Maybe something went wrong here.

Any Idea?
Thanks!

RE: Graphs plugin - Added by John Morgan almost 15 years ago

I have a similar problem to Tommy L. I pulled the latest source from GitHub this morning (5/19 8fdc521aa5b7109ce129afcd53b2a17bd333b17f) and I am getting the NoMethodError. Attached is the trace in my production log.

I have Redmine 0.8.3 on Rails 2.2 served on Apache 2.2 over Passenger 2.2.2.

Note: I'm a newbie to ruby/rails/redmine, so be gentle.

Also, I observed that the links to the graphs have unfriendly names (label_graphs, label_graphs_old_issues, etc. -- see attached screenshot). I have observed this on other people's working installations. But then I have also seen that in the screen shots from the project page (http://www.redmine.org/attachments/1736/open-aging-issues.png), the titles are "Graphs", "Open Aging Issues", etc. Is this perhaps an I18N configuration issue?

Thanks.

redmine.png (103 KB) redmine.png Unfriendly link names
production.log (4.9 KB) production.log NoMethodError production.log

RE: Graphs plugin - Added by Tommy L. almost 15 years ago

Yes, i also have the 'label' labels as seen for example here: http://redmine.chiparus.net/projects/rezplatform/issues (This is the latest 0.8-stable redmine and the Graphs plugin just pulled from git)

Also i might add that my roadmap graphs are working fine, but the other links give me the errors. (me also ruby/rails noob btw no clue yet)

RE: Graphs plugin - Added by Karol Tyde almost 15 years ago

I have the same problems as John Morgan;

NoMethodError in GraphsController#old_issues
undefined method `active' for []:Array

and unfriendly names

redmine 0.8.4, rails 2.3.2, ruby 1.8.6 o windows xp

any idea how to fix this?

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Minjie Zhu wrote:

I made a mistake in the issue-axis of the second screenshot.
Let me reattatch it :)

I have no personal need for this and likely won't get around to it. If you want to code it, by all means. Send a pull request on github and I'll include it. :)

RE: Graphs plugin - Added by Brad Beattie almost 15 years ago

Tommy L. wrote:

Yes, i also have the 'label' labels as seen for example here: http://redmine.chiparus.net/projects/rezplatform/issues (This is the latest 0.8-stable redmine and the Graphs plugin just pulled from git)

Also i might add that my roadmap graphs are working fine, but the other links give me the errors. (me also ruby/rails noob btw no clue yet)

The graphs plugin is not compatible with the stable branch, only the most recent trunk heading towards 0.9. If you want to make the necessary language changes, send me a pull request on github and I'll include them. Cool?

RE: Graphs plugin - Added by Tommy L. almost 15 years ago

Brad Beattie wrote:

Tommy L. wrote:

Yes, i also have the 'label' labels as seen for example here: http://redmine.chiparus.net/projects/rezplatform/issues (This is the latest 0.8-stable redmine and the Graphs plugin just pulled from git)

Also i might add that my roadmap graphs are working fine, but the other links give me the errors. (me also ruby/rails noob btw no clue yet)

The graphs plugin is not compatible with the stable branch, only the most recent trunk heading towards 0.9. If you want to make the necessary language changes, send me a pull request on github and I'll include them. Cool?

Ok, didn't know it wasn't backwards compatible. Thanks for your answer!

RE: Graphs plugin - Added by Bob Roberts almost 15 years ago

Great plugin thanks! Just what's needed after migrating from Mantis and it's poor but useful graphs.

We've noted a minor bug when using this plugin on redmine which is not running as a site root, i.e. it's running on http://localhost:3000/redmine. The graphs use hard coded stylesheet links that break in this situation (we're using a .htaccess to reroute them correctly atm):

Case in point, see line 157 in graphs_controller.rb

:style_sheet => "/plugin_assets/redmine_graphs/stylesheets/issue_age.css",

Can these be changed to correctly use the base URI, in this case /redmine/?

Just getting my head around Redmine, plugins and ruby/RoR achiture so would fix if I could but..

RE: Graphs plugin - Added by Bob Roberts almost 15 years ago

In response to my own reply above, I've just read the related thread here that discusses this issue. Would happily attempt to fix if someone could point me in the right direction as to the best approach to setting the correct base URI in the same way other plugins do when using something like this in their index.html.erb:

<%= stylesheet_link_tag "stuff_to_do.css", :plugin => "stuff_to_do_plugin", :media => 'all' %>
(26-50/104)