mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
removed previous boilerplate
This commit is contained in:
parent
fc30f87883
commit
587786b2b5
2 changed files with 1 additions and 58 deletions
|
@ -1,60 +1,3 @@
|
|||
define(function (require) {
|
||||
var Treemap = require('visualize/treemap/index');
|
||||
var d3 = require('d3');
|
||||
|
||||
var margin = {
|
||||
top: 40,
|
||||
right: 10,
|
||||
bottom: 10,
|
||||
left: 10
|
||||
},
|
||||
width = 960 - margin.left - margin.right,
|
||||
height = 500 - margin.top - margin.bottom;
|
||||
|
||||
var color = d3.scale.category20c();
|
||||
|
||||
var treemap = d3.layout.treemap()
|
||||
.size([width, height])
|
||||
.sticky(true)
|
||||
.value(function(d) { return d.size; });
|
||||
|
||||
var div = d3.select("body").append("div")
|
||||
.style("position", "relative")
|
||||
.style("width", (width + margin.left + margin.right) + "px")
|
||||
.style("height", (height + margin.top + margin.bottom) + "px")
|
||||
.style("left", margin.left + "px")
|
||||
.style("top", margin.top + "px");
|
||||
|
||||
d3.json("flare.json", function(error, root) {
|
||||
var node = div.datum(root).selectAll(".node")
|
||||
.data(treemap.nodes)
|
||||
.enter().append("div")
|
||||
.attr("class", "node")
|
||||
.call(position)
|
||||
.style("background", function(d) { return d.children ? color(d.name) : null; })
|
||||
.text(function(d) { return d.children ? null : d.name; });
|
||||
|
||||
d3.selectAll("input").on("change", function change() {
|
||||
var value;
|
||||
if (this.value === "count") {
|
||||
value = function() { return 1; };
|
||||
} else {
|
||||
value = function(d) { return d.size; };
|
||||
}
|
||||
|
||||
node
|
||||
.data(treemap.value(value).nodes)
|
||||
.transition()
|
||||
.duration(1500)
|
||||
.call(position);
|
||||
});
|
||||
});
|
||||
|
||||
function position() {
|
||||
this.style("left", function(d) { return d.x + "px"; })
|
||||
.style("top", function(d) { return d.y + "px"; })
|
||||
.style("width", function(d) { return Math.max(0, d.dx - 1) + "px"; })
|
||||
.style("height", function(d) { return Math.max(0, d.dy - 1) + "px"; });
|
||||
}
|
||||
|
||||
document.body.innerHTML = 'this is the future';
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue