Discourse Graph Plugin

(Sam Saffron) #1

I had a rather long series of flights today :airplane:. During my flights I was playing around with the idea of creating a graphing :chart_with_upwards_trend: plugin for discourse.

After seeing the very cool gruff gem by the awesome Geoffrey Grosenbach and Uwe Kubosch it seemed crazy not to try to integrate this into Discourse.

Here is my work in progress:

Demo graph:

Generated by:

[graph name='I can make it a line graph' type=line]
| Page | Speed Rails 1 | Speed Rails 4.2 | Speed Rails 100|
| --- | --- | --- | - |
| Home Page | 11 | 12 | 52
| Topic 22 | 20 | 22 | 11
| User bob | 30 | 33 | 92
| User  2 page| 37 | 100 | 13

Unfortunately it is not all roses :rose: cause there is a pretty big blocker prior to me feeling comfortable releasing this to the general wild.

As it stands gruff builds on top of the RMagick gem. This gem is notoriously problematic.

  • It does not support Image Magick 7 at the moment which we plan to migrate to

  • It does all image manipulation in process so has very high risk of bloating memory in the job queue processor :fire:

To push stuff forward the Ruby community is moving to minimagick (or the Discourse approach of just doing it all by hand). The idea is that you shell out to a different process when creating images (just like we do for letter avatars - and drive mogrify and convert which ship with image magick).

We would be very happy to sponsor the work of migrating gruff to use minimagick, if anyone would like to give this a shot let me know.

Bar & Line Chart Widgets in a Topic?