jtopo node.text换行_JTopo 使用

本文介绍了如何使用JTopo库创建圆形布局,并展示了节点的`layout`属性设置,包括`tree`和`circle`两种布局方式。同时,探讨了容器(Container)的使用,如添加节点、设置布局以及调整样式。还提及了链接(Link)的不同样式,如直线、折线和曲线等。
摘要由CSDN通过智能技术生成

2. 引入js文件,引入jtopo之前引入jQuery

3. JTopo Demo -- 圆形布局

步骤:  获取canvas ——> 创建stage ——> 创建scene添加的stage ——> 创建节点添加到scene

$(document).ready(function(){var canvas = document.getElementById(‘canvas‘);var stage = newJTopo.Stage(canvas);//显示工具栏

showJTopoToobar(stage);var scene = newJTopo.Scene();

stage.add(scene);

scene.background= ‘./img/bg.jpg‘;var cloudNode = new JTopo.Node(‘root‘);

cloudNode.setSize(30, 26);

cloudNode.setLocation(360,230);

cloudNode.layout= {type: ‘circle‘, radius: 150};

scene.add(cloudNode);for(var i=1; i<4; i++){var node = new JTopo.CircleNode(‘host‘ +i);

node.fillStyle= ‘200,255,0‘;

node.radius= 15;

node.setLocation(scene.width* Math.random(), scene.height *Math.random());

node.layout= {type: ‘circle‘, radius: 80};

scene.add(no

解释一下这段代码 def add_seq_to_prefix_tree(self, root_node, cluster: LogCluster): token_count = len(cluster.log_template_tokens) token_count_str = str(token_count) if token_count_str not in root_node.key_to_child_node: first_layer_node = Node() root_node.key_to_child_node[token_count_str] = first_layer_node else: first_layer_node = root_node.key_to_child_node[token_count_str] cur_node = first_layer_node if token_count == 0: cur_node.cluster_ids = [cluster.cluster_id] return current_depth = 1 for token in cluster.log_template_tokens: if current_depth >= self.max_node_depth or current_depth >= token_count: new_cluster_ids = [] for cluster_id in cur_node.cluster_ids: if cluster_id in self.id_to_cluster: new_cluster_ids.append(cluster_id) new_cluster_ids.append(cluster.cluster_id) cur_node.cluster_ids = new_cluster_ids break if token not in cur_node.key_to_child_node: if self.parametrize_numeric_tokens and self.has_numbers(token): if self.param_str not in cur_node.key_to_child_node: new_node = Node() cur_node.key_to_child_node[self.param_str] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: if self.param_str in cur_node.key_to_child_node: if len(cur_node.key_to_child_node) < self.max_children: new_node = Node() cur_node.key_to_child_node[token] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: if len(cur_node.key_to_child_node) + 1 < self.max_children: new_node = Node() cur_node.key_to_child_node[token] = new_node cur_node = new_node elif len(cur_node.key_to_child_node) + 1 == self.max_children: new_node = Node() cur_node.key_to_child_node[self.param_str] = new_node cur_node = new_node else: cur_node = cur_node.key_to_child_node[self.param_str] else: cur_node = cur_node.key_to_child_node[token] current_depth += 1
最新发布
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值