From e1783e4c793b4b4bc63336deeae58bb5a43a14e1 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Thu, 28 Jun 2012 14:27:38 +0000 Subject: [PATCH] SP-173: Further improvements of demo script SVN: 25941 --- .../source/html/demoapp/proteomics-demo.js | 32 +++++++++++++++---- rtd_phosphonetx/source/html/demoapp/tree.css | 5 +++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/rtd_phosphonetx/source/html/demoapp/proteomics-demo.js b/rtd_phosphonetx/source/html/demoapp/proteomics-demo.js index 964f52b240f..aee9c0e98a1 100644 --- a/rtd_phosphonetx/source/html/demoapp/proteomics-demo.js +++ b/rtd_phosphonetx/source/html/demoapp/proteomics-demo.js @@ -49,10 +49,13 @@ function displayResultsAsGraph(data) return; } - var xOffset = 30, - yOffset = 10, + var xOffset = 70, + yOffset = 40, xStep = 200, - yStep = 30; + yStep = 30, + xLabel = -30, + yLabel = 18, + columnNames = ['Biological Experiment', 'Biological Sample', 'MS Injection Sample', 'Search Experiment', 'Protein']; var graph = vis.selectAll("svg").data([data]).enter().append("svg:svg") .attr("width", $(window).width() - 50) @@ -62,6 +65,14 @@ function displayResultsAsGraph(data) .enter().append("svg:g") .attr("transform", function(d,i) { return "translate(" + (xOffset + i * xStep) + ", " + yOffset + ")"; }); + + g.append("svg:text") + .text(function(d,i) { return columnNames[i]; }) + .attr("class", "columnHeader") + .attr("text-anchor", "middle") + .attr("x", 0) + .attr("y", -10); + g.selectAll("path").data(function(d) { return d[1]; }) .enter().append("svg:path") .attr("class", "line") @@ -86,8 +97,8 @@ function displayResultsAsGraph(data) .text(function(d) { return d.label; }) .attr("class", function(d) { return d.level == indexOfLinkedColumn ? "linked" : "notLinked";}) .attr("text-anchor", "left") - .attr("x", -10) - .attr("y", 18) + .attr("x", xLabel) + .attr("y", yLabel) .on("click", function(d) { if (d.level == indexOfLinkedColumn) { window.open(openbisUrl + "/?#entity=EXPERIMENT&permId=" + d.permId, '_blank'); } @@ -108,10 +119,17 @@ function createDataModel(tableModel) var maps = []; var permIds = {}; - for (n = 0; n < rows.length; n++) { + for (n = 0; n < rows.length; n++) + { row = rows[n]; permIds[row[indexOfLinkedColumn].value] = row[4].value; - row[5].value = row[5].value + ": " + row[6].value; // concatenate accession number with description + var accessionNumber = row[5].value; + var splitted = accessionNumber.split("|"); + if (splitted.length > 1) + { + accessionNumber = splitted[1]; + } + row[5].value = accessionNumber + ": " + row[6].value; // concatenate accession number with description row.splice(6, 1); // remove description row.splice(4, 1); // remove search experiment perm id for (i = 0; i < row.length; i++) { diff --git a/rtd_phosphonetx/source/html/demoapp/tree.css b/rtd_phosphonetx/source/html/demoapp/tree.css index 10846319987..2d8808b86a6 100644 --- a/rtd_phosphonetx/source/html/demoapp/tree.css +++ b/rtd_phosphonetx/source/html/demoapp/tree.css @@ -4,6 +4,11 @@ stroke-width: 1.5px; } +.columnHeader { + font: 16px; + font-weight: bold; +} + .link { fill: none; stroke: #ccc; -- GitLab