# widget graphic for Velocity ?

**URL:** <https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831>\
**Category:** Blueprint\
**Tags:** unreal-engine, Widget\
**Created:** [October 24, 2022, 8:19am UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831 "2022-10-24T08:19:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toonix091](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Toonix091](https://forums.unrealengine.com/u/Toonix091)\
**Post date:** [October 24, 2022, 8:19am UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/1 "2022-10-24T08:19:48Z")

</div>

Hi , i would like to make a widget to see the velocity in graphic like this :

 ![Capture d’écran 2022-10-24 101431](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/6/c16f55536fa6f48a15671e504b5b82aba9dd661b.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 24, 2022, 8:37am UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/2 "2022-10-24T08:37:57Z")

</div>

I noticed this

> [@Draw Line node in a UMG Widget](https://forums.unrealengine.com/t/draw-line-node-in-a-umg-widget/309257):
>
> I want to draw a line between two points on the screen in a UMG Widget, and it seems I can do that with a Draw Line node, but it has a context input which from what I’ve found is from a OnPaint event, but I cant seem to find how to get that. [image]

---

<div class="post-metadata">

**Author:** ![Toonix091](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Toonix091](https://forums.unrealengine.com/u/Toonix091)\
**Post date:** [October 24, 2022, 12:13pm UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/3 "2022-10-24T12:13:38Z")

</div>

it’s not realy what I want , I mean it doesn’t help me much, I managed to display the speed value numerically but I want it graphically and I don’t know much about UE4 but here is my blueprint

 ![Capture d’écran 2022-10-24 141156](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/7/a677d0982aaa6694feec7f91553da07857dfda95.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 24, 2022, 12:15pm UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/4 "2022-10-24T12:15:34Z")

</div>

How about this?

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/6/c263b9f51e100c4a89947028ab31370d074a77e2.jpeg "WTF Is? UMG: Draw Lines in Unreal Engine 4 ( UE4 )") ](https://www.youtube.com/watch?v=WnncB7J0Zk8)

He actually tells you how to do it…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 24, 2022, 1:26pm UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/5 "2022-10-24T13:26:53Z")

</div>

You could absolutely do it with draw lines (in widget’s paint, in material or in the HUD class even) but it _may_ become cumbersome to manage as it grows in complexity, annoying to refactor. That would be a cool exercise, for sure.

* * *

You could have a look at the math hall and familiarise with the way materials can visualise function graphs:

> **[Math Hall Content Examples](https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/MathHall/)**
>
> Overview of the samples provided in the Math Hall Content Examples.

Namely:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/f/63f33fb3aabea61a203145fd3fbe8215dee8b369.png)

The widget can then display that material. That’d be a very efficient albeit math heavy approach.

* * *

You could get _cheeky_, though, and keep adding elements to a scroll box:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/d/5bd3bafd4d4ee24358db05cb347b75eead525573.jpeg)

Above, I’m sampling the player’s velocity every .5s, create border widgets with a specific height and push them into a scrollbox, scrolling to the last element with each push.

Seems like it’s worth exploring for something developed rapidly that needs virtually no upfront investments. A crude example:

To make it more efficient over time, use List View instead of a Scroll Box.

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [October 24, 2022, 2:27pm UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/6 "2022-10-24T14:27:42Z")

</div>

Here’s an old piece of mine

1. create new widget

2. set up a bunch of variables :

- GraphPoints : array of Vector2D to store X,Y points
- Duration : the amount of time shown on graph (eg. show velocity graph of past 5 seconds)
- MaxFps : the maximum sampling rate (eg. 10 points per second, multiplied by 5 seconds = 50 lines to draw, keep performance in mind)
- Width, Height : size of graph (eg. 400 x 200)
- MaxSpeed : size of the Y axis (eg. 1500)
- LastIndex, FVel : just some local cache variables  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/4/d/64d4c5eda371345e63532f0c44256f1e31fd4c88.png)

Initialize all the points at the bottom-right-most end of graph, and start timer

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/d/f8d900c62c39060fff18eac96ecb87be11cde97e.png)

On timer get current velocity and update the graph points

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/9/3e9a725d8ef431fcb53888a20bfd58dd50f5c1ea.png)

Then override the OnPaint function for your widget to draw lines

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/b/2eb6734d80f37b5f5018eb0d3a5e16e07d3fef4a.png)

---

<div class="post-metadata">

**Author:** ![ilike9527](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ilike9527](https://forums.unrealengine.com/u/ilike9527)\
**Post date:** [August 17, 2024, 10:58am UTC](https://forums.unrealengine.com/t/widget-graphic-for-velocity/675831/7 "2024-08-17T10:58:38Z")

</div>

With the help of plugins “UMGPolygon” and “UMGSpline”, you can draw graphs conveniently in UMG.

Marketplace Url:  
[https://www.unrealengine.com/marketplace/en-US/product/umgpolygon](https://www.unrealengine.com/marketplace/en-US/product/umgpolygon)

[https://www.unrealengine.com/marketplace/en-US/product/umgspline](https://www.unrealengine.com/marketplace/en-US/product/umgspline)
