Archive:Ploticus format

From semantic-mediawiki.org


This page contains outdated information and is thus OBSOLETE!
This documentation page applies to all SMW versions from 1.4.2 to 1.4.2.
     

Archive:Ploticus format en 1.4.2 1.4.2


Ploticus format
Creates various plots and charts
Further Information
Provided by: Extension "Semantic Result Formats"
Added: 1.4.2
Removed: 1.4.2
Requirements: none
Format name: ploticus
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. no
Authors: Joel Natividad
Categories: charts
Table of Contents
Note: This format was disabled, due to a security hole.

The result format ploticus, part of the Extension "Semantic Result Formats" extension, creates various plots, charts, and graphics based on property values, using the Ploticus Data Display Engine.

Parameters[edit]

Examples[edit]

Example 1 (Simple)[edit]

  {{#ask:
    [[Category:City]] [[located in::Germany]]
    |?population
    |sort=population
    |order=descending
    |format=ploticus
    |ploticusparams= -prefab vbars x=1 y=2 delim=comma
  }}

This query will display a rudimentary PNG bar chart showing the population of each German City.

Taking it further:

Example 2 (Imagemap-enabled)[edit]

  {{#ask:
    [[Category:City]] [[located in::Germany]]
    |?population
    |sort=population
    |order=descending
    |format=ploticus
    |ploticusparams= -prefab vbars x=1 y=2 delim=comma vals=yes labels=1
            clickmapurl=[target=new]"http://semantic-mediawiki.org/wiki/@1" clickmaplabel="@1" -csmap 
            title="Population of Cities in Germany" titledet="size=24" 
  }}

Building on Example 1, this query adds a title, with each bar labeled with its assigned value, and imagemap support (i.e. clicking on a bar opens the associated wiki article in a new window).

Taking it further still:

Example 3 (The Works!)[edit]

  {{#ask:
    [[Category:City]] [[located in::Germany]]
    |?population
    |sort=population
    |order=descending
    |format=ploticus
    |imageformat=svg
    |ploticusparams= -font FreeSans -prefab vbars x=1 y=2 delim=comma vals=yes labels=1 autow=yes stubvert=yes color=blue
            clickmapurl="http://semantic-mediawiki.org/wiki/@1" clickmaplabel="@1" -csmap 
            title="Population of Cities in Germany"  titledet="size=24"
            ylbl="In thousands"
    |height=400
    |width=600
    |showcsv=true
    |showimagelink=true
    |showrefresh=true
    |showtimestamp=true
  }}

In addition to what we added in Example 2, we now have a 400x600 SVG bar chart, auto-width bar sizing, labels oriented vertically, blue bars, using the more eye-pleasing FreeSans TTF font instead of "jagged" ploticus built-in fonts.

It also exposes several action icons - one to download the query result used to create the chart in CSV format, another to open the image in a new window, and the last one to refresh the whole page. A timestamp is also displayed since SRF-Ploticus uses a cache that will redraw plots only if the query result set has changed.

And using Ploticus' scripting facilities, the user can go even further and apply some simple data processing before rendering the chart (e.g. create computed values, compute totals, compute percents, do pivots, count instances, etc.)

The exhaustive README details all the available SRF-Ploticus parameters.