Skip to content

Instantly share code, notes, and snippets.

@IbrahimTanyalcin
Last active September 12, 2017 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IbrahimTanyalcin/6e2e775cb954ecf89e6b379b5fa4c510 to your computer and use it in GitHub Desktop.
Save IbrahimTanyalcin/6e2e775cb954ecf89e6b379b5fa4c510 to your computer and use it in GitHub Desktop.
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