Cocos Creator 3 drawing with graphics does not display

I am using Cocos Creator 3.

I add cc.Graphics component to a node. This node is in UI_2D layer.

got reference to the component by

this.node.getComponent(Graphics);

Then I try following code to draw a rectangle.

     this.graphics.lineWidth = 2;


    this.graphics.moveTo(arrPoints[0].x, arrPoints[0].y);
    this.graphics.lineTo(arrPoints[1].x, arrPoints[1].y);
    this.graphics.lineTo(arrPoints[2].x, arrPoints[2].y);
    this.graphics.lineTo(arrPoints[3].x, arrPoints[3].y);
    this.graphics.close();

    this.graphics.strokeColor = Color.WHITE;
    this.graphics.stroke();

But it does not draw anything. What am I doing wrong here ?