From d5d99c1bf2cd609f04ed68e6f26c60a3e1c909cc Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Tue, 19 Mar 2013 13:37:48 +0000 Subject: [PATCH] BIS-151 SP-546 : Add methods for generating graphs SVN: 28646 --- .../public/resources/js-new/openbis.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis.js index 71775249221..39d57abfa97 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis.js @@ -1522,6 +1522,46 @@ openbis.prototype.getValidationScriptForDataStore = function(dataSetTypeOrNull, }); } +/** + * Get a url that will produce a graph with the given configuration. + * + * @method + */ +openbis.prototype.getGraphUrl = function(graphconfig, dataStoreCodeOrNull, action) { + function dssUrlAction = function(dssUrl) { + var graphUrl = dssUrl + "/graphservice/"; + graphUrl += "?sessionID=" + context.getSessionId(); + for (prop in graphconfig) { + graphUrl += "&" + prop + "=" + encodeURIComponent(graphconfig[prop]); + } + action(graphUrl); + } + this._internal.getDataStoreUrlForDataStoreCode(dataStoreCodeOrNull, dssUrlAction); +} + +/** + * ===================== + * OpenBIS graph config + * ===================== + * + * Defines the configuration for a graph generated by the server's graphservice. + * + * To use, set properties on the object with keys that match the name of the servlet + * parameters of the graphservice and then call the method getGraphUrl on the openbis + * object. Do *not* set the sessionID paramter -- this will be filled in by the openbis + * object. + * + * The graphservice is documented here: https://wiki-bsse.ethz.ch/display/openBISDoc/Configuring+Graphs+and+Plots + * + * @class + * + */ +function openbisGraphConfig(filename, graphtype, title) { + this.file = filename; + this["graph-type"] = graphtype; + this.title = title; +} + /** * ===================================================== -- GitLab