1
我有HighChart Treemaps的問題。我一直在研究一個具有相同瓦片的自定義算法。雖然我有我的自定義算法工作(感謝其他SO問題),但我無法實現向下鑽取。自定義算法適用於父節點。當我點擊一位父母時,只有最新的孩子覆蓋整個地圖。我嘗試定製算法,但它沒有去。使用Highchart Treemaps(向下鑽取)
任何幫助,高度讚賞。代碼發佈在JSfiddle上。綠瓦有孩子。紫色父母沒有一個。
function myFunction(parent, children) {
var x = parent.x,
y = parent.y,
w=20,
h=20,i,j,
childrenAreas = [];
console.log(parent);
console.log(children);
Highcharts.each(children, function(child) {
if(child.level == 1)
{
//console.log("if part"+child.i+" "+x+ " "+y);
if(x>=parent.width)
{
x=parent.x;
y+=h;
}
else
{
x+=w;
}
}
else
{
//console.log(child);
}
childrenAreas.push({
x: x,
y: y,
width: w,
height: h
});
//console.log(parent.x+w);
});
//console.log(childrenAreas);
return childrenAreas;
};
TIA
工程就像一個魅力!非常感謝!解釋+1! :) – Pavan
嘿@Grzegorz,我有一個問題。如果我開始向數據數組添加更多元素,它不會顯示,也不會顯示在下一行中。如何在畫布寬度耗盡後顯示拼貼?現在,顯示的元素的最大數目是11. 11之後,我推送到數組的任何數量的元素都不會顯示。請幫忙。 – Pavan
你可以用標準的Highcharts鑽取來看這個例子:http://jsfiddle.net/99rbh2qj/9/我已經改變了自定義函數 –