JMRI CodeFlower


The JMRI CodeFlower animation gives a lively perspective on the JMRI structure and how incredibly diverse the current state of work is.
Choose from a subset or let your browser crunch on the fulle JMRI repo using the drop down over the image.

Source code visualization

CodeFlower visualizes source repositories using an interactive tree. Each disc represents a file, with a radius proportional to the number of lines of code (loc).
All rendering is done client-side, in JavaScript. Try hovering on nodes to see the loc number, clicking on directory nodes to fold them and dragging nodes to rearrange the layout.

Also view our 2009 JMRI CodeSwarm.

Technical Details

This CodeFlower was created using:

How To

Download the cloc script (Count Lines Of Code) from and save it somewhere close to your local GitHub folder.
Make the following adjustment to the script, using a suitable editor:

Next, in Terminal, cd to the folder containing cloc and your JMRI repo and type for example:
perl JMRI/java --csv --by-file --report-file=java.cloc
to get the "loc" for the JMRI/java folder. Result:
12546 text files.
11295 unique files.
3803 files ignored.
Wrote java.cloc

Next, open the output file java.cloc and copy its contents into the field below [Origins: clog] on
Click the [Convert] button (and optionally, click [Update] to see the new data displayed on the page).
Copy the generated JSON data from the Input Data Format field into a separate file and save it to the codeflower_js folder, together with the d3 JavaScript files. Further instructions are on the CodeFlower web page.

I had to trick a bit on the relative size of each element, as 3 files overshadowed the others: decoderIndex.xml, RR-CirKits-TC-64-basic.xml and functionGenerator.xml all containing over 25k lines of code (loc) while other files contain just 200 loc.
Open CodeFlower.js and make the following changes to show the full current code set of JMRI inside a reasonable square:

CodeFlower was built with d3.js, inspired by Code Swarm and Gource. It was published as open-source by François Zaninotto under the MIT license.

Source Data

Take a look at the data inside jmri.json.