May 12, 2001
MarkBernstein.org

activity

Here is a graph of the number of posts per month for this weblog. Because some older posts are archived, this plot doesn't go back to the origin of the weblog. But this is live data; when I add a new post, the plot updates automatically.

This page demonstrates Simile Timeplot, an easy-to-use AJAX widget developed by Stefano Mazocchi and the SIMILE project at MIT.

How This Works: First, Simile needs to have some scripts loaded in the <head> of the header file. So, to begin, I modified the basic weblog template to ^include the scripts.

Next, Simile Timeplot wants a <div> in which to draw the graph. Again, it seemed I might want to reuse this, so I stored the HTML in a separate note and simply wrote

^include(/boilerplate/timeplot/timeplot)

in the text where the plot should appear.

Finally, we need to generate the data to be plotted. I made an agent that looks for all the monthly archives in the weblog:

Query:" (Prototype=protoMonth)&ChildCount>0"

The second clause excludes months that don’t have any posts at all — such as future months. The agent's text simply exports each of the notes it finds using a simple template:

^get(Date,"="), ^get(ChildCount)

The second argument for ^get(Date) is a format string; "=" requests the ISO-8601 date format the Simile prefers.

There's nothing special about any of this; we could use a different script library, or a different data format, or export different information just as easily.