Formula for a Gauge

I want to create a gauge but I’m not mathematical enough to create the formula for drawing the pointer in the wanted direction.
Is there a kind of Xojo example available?
TIA.

Did you see my ChartDirector Plugin?

It can do gauges:
http://www.monkeybreadsoftware.de/xojo/chartdirector/gallery_meter.shtml

Looks nice Christian, I only have to create the backgrounds and pointers I guess.
But it cost me again a license and I don’t know at this point I would sell my idea to my customer.
Can I use the ChartDirector plugin in Xojo runmode to demo my idea?

you can always use a plugin without license for development or demonstration.

Sorry, I though you had a license. Maybe buy one or omegabundle?

Public Sub DrawGauge(g as graphics, ctrX As Integer, ctrY as Integer, ptrLength As Integer, ptrAngle As Double)
  'Draws gauge pointer outwards from coordinates ctrX,ctrY
  'Pointer angle is in degrees. Sign of angle may need to be changed and an offset added to get it to cover the correct range.
  const degRadConvert = 3.14159265358979/180
  dim termX As Integer = ctrX+ptrLength*cos(ptrAngle*degRadConvert)
  dim termY As Integer = ctrY+ptrLength*sin(ptrAngle*degRadConvert)
  g.DrawLine(ctrX,ctrY,termX,termY)
End Sub
1 Like

You can also look into the ArcShape, and drawing that into a canvas as a radial gauge. I use it for a custom progress wheel http://www.machdr.com