refine nodes

This commit is contained in:
Cindy Chang
2024-08-21 15:33:55 +08:00
parent 85b8536f3a
commit 23a21f1b0a
2 changed files with 10 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
// 使用 data() 是因為在 cytoscape 中從陣列轉為 function
text = node.data('label').length > 10 ? `${node.data('label').substr(0, 10)}...\n\n` : `${node.data('label')}\n\n`;
// 在 element 中 activity 歸類在 default所以要先判斷 node 是否為 activeity 才裝入文字。
// 在 element 中 activity 歸類在 default所以要先判斷 node 是否為 activity 才裝入文字。
// 可使用 parseInt(整數) parseFloat(浮點數) 將字串轉為數字
// Relative 要轉為百分比 %
if(node.data('type') === 'activity') {
@@ -169,15 +169,16 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
'text-margin-x': function(node) {
return node.data('type') === 'activity' ? -5 : 0;
},
// 'text-justification': 'left',
'text-halign': 'center',
'text-valign': 'center',
'height': 'data(height)',
'width': 'data(width)',
'color': '#001933',
'color': 'data(textColor)',
'line-height': '0.7rem',
'font-size':
function(node) {
return node.data('type') === 'activity' ? 14 : 22;
return node.data('type') === 'activity' ? 16 : 14;
},
},
},