Skip to content

New Plugin Guide

Liran Funaro edited this page May 11, 2017 · 1 revision

To add a new graph type plugin you need to create a .py file in the server/GraphPlugins folder. The file must contain a class with the following (required) two functions:

def getparameters(self):

This function should define a dict (or preferably an OrderedDict) that defines the value that the web application will request form the user, its source and it type.

Here is an example, assuming the class name is steveGraph:

def getparameters(self):
    params = OrderedDict()
    params['x_axis'] = {'type':'single', 'filterByValue': False} 
    params['y_axis'] = {'type':'single', 'filterByValue': False} 
    params['group_by'] = {'type':'multiple', 'filterByValue': True}
    return {'SteveGraph': params}

Note1: the class name doesn't have to be the same as the file name, but the "name" in the return line has to be the name of the class! in the UI you will see the name of the file

Note2: while you can reload plugins on the fly you cannot change the name of the class on the fly (a server restart will be required)

The valid parameters for "type" are currently: "single" or "multiple".

  • "single" will ask the user to pick exactly one item
  • "multiple" will let the user pick more than one item

The valid parameters for "filterByValue" are True and False.

  • True would let the user select a column name and then let the user select values from that column
  • False would only let the user elect a column name

The return value should be a dict containing a single key/value pair where the key is the class name and the value is the parameters dict as shown above.

The second function that is required is:

def plot(self, filename, sqlpath, x_axis, y_axis, group_by):
    ...
  • "filename" is the name of the experiment file we are working in, this is usually used for naming output files, such as CSV of the data or the HTML of the graph
  • "sqlpath" is the path to the relevant SQLite database containing all the parsed experiment information all the other parameters should be the same as the parameters in the getparameters() function described above (in the same order!)

This function should create a bokeh graph using bokeh.charts or bokeh.plotting.

The function returns a dict containing the div and the js, such as:

return {'div': div, 'js': js}

This function is also the place to define your exports, such as saving the generated graph as a standalone HTML, or exporting the values as JSONs.

Note: never import from bokeh.charts or bokeh.plotting directly as you this will generate collisions! Instead import charts and/or plotting from bokeh and use them by their long names (i.e charts.WHATEVER) then run the generated graph through the components() function from bokeh.embed which generates a div and js component.


It is recommended to look at the provided plugins for a good reference and a working example.

To add an icon to the newly created plugin, drop a png with the same file name into server/static/img/pluginImg/