我想設置OKFN泡泡樹。 https://github.com/okfn/bubbletree/wiki/Bubble-Tree-DocumentationOKFN泡泡樹中的數據輸入
現在我想在這裏輸入一些數據。我想深入三層。但是由於某種原因它不起作用。這是html文件中的代碼
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title>Mijn financien</title>
<script type="text/javascript" src="../../lib/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="../../lib/jquery.history.js"></script>
<script type="text/javascript" src="../../lib/raphael.js"></script>
<script type="text/javascript" src="../../lib/vis4.js"></script>
<script type="text/javascript" src="../../lib/Tween.js"></script>
<script type="text/javascript" src="../../build/bubbletree.js"></script>
<script type="text/javascript" src="http://assets.openspending.org/openspendingjs/master/lib/aggregator.js"></script>
<link rel="stylesheet" type="text/css" href="../../build/bubbletree.css" />
<script type="text/javascript" src="../../styles/cofog.js"></script>
<script type="text/javascript">
$(function() {
var data = {
label: 'Totaal',
amount: 100,
children: [
{ label: 'Een hele lange zin om te testen hoe dat eruit komt te zien', amount: 10, color: '#D95F02',
children: [
{ label: 'Dingen', amount: 5, color: '#66C2A4' },
{ label: 'Stuff', amount: 5, color: '#B2E2E2' }
] },
{ label: 'Dingen en stuff', amount: 80, color: '#1B9E77',
children: [
{ label: 'Dingen', amount: 30, color: '#66C2A4' },
{ label: 'Stuff', amount: 50, color: '#B2E2E2' }
]
},
{ label: 'Bananen in pyjamas', amount: 10, color: '#7570B3',
children: [
{ label: 'Bananen', amount: 5, color: '#7570B3' },
{ label: 'Pyjamas', amount: 5, color: '#7570B3',
children: [
{ label: 'Dingen', amount: 3, color: '#66C2A4' },
{ label: 'Stuff', amount: 2, color: '#B2E2E2' }
] }
]
}
]
};
new BubbleTree({
data: data,
bubbleType: 'icon',
container: '.bubbletree'
});
});
</script>
</head>
<body>
<div class="bubbletree-wrapper">
<div class="bubbletree"></div>
</div>
</body>
</html>
它在我移除最深層時起作用,但這還不夠。我該如何做這項工作?
我知道還有一種方法可以使這種可視化工作與JSON,但我真的不明白這個邏輯。如果這是B計劃,有人可以幫助我,那會很棒。