# YAG - Yet another gauge.... for Processbook

Blog Post created by knightk on Mar 15, 2016

Here's a very easy to implement Gauge for Processbook using VBA (3 lines) and a couple of symbols. It should take 3 minutes to set it up from scratch! It will work best with tags scaled 0-100 but you can adjust as required. It's not the most scalable solution but hopefully someone finds a use for it.

1. Select the Arc tool and, holding shift, draw a quarter circle like below

2. Copy and paste this arc. Using shift key again, complete this arc to a semi circle by clicking in top corner and dragging the arc to complete it

3. Copy and paste the semi circle arc. Fill it with the same colour as your background. Place it on top of the other semi circle arc and resize it to make the rainbow shape.

4. Enable scripting on the original arc (right click, Enable scripting). Then right click it again select Properties and give it a name like Gauge_1. Fill this arc with a colour of your choice. Now move this arc in line with your other arcs, providing you followed in correct order it should look like below (if not, send the big arc to back and bring the small arc to front).

5. Draw two lines at the bottom of the gauge on either side to close the gap if desired. Add a PI tag value and place it near the gauge. Change the name of the value to something like GaugeVal_1 I have used everyones favourite tag SINUSOID here. (size 20, calibri, sky blue)

6. Now to make it work, open VBA editor and add this simple code.

```Private Sub GaugeVal_1_DataUpdate()
piVal = GaugeVal_1.GetValue(X, Y)
i = piVal * (175 / 100)
Gauge_1.StartAngle = 175 - I
End Sub
```

I arrived at the 175 value with a bit of trial and error. 100 is the span of the value. You could make it better by changing it to be a function and passing a range etc. but for the sake of 3 lines....

Now there is a radial gauge in PBook! Tip: try setting the gauge arc to be a multistate to it changes colour in relation to the value.