var labelType, useGradients, nativeTextSupport, animate; (function() { var ua = navigator.userAgent, iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), typeOfCanvas = typeof HTMLCanvasElement, nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), textSupport = nativeCanvasSupport && (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); //I'm setting this based on the fact that ExCanvas provides text support for IE //and that as of today iPhone/iPad current text support is lame labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; nativeTextSupport = labelType == 'Native'; useGradients = nativeCanvasSupport; animate = !(iStuff || !nativeCanvasSupport); })(); var Log = { elem: false, write: function(text){ if (!this.elem) this.elem = document.getElementById('log'); this.elem.innerHTML = text; this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; } }; function init(){ //init data var json = { "children": [ { "data":{"cap":"","sec": "Yes","$area": 1,"$color":"#009900"}, "id": "Eni Spa *", "name": "Eni Spa *" }, { "data":{"cap":"","sec": "No","$area": 1,"$color":"#172A3A"}, "id": "Erg Spa *", "name": "Erg Spa *" }, { "data":{"cap":"€113,000,000","sec": "No","$area": 113000000,"$color":"#1D2A50"}, "id": "Rosetti Marino Spa", "name": "Rosetti Marino Spa" }, { "data":{"cap":"€955,755,000","sec": "No","$area": 955755008,"$color":"#1E2C4B"}, "id": "Saras Spa", "name": "Saras Spa" }, { "data":{"cap":"","sec": "No","$area": 1,"$color":"#192B38"}, "id": "Saipem-rcv *", "name": "Saipem-rcv *" }, { "data":{"cap":"€15,722,288,000","sec": "No","$area": 15722288128,"$color":"#1C325B"}, "id": "Saipem Spa", "name": "Saipem Spa" }, { "data":{"cap":"€95,141,052,000","sec": "Yes","$area": 95141052416,"$color":"#009900"}, "id": "Total Sa *", "name": "Total Sa *" }, { "data":{"cap":"€18,298,321,000","sec": "Yes","$area": 18298320896,"$color":"#009900"}, "id": "Tenaris Sa", "name": "Tenaris Sa" }, { "data":{"cap":"","sec": "No","$area": 1,"$color":"#17284F"}, "id": "Kme Group-rsp *", "name": "Kme Group-rsp *" }, { "data":{"cap":"€157,757,000","sec": "No","$area": 157756608,"$color":"#1C2D53"}, "id": "Kme Group", "name": "Kme Group" }, { "data":{"cap":"€24,409,000","sec": "No","$area": 24408692,"$color":"#153160"}, "id": "Gruppo Minerali Maffei", "name": "Gruppo Minerali Maffei" }, { "data":{"cap":"€341,205,000","sec": "No","$area": 341204992,"$color":"#162A34"}, "id": "Maire Tecnimont Spa", "name": "Maire Tecnimont Spa" }, { "data":{"cap":"€220,955,000","sec": "No","$area": 220955344,"$color":"#1B3238"}, "id": "Gas Plus", "name": "Gas Plus" } ] }; //end //init TreeMap var tm = new $jit.TM.Squarified({ //where to inject the visualization injectInto: 'infovis', //parent box title heights titleHeight: 0, //enable animations animate: false, //box offsets offset: 1, //Attach left and right click events Events: { enable: false }, duration: 1000, //Enable tips Tips: { enable: true, //add positioning offsets offsetX: 20, offsetY: 20, //implement the onShow method to //add content to the tooltip when a node //is hovered onShow: function(tip, node, isLeaf, domElement) { var html = "