我正在使用“JavaScript Infovis”工具包,“SpaceTree 控件”适合数据可视化的需求。
我正在使用“jQuery”调用“Ajax”将数据动态加载到树中。树加载良好。但是,当我单击任何节点时,我会收到以下错误消息:
画布未定义
我从我的 aspx 页面调用这个 Javascript 库:
$j(document).ready(function() {
var aURL = 'CompanyHierarchyList.ashx?CompanyID=<%=CompanyID %>';
$j.ajax({
url: aURL,
cache: false,
dataType: 'json',
success: function(json) {
LoadTree(json);
}
});
});
var st = new $jit.ST({
//id of viz container element
injectInto: 'infovis',
//set duration for the animation
duration: 200,
//set animation transition type
transition: $jit.Trans.Quart.easeInOut,
//set distance between node and its children
levelDistance: 50,
//set Orientation
orientation: 'top',
//.....
//set the other properties of node
//.......
st.loadJSON(json);
//compute node positions and layout
st.compute();
//optional: make a translation of the tree
st.geom.translate(new $jit.Complex(-200, 0), "current");
//emulate a click on the root node.
st.onClick(st.root);
//end
}
任何线索..
谢谢, 卡提克