Archives for the 'Graphication' Category

LastGraph at Oxford Geek Night Seven

Well, last night I gave a talk at one of the ever-brilliant Oxford Geek Nights, and in case you’re baying for the slides I used (all seven of them), you can find them at this wonderful OGN7 LastGraph Slides link. If you live within punting distance of Oxford, you should really try to come to the next one on August 27th. If not; well, they put videos up on the site…

In a related note, I am enjoying the improvement on my slide-making capabilities via Inkscape. Previously, PDFs exported to massive file sizes and tying the individual pages together wasn’t easy. Now, the new Cairo export in Inkscape (the same PDF export library LastGraph uses, yay) makes reasonably-sized PDFs, and pdftk munges them together easily and in record time. One day I’ll give in and use an actual presentation program.

26 June 2008 | Django, Graphication, LastGraph, Python | 1 Comment

LastGraph. Now Available.

Yes, people of the internet, LastGraph has returned. After over two weeks of beta testing and bugfixing, it’s finally in a useable state, and so I’m pushing it out to lastgraph.aeracode.org as I type this. If it doesn’t work for you yet, wait for the DNS change to propagate.

This version will, inevitably, contain bugs, so I would appreciate it if any bugs could be emailed to lastgraph at aeracode.org.

There have been some improvements, such as much better error handling, reduced PDF sizes, faster rendering (and more render nodes), and detailed progress. There are still some missing features, though, notably the ability to set the plays threshold and to remove a graph from the queue (this will only be possible if you’ve provided an email address).

Plans for the future include custom colourschemes, more notification methods (jabber, and perhaps some kind of twitter reply thing). If you have more ideas, send them in to that address above (or poke me via one of the many methods found on the contact page).

15 October 2007 | Graphication, LastGraph, Python | 24 Comments

Graphs, Python and CSS

After my first attempt at providing some way for people to style graphs in Graphication, which ended up being a rather ugly system with an odd set of nested dictionaries, a thought struck me; we already have a language for specifying presentation, and which has inheritance and other nifty time-saving shortcuts: CSS.

I could only find one python CSS library, cssutils, and while that seemed to have very decent CSS2 support for parsing into a document tree, I couldn’t see any immediate way of using it for retrieving the applicable values for, say, a grid object with class “minor” inside a wavegraph object.

First, I wrote a very lightweight CSS parser and rule matcher. Code examples always show off these things best; first you do something like

css_string = """wavegraph {color: #369; font-size: 12; }
grid.minor { color: #eee; } """
import css
stylesheet = css.CssStylesheet.from_css(css_string)

If you’re feeling like using stylesheets a lot, you can make them external (e.g. a file “default_css.css”) and use the import hook:

import css
css.install_hook()
import graphication.default_css as stylesheet

Then, querying properties is pretty simple:

>>> stylesheet.props("wavegraph")
{"color": "#369", "font-size": "12"}
>>> stylesheet.props("wavegraph").get("color")
"#369"
>>> stylesheet.props("wavegraph").get_int("font-size")
12
>>> stylesheet.props("wavegraph grid.minor line")
{"color": "#eee", "font-size": "12"}

This means all the styling crud previously used can be replaced with these simple css-selector-ish queries, and different graph styles can simply ship as different css files.

So, hopefully, graph styling will be a lot more accessible once I roll this fully into the graph system, as well as a lot nicer to deal with for most uses. In the meantime, if you want to look at this CSS parser code, have a look at the current subversion copy.

30 August 2007 | Graphication, Python | No Comments

Instant Graphitication

The start of the LastGraph rewrite is well underway; the backend has been moved to Django (probably out of familiarity, since I’ve been using it quite a bit recently), and is already fetching week lists and track lists, much to my delight.

This time around, I’m grabbing the weekly track charts, not the artist charts, and decoding and storing all of the data in a database, which is then queried to get artist statistics. This way, I’ll have all that data I bothered fetching around for future use, such as the Flash-based graph viewer I am contemplating (it does exist, but has only got as far as rendering predefined graphs…).

In more interesting (visual) news, the new rendering backend has been somewhat spun off into its own project, called ‘Graphication’. It’s built on top of Cairo, and the idea is to eventually provide a nice API for snazzy graph creation (LastGraph will have a few more graph types in future, which is one of the reasons for doing this. Radial graphs of genres/artists/tracks, anyone?).

Graphication Wavegraph Test

It already has a working wavegraph rendering module, an example output of which is above (the data is randomly generated). I’m now going to move on to the text-on-curves part, which is quite simple to do, but I’m going to try and find a way of making it less brute-force-ish, in the hope it might run a little faster.

10 August 2007 | Graphication, LastGraph | 2 Comments