Database Reference
In-Depth Information
window.alert('error: ' + xhr.statusText);
}
}
);
}
Note that this replaces the same code that you copied for conversion, but this
time it is all the content from line 29 to the end of the file
This is an asynchronous call to the C# web service (which is specified in the
line beginning with URL), and replaces the hardcoded data that was in this
file originally. As an asynchronous call, you have to have another function
that creates the visualization to allow it to only execute after data is returned.
This function is called CreateVisual and is specified in the success result of
the AJAX call.
Then, place the code below code directly below the code you have pasted
above.
function CreateVisual(jsontext) {
var json = eval('(' + jsontext + ')');
var tm = new $jit.TM.Squarified({
//where to inject the visualization
injectInto: 'infovis',
//parent box title heights
titleHeight: 15,
//enable animations
animate: animate,
//box offsets
offset: 1,
//Attach left and right click events
Events: {
enable: true,
onClick: function(node) {
if(node) tm.enter(node);
},
onRightClick: function() {
tm.out();
}
},
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
Search WWH ::




Custom Search