2

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

stdob--
  • 28,222
  • 5
  • 58
  • 73
Loren Cahlander
  • 1,257
  • 1
  • 10
  • 24

1 Answers1

3

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/

stdob--
  • 28,222
  • 5
  • 58
  • 73
  • Thank you! I edited what you created and added the cardinality text in place of the arrow. https://jsfiddle.net/lcahlander/g9pswzyv/1/ – Loren Cahlander Feb 24 '16 at 16:03