Question

What is the best way to implement an octagon shape in JointJS. I really like the library but I find it hard to find specific Elements that may or may not be part of the library.

In my case I need an octagon shape. While it may very well already be part of the framework, what is the right approach to create that CustomShape. Adding an SVG polygon just doesn't quite do the job, as it should be somewhat dynamic.

Was it helpful?

Solution

Okay, I just found the answer to it.

pathState = new joint.shapes.basic.Path ({
            size: { width: 200, height: 100 },
            attrs: {
                path: { d: 'M 25 0 L 175 0 200 25 200 50 200 75 175 100 25 100 0 75 0 25 z' },
                text: {
                    text: 'Octagon',
                    'ref-y': .5 
                }
            }
        });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top