Software for generating charts

A forum for discussion on the software for the WMT River Control System
Post Reply
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Software for generating charts

Post by hamishmb »

So, as we get closer to being ready to deploy the NAS box (I do need to add database support for the software first, but should be fairly easy), I'm thinking it might be a good time to start thinking about what chart-generation software we might want to use. I can probably compile more or less anything for it, as I have discovered, so all suggestions are welcome.

Here are the ideas I have: Please note, I have almost no experience with this kind of thing, and I haven't done much research - I don't really know what we want. All I can think of is that we want whatever we pick to be extensible if we want more or different kinds of chart in the future.

Thoughts?
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Software for generating charts

Post by TerryJC »

This was something that one of the Canford boys was supposed to be doing viewtopic.php?f=17&t=115, but nothing has appeared yet.

Apart from that, you may recall that I looked into this a fair time ago and found that there were a fair few chart generating tools available on Linux which were very powerful. However, I was doing the conversions on Kubuntu at the time, mainly using Kst. Another charting tool which is definitely available on Raspian is GnuPlot https://www.raspberrypi-spy.co.uk/2014/ ... pberry-pi/. Presumably you could build this for the NAS Box if we felt that was the right way to do it.

However, we aren't trying to display the chart in the Raspbian GUI; we want the chart to be available in the Staff/Visitor GUI which will run in a browser. Ideally therefore, rather than generate the chart on the fly, we should run a background Task to generate a plot for a specific dataset, eg a month's worth of data. Here is a question about generating a chart as an HTML file using GnuPlot https://ubuntuforums.org/archive/index. ... 74282.html, but I suspect that all we want to do is to generate the chart as a .png file and insert it into the web page using Flask or whatever framework we decide is best for our purposes. (I recommended Flask originally because that's what the denizens of the Dorset LUG suggested.)

Obviously you could use Python or R if you felt it to be a good choice (or it scratched a particular itch that you have :) ), but charting is a fairly complex subject so in good Unix fashion; perhaps we should build our system with lots of tools, each of which do one thing very well. (This was the thinking behind using mpg321 for the bells and subsequently the Loos. I'm sure someone (not me) could have written an MP3 Player to include in my Python, but mpg321 aleady existed and allowed me to effectively use the OS to implement multitasking for me.)
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Software for generating charts

Post by hamishmb »

Yeah, I'm thinking we want to generate image files of some kind too. Anything that requires the X server won't run on it though, so we need something that can run without a graphical environment.

Indeed we could follow that Unix principle. I have no idea what tools we might want to use though - Python and R are simply the ones I know of, but they aren't necessarily the best for us. As long as it's flexible, can be compiled, and doesn't use too much RAM (the box has 256MB), I really don't have any preference for what we use :)
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Software for generating charts

Post by TerryJC »

I agree that the tools that I've suggested appear to need X to work. I had a feeling that GnuPlot could output a file rather than display the results, if only because the link I provided earlier talked about using the tool to generate HTML. So far I haven't found out how that was done, but the examples at http://gnuplot.info/demo/ are clearly able to use a script to generate data that can be used by a web page.

If all else fails, the webserver is a Pi 3, and is running X, so we could look into that too.
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Software for generating charts

Post by TerryJC »

I've just found this https://www-uxsup.csx.cam.ac.uk/courses ... andout.pdf. I haven't worked my way through the whole thing, but on the first slide the author states:
The aims of the course are to provide you with sufficient familiarity with Gnuplot to plot simple
2D graphs of data generated by other programs. By the end of this course you will be able to
generate image files of graphs from data files in a purely scripted environment with no manual
interaction required. This is the appropriate model for activity towards the end of a series of
tasks in a shell script, for example.
So it should be possible to do what we want in a shell environment on either the NAS Box or the Webserver.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Software for generating charts

Post by hamishmb »

Excellent, I shall have a read. Probably better to use the NAS box if we can, and leave the webserver as is I think.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Software for generating charts

Post by hamishmb »

I have bought "GNUPlot in Action" as part of my endeavour to eventually generate charts using it or similar software. Of course, if someone else eventually implements the chart-related stuff, they can have the book.
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Software for generating charts

Post by hamishmb »

Okay, so having read a fair amount of the book now, and messing with Gnuplot on the NAS box, I'm fairly sure this tool can do what we want, and I can make it do it relatively easily. It's also fast even on the NAS box, so I don't think RAM will be too much of a problem.
Hamish
Post Reply