Speedometer Dashboard (1 Viewer)

Mick99

New member
Local time
Today, 06:14
Joined
Feb 19, 2016
Messages
14
Hi All,

I am wanting to add a dashboard form with multiple speedometers to display progress and project health. Is there an example that someone could share with me.

Cheers Mick
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    18.8 KB · Views: 113

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:14
Joined
May 21, 2018
Messages
8,463
I think this would be rather easy to do. Take the background image without the line and overlay a line. Then move the line based on the value. I have not done it, but done something a little more advanced and that is an analog clock. This is overkill, but you can see some of the basic techniques.

However, the easiest way would be to make like 10 or 20 images (0%, 10%,....100% or by 5%). Then you can display the correct images in an image control based on the value. This would be easier than coding the line.
 

Attachments

  • AnalogClock.accdb
    368 KB · Views: 276
Last edited:

Micron

AWF VIP
Local time
Today, 09:14
Joined
Oct 20, 2018
Messages
3,476
It's a common question; most examples seem to be designed for Excel but if it involves code, it should work in either I'd guess.
I imagine they alter the height, width and left properties of a line using some sort of trigonometric function/calculation but I've never looked into it - or I've forgotten if I have.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:14
Joined
Feb 28, 2001
Messages
26,998
Doing it with an arc is tricky but you can do rectangles pretty easily. I used horizontal ones where you fix the TOP and LEFT properties, fix the HEIGHT property to something relatively small, and then vary the WIDTH property.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:14
Joined
May 21, 2018
Messages
8,463
As I previously said. All the code is the same as the clock.
1) I added a subform with your image and a line.
2) I made the subform instantiate the RotatingDial Class
3) Now the user needs to drop the subform wherever they want and set the percent complete.

Here is the entire code to make this work
Private Sub Form_Current()
Me.sub1.Form.SetPercent Me.Task1
Me.sub2.Form.SetPercent Me.Task2
Me.sub3.Form.SetPercent Me.Task3
End Sub

The only trick here was to convert percent to an angle since the code was originally meant for a 360 deg dial. So 0% is 270 degrees, 50% is 0, and 100% is 90.

If you notice 25% is slightly off. This is because I did not get the starting point of the line directly in the center of the dial in design view. You can play with it to try to get it more centered. 75% lines up better.

speed2.jpg


Speed.jpg
 

Attachments

  • Speedometer.accdb
    764 KB · Views: 171
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:14
Joined
May 21, 2018
Messages
8,463
For fun adding a moving version to show how to make it move.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:14
Joined
May 21, 2018
Messages
8,463
I still think the better option is to use a set of images and store them in the database. I think you could make it look nicer and would give you more options for use. This could actually allow you to have progress bars in a continuous form.
 

Mick99

New member
Local time
Today, 06:14
Joined
Feb 19, 2016
Messages
14
HI MajP, thank you very much, I so appreciated your work on this. You have all been a great help many thanks.

Cheers Mick
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:14
Joined
May 21, 2018
Messages
8,463
In design view if you click on the line then use the left arrow key to move it one time, it will line up. Good luck, and post back with final approach that you use.
Speedometer4.jpg
 

Attachments

  • Speedometer4.accdb
    836 KB · Views: 317

Users who are viewing this thread

Top Bottom