Javascript with Vaadin

I am busy trying a use a javascript gantt together with Vaadin. Because it wasn’t working I created a small helloworld project. This project display the text but not the stroke I want to draw. I think it has something todo with the canvas but I am not sue. The javascript code is bellow. For my hello world I use https://vaadin.com/blog/-/blogs/vaadin-7-loves-javascript-components as reference. Who can tell me why the stroke is not created?

com_gerrist_js_helloworld_JsLabel = function() {
var e = this.getElement();

this.onStateChange = function() {
e.innerHTML = this.getState().xhtml;

    var context;
    context = e.getContext("2d");
     
    context.beginPath();
    context.moveTo(100, 100);
    context.lineTo(200, 200);
    context.stroke();

}
}

Chris