[英]How to set the concentric circle layout parameters in python dash_cytoscape?
我已經定義了我的元素,例如 level 指的是我想要該節點的圓層。
elements = [{'data': {'id': 'a', 'label': 'a', 'level': 1},
{'data': {'id': 'b', 'label': 'b', 'level': 1},
{'data': {'id': 'c', 'label': 'c', 'level': 2},
.......]
我嘗試了以下不起作用的方法(錯誤加載布局)
app.layout = html.Div([
cyto.Cytoscape(
id='cytoscape',
elements= elements,
layout={'name': 'concentric', 'concentric': lambda x: x['data']['level']}
)
])
javascript 文檔在這里https://js.cytoscape.org/#layouts並指定
let options = {
name: 'concentric',
concentric: function( node ){ // returns numeric value for each node, placing higher nodes in levels towards the centre
return node.degree();
}
我如何設置這個同心參數?
干杯
不幸的是,不可能將 python 函數傳遞給cyto.Cytoscape
組件中的layout
參數。 這是因為該函數不會被轉譯為 JS 函數,而這是concentric
鍵在options
內工作所需要的。
替代方案是:
cyto.Cytoscape
的源代碼並硬編碼您要用於同心布局的 JS function
。 您需要按照貢獻說明來構建和創建自定義安裝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.