Skip to content

Instantly share code, notes, and snippets.

@IbrahimTanyalcin
Last active Sep 12, 2017
Embed
What would you like to do?
lexicon-rainbow example: Minimal
license: cc-by-nc-nd-4.0
height: 700
width: 1000
scrolling: yes

A minimal example to give you an idea of the data structure that lexicon-rainbow require.

<!DOCTYPE html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<script src="http://d3js.org/d3.v4.min.js"></script>
<script src="//cdn.rawgit.com/IbrahimTanyalcin/lexicon-rainbow/e2a8a5a0/dev/lexiconRainbow.d3v4.dev.js"></script>
<style type ="text/css">
</style>
</head>
<body>
<div id="containerDiv" style="margin:auto;"></div>
<script type="text/javascript">
////////////////////////////////////////////////////////////////////
/////////////////////////A MINIMAL DATASET//////////////////////////
////////////////////////////////////////////////////////////////////
var sample = {
"ordinal": [
{
"name": "A Minimal Set",
"categories": {
"A": 1,
"B": 2,
"C": 3
}
}
],
"linear": [
{
"domain": [-10,10],
"name": "A Minimal Set",
"categories": {
"A": {intervals:[-9,-4]},
"B": {intervals:[[-2,2]]},
"C": {intervals:8}
}
}
]
};
////////////////////////////////////////////////////////////////////
/////////////////////////CREATE AN INSTANCE/////////////////////////
////////////////////////////////////////////////////////////////////
(new LexiconRainbow)
.container("#containerDiv")
.forceStyle()
.w(600)
.h(200)
.sW("800px")
.sH("auto")
.position("relative")
.sTop("0px")
.sLeft("0px")
.sMargin("100px auto 0px auto")
.lexID("lexiconRainbow")
.input(sample)
.append(true)
.render();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment