The 'plot' service provides plotting functionality -- you can send data to the service and it will produce a graph of that data using the Flot Javascript plotting library. The plot service is located at:

/plot/chart

You can also obtain 'source' code so that you can insert a chart into your own html:

/plot/source

You send data to the service either by POSTing it or by providing the url at which the data is located (in which case you can use a POST or a GET). Currently the system will only plot tabular data in the comma separated variables format.

Arguments to provide when using the service:

  • EITHER: data_url: a string providing the url to the data file you want plotted.
  • OR: data: the data itself (only supported with POSTs).
  • limit: limit the rows of the dataset we use for plotting. Uses standard python list slicing syntax, e.g. limit=[2:] (all rows from 2 onwards), limit=[:-4] (all rows from the start to the 4th before the end) etc.
  • xcol: the index of the column to use for x values (NB: first column is index 0, second is 1 etc).
  • ycol0,ycol1,ycol2,ycol3: the indices of y columns to use for plotting (up to 4). Follow same conventions as xcol. NB: because of PlotKit's colouring in conventions some series may not appear if prior series is larger (and therefore 'overwrites' it).
  • chart_type: one of PlotKit chart types (line (default), bar, pie).

Examples

  1. /plot/chart/?data_url=http://p.knowledgeforge.net/econ/svn/trunk/data/uk_price_index_1850-2002_annual/data.csv
  2. /plot/chart/?data_url=http://p.knowledgeforge.net/econ/svn/trunk/data/world_population_historical/data.csv&limit=[8:]
    Note that without the limit here the graph would not render because of the massive span and uneven spacing of the X-axis values.
  3. /plot/source/?data_url=http://p.knowledgeforge.net/econ/svn/trunk/data/uk_price_index_1850-2002_annual/data.csv&format=plain
    This is a 'source' version.