如何将vis.js中的箭头更改为鸡脚或基数 [英] How to change arrows in vis.js to chicken feet or cardinality

查看:332
本文介绍了如何将vis.js中的箭头更改为鸡脚或基数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用vis.js来显示XML或JSON模式的结构。我想显示基数而不是箭头。

I am trying to use vis.js to show the structure of an XML or JSON Schema. I would like to show cardinality instead of an arrow.

任何有关文档查看的建议,因为找不到。

Any suggestions on documentation to view, because I cannot find any.

感谢,
洛伦(Loren)

Thanks, Loren

推荐答案

每个边都有一个负责绘制箭头的功能: drawArrows 。因此,可以重新定义其:

Each edge has a function that is responsible for drawing arrows: drawArrows. Accordingly, it is possible to redefine its:

edge.drawArrows = function drawArrows(ctx, arrowData) {
    if (this.options.arrows.from.enabled === true) {
      drawArrowCircle(ctx, this.selected, this.hover, arrowData.from);
    }
    if (this.options.arrows.middle.enabled === true) {
      drawArrowDiamond(ctx, this.selected, this.hover, arrowData.middle);
    }
    if (this.options.arrows.to.enabled === true) {
      this.edgeType.drawArrowHead(ctx, this.selected, this.hover, arrowData.to);
    }
  }

https://jsfiddle.net/ct34zwn6/

这篇关于如何将vis.js中的箭头更改为鸡脚或基数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆