How to draw a polygon in draw.io

draw.io

I want to draw a free-hand polygon, to enclose certain portions of my diagram so I can identify them as being part of Phase I development, for example. Is there a polygon tool in draw.io?

Best Answer

Start by adding the polygon shape to your drawing. The polygon shape is within the "Basic" shapes group. You may need to bring the "Basic" shapes group into view from the "View" > "Shapes..." menu.

Next, select your polygon and click "Edit Style". There you will see something like:

shape=mxgraph.basic.polygon;polyCoords=[[0.25,0],[0.75,0],[1,0.25],[1,0.75],[0.75,1],[0.25,1],[0,0.75],[0,0.25]];

Add/Remove additional points to the polyCoords array and click on Apply. No need to worry about getting the coordinates correct -- we'll move them around in the next step. Just keep them within the boundary of your shape (from 0.0 to 1.0). Click Apply.

Finally, move your points around on the drawing canvas.