Skip to content
Snippets Groups Projects
Commit 35956fdc authored by cramakri's avatar cramakri
Browse files

BIS-549 SP-1006 : Added support for colors in the UI.

SVN: 30152
parent f7270fce
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,10 @@
<li class="active"><a id="bottom-up">Bottom Up</a></li>
<li><a id="top-down">Top Down</a></li>
</ul>
<ul class="nav">
<li class="active"><a id="with-colors">Colors</a></li>
<li><a id="no-colors">B&amp;W</a></li>
</ul>
</div>
</div>
</div>
......
......@@ -33,8 +33,8 @@ var LINE_HEIGHT = 20;
var FIRST_COLLAPSED_COLUMN = 2;
// The colors used for the different samples. The colors are used when one sample has multiple parents or children to disambiguate.
//var sampleColors = d3.scale.category10();
var sampleColors = d3.scale.ordinal().range(['#999']);
var sampleColors = d3.scale.category10();
//var sampleColors = d3.scale.ordinal().range(['#999']);
// The color used when the connection between two samples is unambiguous
var oneToOneColor = "#999"
......@@ -274,6 +274,7 @@ function SampleGraphPresenter(model) {
this.selectedNode = null;
this.didCreateVis = false;
this.useBottomUpMode();
this.useWithColorsMode();
this.initializePresenter();
}
......@@ -334,6 +335,16 @@ SampleGraphPresenter.prototype.useTopDownMode = function() {
this.calcuateVisibleColumnOffsets();
};
SampleGraphPresenter.prototype.useWithColorsMode = function() {
this.withColorsMode = true;
sampleColors = d3.scale.category10();
};
SampleGraphPresenter.prototype.useNoColorsMode = function() {
this.withColorsMode = false;
sampleColors = d3.scale.ordinal().range(['#999']);
};
/**
* Return a function that gives the outgoing edges for a sample.
*
......@@ -468,6 +479,23 @@ function clickedTopDown() {
presenter.draw();
}
function clickedWithColors() {
if (presenter.withColorsMode) return;
displayActiveMode($('#with-colors'), $('#no-colors'));
presenter.useWithColorsMode();
presenter.initializeGraphSamples();
presenter.draw();
}
function clickedNoColors() {
if (!presenter.withColorsMode) return;
displayActiveMode($('#no-colors'), $('#with-colors'));
presenter.useNoColorsMode();
presenter.initializeGraphSamples();
presenter.draw();
}
function textBBoxForGraphNode(node) {
var bbox = presenter.renderer.columns.selectAll("text.sample")[node.col][node.visibleIndex].getBBox();
......@@ -915,6 +943,8 @@ function enterApp(data)
{
$('#bottom-up').click(clickedBottomUp);
$('#top-down').click(clickedTopDown);
$('#with-colors').click(clickedWithColors);
$('#no-colors').click(clickedNoColors);
presenter = new SampleGraphPresenter(model);
presenter.useBottomUpMode()
model.requestGraphData(function() { presenter.initializeGraphSamples(); presenter.draw() });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment