我正在与两个父母一起制作d3族谱,并希望随着孩子的加入而移动他们的兄弟姐妹

时间:2018-08-09 08:16:06

标签: javascript d3.js

我正在努力制作d3族谱。在这里,我希望每当我添加孩子时,父母的兄弟姐妹都与家人一起移动,以使他们的孩子不会重叠,然后两者之间的连接线保持在中间。

这里是jsfiddle

这是分隔代码:

class Product(models.Model):
    """
    product model
    """
    name = models.CharField(max_length=100, blank=True)
    company = models.ForeignKey(Company, blank=False, null=False, on_delete=models.CASCADE)
    category = TreeForeignKey('Category', null=True, blank=True, db_index=True, on_delete=models.CASCADE)
    image = models.FileField(upload_to='/company/', max_length=100, blank=True, null=True)
    description = models.TextField(blank=True, null=True)
    stocks = models.IntegerField(default=0, blank=True)


class Company(models.Model):
    """
    company model
    """
    name = models.CharField(max_length=150, blank=False, null=False)
    domain = models.URLField(blank=False, null=False)
    email = models.EmailField()
    description = models.TextField(blank=True)
    pan_number = models.CharField(max_length=100, blank=False, null=False)
    industry = models.CharField(max_length=150, blank=False, null=False)

class Join(models.Model):
    """
    Join Model
    """
    email = models.EmailField()
    friend = models.ForeignKey("self", related_name='referral', null=True, blank=True, on_delete=models.CASCADE)
    ref_id = models.CharField(max_length=120, default='ABC', unique=True)
    count_added = models.ForeignKey("self", null=True, related_name='count', blank=True, on_delete=models.CASCADE)
    ip_address = models.CharField(max_length=120, default='ABC')
    timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated = models.DateTimeField(auto_now_add=False, auto_now=True)

    def __str__(self):
        return '{}'.format(self.email)

当我已经有三个孩子后再添加孩子时,会发生这种情况{https://imgur.com/8ilijkp}

0 个答案:

没有答案