Get the latest tech news
Creating beautiful charts with JRuby and JFreeChart
I recently returned from RubyKaigi where I had the opportunity to sit down with members of the Japanese Ruby community and show them a little bit of JRuby. One of the items that came up a few times was the difficulty of utilizing external libraries from Ruby: if it’s a C library, typically you have to either write a C extension or do the extra work of writing up an FFI binding.
The JFreeChart library provides an extensive set of chart formats, with a huge array of rendering options and easy integration with either JVM-based GUI toolkits or simple image-file output. Building a GUI with JRuby is fun and easy, but for this post we’ll focus on just the chart and image generation parts of the API and how you can use them easily from Ruby. The simplest way to load a JVM library from Maven into your JRuby app is to use jar-dependencies, a built-in tool for fetching and managing Java dependencies in either standalone applications or in gems.
Or read this on Hacker News