Drawing on canvas in Habpanel widget?

I am inspired by the buienradar widget of @mattv but hate the MainUi. Is there a way to dynamically draw lines or rectangles on a canvas in a HabPanel custom widget?
I know it can be done in Angular, but I understand the scripting cannot be in the widget code.