The code above sets the line's width to 1 inch per digits in the number.

If you want the line to be about the same total length as the number if you use a proportional font, then it's a little more complicated. But here's a way to do it.

First, create a global variable of measure type. Let's call it "linewidth". Then, create your data selection that will display the number. Make sure you check the "trim" options, and in it's PressTalk After properties, use this code:
&linewidth := &width
Then create your line, and you can set it's width to &linewidth. This will make the line the same width as the number. You can then make some adjustments using + or - if you need to.

Hope that helps.