<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>{{ontology.uri}}</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />




<style type="text/css" media="screen">

 body {
  background: url(texture-noise.png);
{#  overflow: hidden;#}
  margin: 10px;
  font-size: 14px;
  font-family: "Helvetica Neue", Helvetica;
}

#chart, #header, #footer {
  position: absolute;
  top: 0;
}

#header, #footer {
  z-index: 1;
  display: block;
  font-size: 36px;
  font-weight: 300;
  text-shadow: 0 1px 0 #fff;
}

#header.inverted, #footer.inverted {
  color: #fff;
  text-shadow: 0 1px 4px #000;
}

#header {
  top: 80px;
  left: 140px;
  width: 1000px;
}

#footer {
  top: 680px;
  right: 140px;
  text-align: right;
}

rect {
  fill: none;
  pointer-events: all;
}

pre {
  font-size: 18px;
}

line {
  stroke: #000;
  stroke-width: 1.5px;
}

.string, .regexp {
  color: #f39;
}

.keyword {
  color: #00c;
}

.comment {
  color: #777;
  font-style: oblique;
}

.number {
  color: #369;
}

.class, .special {
  color: #1181B8;
}

a:link, a:visited {
  color: #000;
  text-decoration: none;
}

a:hover {
  color: #666;
}

.hint {
  position: absolute;
  right: 0;
  width: 1280px;
  font-size: 12px;
  color: #999;
}


.chart {
  display: block;
  margin: auto;
  margin-top: 60px;
  font-size: 11px;
}

rect {
  stroke: #eee;
  fill: #aaa;
  fill-opacity: .8;
}

rect.parent {
  cursor: pointer;
  fill: steelblue;
}

text {
  pointer-events: none;
}


</style>


</head>


<body>

	{# VISIBLE PAGE HTML #}

	{# note: showpanel arg is the ID of the div that is showing.. #}

	<h1 class="title">Ontology:&nbsp;<a href="javascript:showpanel('ontoinfo');">{{main_uri}}</a></h1>
	<h3>{{ontology.bestDescription}}</h3>

	<p><small>Ontology documentation automatically generated by <a class="greylink" href="http://ontospy.readthedocs.org/">OntoSpy</a> on {% now "jS F Y H:i" %}</small></p>

	<hr>


	{% if TOTAL_CLASSES %}
		<div class="row">
			<h3>Classes ({{TOTAL_CLASSES}})</h3>
			<div class="col-md-12" id="graph_classes" style="margin-top: 10px;">


			</div>


		</div>
	{% endif %}



	<hr>
	<small>Documentation automatically generated by <a href="https://github.com/lambdamusic/OntoSpy">OntoSpy</a> on {% now "jS F Y H:i" %}</small>







{# JAVASCRIPT #}

<script type="text/javascript" src="{{STATIC_URL}}libs/d3-v3/d3.min.js"></script>

<script type="text/javascript" src="{{STATIC_URL}}libs/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}libs/jquery/jquery.slidereveal.min.js"></script>

<script type="text/javascript">

    var root = {{JSON_DATA_CLASSES|safe}} ;

	var w = window.innerWidth;
	var h = window.innerHeight;

	var w = 800;
	var h = 500;

	var x = d3.scale.linear().range([0, w]),
	    y = d3.scale.linear().range([0, h]);

	var vis = d3.select("#graph_classes").append("div")
	    .attr("class", "chart")
	    .style("width", w + "px")
	    .style("height", h + "px")
	  .append("svg:svg")
	    .attr("width", w)
	    .attr("height", h);


    var tooltip = d3.select("body")
    .append("div")
    .style("position", "absolute")
    .style("border-radius", "5px")
    .style("z-index", "100")
    .style("visibility", "hidden")
    .style("opacity", ".85")
    .style("color", "lightsteelblue")
    .style("background", "white")
    .style("font-size", "40px")
    .text("a simple tooltip");


	var partition = d3.layout.partition()
	    .value(function(d) { return d.size; });

	// d3.json(JSON_FILE, function(root) {
	  var g = vis.selectAll("g")
	      .data(partition.nodes(root))
	    .enter().append("svg:g")
	      .attr("transform", function(d) { return "translate(" + x(d.y) + "," + y(d.x) + ")"; })
	      .on("click", click)
          .on("mouseover", function(d){
			d3.select(this).attr("fill", "white");
			tooltip.text(d.qname);
			tooltip.style("visibility", "visible"); })
          .on("mousemove", function(d){return tooltip.style("top",
		      (d3.event.pageY-100)+"px").style("left",(d3.event.pageX+50)+"px");})
          .on("mouseout", function(d){
                d3.select(this).attr("fill", ""); // default = no stroke
                return tooltip.style("visibility", "hidden");}
                );

	  var kx = w / root.dx,
	      ky = h / 1;

	  g.append("svg:rect")
	      .attr("width", root.dy * kx)
	      .attr("height", function(d) { return d.dx * ky; })
	      .attr("class", function(d) { return d.children ? "parent" : "child"; });

	  g.append("svg:text")
	      .attr("transform", transform)
	      .attr("dy", ".35em")
	      .style("opacity", function(d) { return d.dx * ky > 12 ? 1 : 0; })
	      .text(function(d) { return d.name; })


	  d3.select(window)
	      .on("click", function() { click(root); })

	  function click(d) {
	    if (!d.children) return;

	    kx = (d.y ? w - 40 : w) / (1 - d.y);
	    ky = h / d.dx;
	    x.domain([d.y, 1]).range([d.y ? 40 : 0, w]);
	    y.domain([d.x, d.x + d.dx]);

	    var t = g.transition()
	        .duration(d3.event.altKey ? 7500 : 750)
	        .attr("transform", function(d) { return "translate(" + x(d.y) + "," + y(d.x) + ")"; });

	    t.select("rect")
	        .attr("width", d.dy * kx)
	        .attr("height", function(d) { return d.dx * ky; });

	    t.select("text")
	        .attr("transform", transform)
	        .style("opacity", function(d) { return d.dx * ky > 12 ? 1 : 0; });

	    d3.event.stopPropagation();
	  }

	  function transform(d) {
	    return "translate(8," + d.dx * ky / 2 + ")";
	  }
	// });

    </script>



</body>
</html>
