Educational aims and content

3D Histogram isometric viewBack in February 2008 I blogged about a stock-market price histogram which scraped historical and current data about stock market prices and plotted it in Second Life™, updating live. Since then I have moved on, still working with Melanie Swan to develop a 3-D histogram.

The images on this project show maximum and minimum trading daily prices and volumes traded on the 2 axes, with colour-coding for whether the price is moving up or down. You can view the graph from a point where you see movements in both dimensions, as in the main image, or from straight in front or vertically downwards to see two separate histograms if you find that more useful. Although I don't really read and interpret stock-market prices that well, I found that after a little while, the isometric view and seeing the interactions between the two became second nature and very useful.

There is another change from the original histogram tool as well. If you look inside, you will see there are two scripts, a plotter and a scraper script. (There is also, in the notecard provided, a notecard reader script.) This isn't done because the script is so large and complex, rather it is done so that you can, more easily, write your own data-harvesting scripts, code everything and hand it off to the plotter script to be plotted. It certainly makes the scripts much, much easier to manipulate and understand, even if you are not the strongest scripter in the world.

Writing help files for this was always going to be fun. Particularly as people generate and choose whether or not to share their plug-ins for scraping their own data. To that end, I have created a wiki page for the help and support for this plotter. As a wiki page you may ask for permission to join the page and add your own content, or send me content to upload. I will happily take script submissions for plug-ins if offered.

As you will see from the wiki page, I have added a couple of perhaps unexpected features. You can, as well as giving the high and low points for each axis, and a label for each bar (hopefully expected in plotting a graph!) define your own colours and alpha values for each bar. Obviously with your own harvester script you can use this to colour-code however your data demands. One obvious one to me would be to plot outputs such as sizes of ball bearings, and highlight in red as soon as the size falls outside the required range. A slightly different approach would be to take hospital report data and highlight, as you get on the results sheets, those which fall outside the reference range. (This approach might be a little more complex, in that you would probably have to normalise all your data first, but it could still be of some use.

I will, if people let me know, add a list of applications found for this plotter in Second Life™ to the wiki pages.

If you want a plotter of your own to work on, they are available at Data Visualisation Island and are open source and full permissions.

Technical notes

There are really only four things to say in this section:

  1. Back in the days of the 2-D plotter I made the choice to have a script in every plotter prim. That design has carried through into this plotter. Why? Well, I could use llSetLinkPrimitiveParams, but this currently only allows plotting 1 prim at a time. It also carries with it a 0.2s penalty. Whilst this is not a disaster for the stock-market prices (the historical data only changes once a day after all) for more fluid data this is undesirable, and the approach of a script-per-prim is not really heavy on the sim because the scripts in the bar prims are minimal, simply waiting for a link message and then plotting the new prim's size and position.
  2. Plotting these values actually proved to be somewhat entertaining! Calculating the size of the prims is relatively easy - the PHP code does some smart stuff to work out the minimum and maximum values and send them through, scaling to those values is easy. However, in Second Life, unless you go in for some prim torture, the position of a prim is defined by its centre, so there was a need to plot centres against the centre line too. Adding the extra axis also proved to plot "backwards" so there was a need to cope with that and plot the data in the direction we read it.
  3. Second Life is sometimes not so keen on plotting all these changes. The prims refuse to acknowledge the new data and don't change. This is commented on the wiki page too. If this happens to you, you can try resetting all the scripts and/or re-rezing your display. It appears that the sim can, sometimes, "forget" the prims it doesn't want to resize and once this has happened, they remain forgotten and unable to be resized. Rerezzing the plotter is a wake-up call that the sim will remember, at least for a while.
  4. Whilst plotting the volumes traded, which range from billions, possibly trillions of shares per day, to the low thousands, depending on the stock, the axis labels proved to be rather tricky. What I have done here is develop some code to slice the display into a mantissa and exponent type display. This is easily editable (I've used the SI prefixes k, M, G, T etc., but you can use other codes if you wish) so that if you are trading 92 billion shares it is presented at 92 G. Most people with a scientific background should cope with this quite readily. I also introduced the smaller prefixes: m, µ, n etc. at the same time.

I am not in any way affiliated with Linden Lab. This site advertises my work within their virtual environment. Valid CSS!

Valid XHTML 1.0 Transitional The terms Second Life, Linden Lab and SL are trademarks belonging to Linden Lab. No infringement of their trademark is intended. Usage here is nominative.

Home
Partnerships
Products
Resources

Projects index
Am. Lit. classes
Archetypal Cavern
Bailey's Café
British Gothic Lit.
Camelot
Dante's Inferno
Drexel Island
Gas meter
Heorot
Histogram
Hormone graphs
House of 7 gables
Ruler
Second Nature
Willow Springs


Join Second Life
Read my blog