Javascript library to implement a interactive zoomable treemap.
Below is quick example how to use :
Download the latest version library and include it in your html.
<scriptsrc="js/jquery.js"></script><scriptsrc="js/d3.min.js"></script><scriptsrc="js/d3plus.min.js"></script><scriptsrc="js/map3.js"></script><linkhref="map3.css" rel="stylesheet">Add a container in your html :
...
<divid="treemap"></div>This code build a simple treemap
...
varviz=newMap3({container: "#treemap",label: "value",size: "size"});viz.data(vizData);The available configuration options from a treemap:
Type: String
Container where the list will build.
Type: Array|String
The json attribute name that determines the label of the box.
Type: Array
The json attribute name that determines the size of the box.
Type: Array|String
The Array of attributes that define the hierarchy of treemap.
Type: d3plus.time
Define the timeline of the treemap. See d3plus
Type: Options
{String}region: See d3plus location.{Object}translate: the translation map.
Support specifying a locale to use for translating common interface words and phrases into a different language.
varviz=newMap3({container: "#treemap",
...
locale: {region: "es_ES",translate: {"size": "Monto"}}});The available functions to interact with the treemap:
Type: Function
{Array}data: the visualization data.
Sets the data associated with your visualization.
varvizData=[{"value": "Data1","size": 2065724632,},{"value": "Data2","size": 141765766652,},{"value": "Data3","size": 48130171902,}];varviz=newMap3({container: "#treemap",label: "value",size: "size"});//do something//setting dataviz.data(vizData);Type: Function
{Array}data: the visualization data.
Redraw the visualization with new data.
Type: Function
{Object} options: the value to format.
Wrapper method for d3plus.config.
varviz=newMap3({...});viz.config({color: {scale: ["#fdae6b","#EACE3F",
...
"#e099cf","#889ca3"]}});//setting dataviz.data(vizData);Type: Function
{String}event: the name of the event.{Function}handler: handler function.
The events available are:
drill-down: triggered when a box of the multilevel treemap is clicked.drill-up: triggered when a element of breadcrumb is clicked.
varviz=newMap3({...});viz.on("drill-down",function(d){//do somethingconsole.log(d);});viz.on("drill-up",function(d){//do somethingconsole.log(d);});//setting dataviz.data(vizData);If you've found a bug or have a great idea for new feature let me know by [adding your suggestion] (http://github.com/mbaez/3map/issues/new) to issues list.