Thanks for sharing this.
Because you have rendered your widget as svg, you can actually skip the separate html file and just use the custom widgets to build the svg directly, This will also eliminate the need for the script section of the html because you can use widget expression right in the svg attributes.
The biggest advantage, however to moving this over to be 100% custom widget is that then you can post it to the marketplace and users can download it directly from their OH instance.
Here’s one great example of building an svg widget (with a linear gradient), if you want to take this project in that direction: