Shape is not stretching according to the text

Are you using an “Auto” Panel with the Shape as the main element and the TextBlock as the second element? As demonstrated in many samples such as in Minimal GoJS Sample