我必须创建一个树结构表,其中包含一些以 json 数组形式给出的数据。
让我们举一个例子数组
array :
[
{ "continent": "Asia", "country":"India", "population": 100, "GDP":4},
{ "continent": "Asia", "country":"china", "population": 130, "GDP":20},
{ "continent": "Asia", "country":"Pakistan", "population": 20, "GDP":1},
{ "continent": "Europe", "country":"UK", "population": 2, "GDP":15},
{ "continent": "Europe", "country":"France", "population": 4, "GDP":16},
{ "continent": "Europe", "country":"Germany", "population": 5, "GDP":21}
]
桌子就像一棵可以展开或折叠的树。让树像,
continent country population GDP
Asia + 250 25
Europe - 11 52
UK 2 15
France 4 16
Germany 5 21
在上表中我们扩展了欧洲,在下表中我们扩展了亚洲。
continent country population GDP
Asia - 250 25
India 100 4
China 130 20
Pakisthan 20 1
Europe + 11 52
请帮助我创建具有汇总值的表格。
谢谢 :)