Example of composite features in TnT Board.
Last active
January 12, 2016 16:30
-
-
Save emepyc/f8f0061c832e8d7d9486 to your computer and use it in GitHub Desktop.
Composite feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var composite_feature = function(div) { | |
board = tnt.board().from(20).to(500).min(0).max(1000).width(950); | |
// Block Track1 | |
var block_track = tnt.board.track() | |
.height(30) | |
.color("#FFCFDD") | |
.data(tnt.board.track.data.sync() | |
.retriever (function () { | |
return { | |
'blocks2' : [ | |
{ | |
start : 130, | |
end : 140 | |
} | |
], | |
'blocks' : [ | |
{ | |
start : 20, | |
end : 100 | |
} | |
], | |
'lines' : [ | |
{ | |
pos : 120 | |
}, | |
{ | |
pos : 150 | |
} | |
] | |
}; | |
}) | |
) | |
.display(tnt.board.track.feature.composite() | |
.add ("blocks", tnt.board.track.feature.block() | |
.on("click", function () { | |
console.log("block"); | |
}) | |
.color("blue") | |
.index(function (d) { | |
return d.start; | |
}) | |
) | |
.add ("blocks2", tnt.board.track.feature.block() | |
.on("click", function () { | |
console.log("block2"); | |
}) | |
.color("green") | |
.index(function (d) { | |
return d.start; | |
}) | |
) | |
.add ("lines", tnt.board.track.feature.vline() | |
.color("red") | |
.index(function (d) { | |
return d.pos; | |
}) | |
) | |
); | |
// Axis Track1 | |
var axis_track = tnt.board.track() | |
.height(30) | |
.color("white") | |
.display(tnt.board.track.feature.axis() | |
.orientation("top") | |
); | |
// Location Track1 | |
var loc_track = tnt.board.track() | |
.height(30) | |
.color("white") | |
.display(tnt.board.track.feature.location()); | |
board | |
.add_track(loc_track) | |
.add_track(axis_track) | |
.add_track(block_track); | |
board(div); | |
board.start(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<link rel="stylesheet" href="http://tntvis.github.io/tnt.board/build/tnt.board.css" type="text/css" /> | |
<style> | |
#mydiv { | |
margin-top: 200px; | |
} | |
</style> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://tntvis.github.io/tnt.board/build/tnt.board.min.js"></script> | |
<script src="composite_feature.js"></script> | |
</head> | |
<body> | |
<div id="mydiv"></div> | |
<script> | |
composite_feature(document.getElementById("mydiv")); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment