This repository has been archived by the owner on Apr 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treemaps now support two modes: "squarify" for squarified treemaps (as before), and "slice-and-dice" for the simpler algorithm that alternates between horizontal and vertical cuts at different hierarchy levels. In addition, treemaps now support three orders: "ascending", "descending", and null (for unsorted). The default is "ascending" as before. This commit also fixes an occasional bug with rounding.
- Loading branch information
Mike Bostock
committed
Mar 17, 2010
1 parent
4851475
commit ab01d67
Showing
5 changed files
with
196 additions
and
79 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<html> | ||
<head> | ||
<title>Flare Treemap</title> | ||
<script type="text/javascript" src="../../protovis-d3.2.js"></script> | ||
<script type="text/javascript" src="../flare.js"></script> | ||
<style type="text/css"> | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<script type="text/javascript+protovis"> | ||
|
||
var vis = new pv.Panel() | ||
.width(function() window.innerWidth - 1) | ||
.height(function() window.innerHeight - 1) | ||
.margin(.5); | ||
|
||
vis.add(pv.Layout.Treemap) | ||
.data(pv.dom(flare).root("flare").nodes()) | ||
.mode("slice-and-dice") | ||
.order("descending") | ||
.add(pv.Panel) | ||
.overflow("hidden") | ||
.fillStyle("#aec7e8") | ||
.visible(function(d) !d.firstChild) | ||
.anchor("center").add(pv.Label) | ||
.textAngle(function(d) d.dx > d.dy ? 0 : -Math.PI / 2) | ||
.text(function(d) d.nodeName); | ||
|
||
vis.render(); | ||
|
||
window.onresize = function() vis.render(); | ||
|
||
</script> | ||
</body> | ||
</html> |
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