How to include draw.io diagrams into LyX documents
In draw.io in the browser, go to the File menu, Export submenu, export as PDF. (I did not succeed in getting SVG output to work with LyX.) Select "crop" in the PDF export dialog. Export the PDF to the same directory where your LyX document is.
In LyX, go to the Insert menu, choose Float, choose Figure. (A "float" creates the style that the diagram is at the top or bottom of the page, as opposed to inline.)
In the new "figure", type in the name (e.g. "Database Diagram"), this will appear in the figure's caption.
With the cursor in the caption, use the Insert menu, choose Label. (You can't add cross-references to figures unless you add a "Label" which will be the thing referenced by the cross-reference.)
In the figure, above the caption, place the cursor. Use the Insert menu, Graphics. Choose the PDF file. Set the width to be 100% of the column width, meaning the graphic is full-width. The graphic will not show up in the LyX preview, but does show up in the output.
In your text, write text such as "see figure" and then use the Insert menu, Cross-Reference, select the "Label" you created earlier. Use either the format "<reference>" (just inserts the figure number e.g. "1.2") or "<reference> on page <page>".