How to change arrows in vis.js to chicken feet or cardinality

◇◆丶佛笑我妖孽 提交于 2019-12-24 16:25:41

问题


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.

Thanks, Loren


回答1:


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/



来源:https://stackoverflow.com/questions/35581834/how-to-change-arrows-in-vis-js-to-chicken-feet-or-cardinality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!