# Loader for graphs, charts

**URL:** <https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 29, 2025, 10:33am UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812 "2025-05-29T10:33:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 29, 2025, 10:33am UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/1 "2025-05-29T10:33:48Z")

</div>

Hello,

I would like to share a way to put a loader in big graphs.

1.- Add a script transform to the binded data

```python

	system.perspective.sendMessage(
		messageType="startLoading",
		scope="view" 
	)
	
	
	return value

```

2.- Add another script at the end of all data flow

```python
	system.perspective.sendMessage(
						messageType="finishLoading",
						scope="view"
					)
			
	

```

3.-In configure scripts add the message handlers startLoading and finishLoading

```python
startLoading:
def onMessageReceived(self, payload):

	system.perspective.openPopup(
	    id="isLoadingGrafica-popup", 
	    view="Page/IsLoadingGrafica",
	    title="",
	    width=273,
	    height=128,
	    overlayDismiss=False,
	    modal=False
	)
--------------------------------------------------------------

finishLoading:

def onMessageReceived(self, payload):

	system.perspective.closePopup(id="isLoadingGrafica-popup")

```

4.- setup your popup screen as you wish IsLoadingGrafica

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5fcd3d66ffe96f64371014ab36e20b46348777e.png)

This way user will always now something is going on while large graphs are loading.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/0/1055dc413f57114063a459ed9204dc39a2dad3ca.png)

Cheers!

---

<div class="post-metadata">

**Author:** ![drojas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drojas/32/3403_2.png) [@drojas](https://forum.inductiveautomation.com/u/drojas)\
**Post date:** [November 25, 2025, 8:34pm UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/2 "2025-11-25T20:34:37Z")

</div>

@Alejandro_Alaco , did you find this method better or easier than what @pascal.fragnoud suggested in this post? What did you like more/less?  
I ask because I am about to implement this and wanted to see if one method is preferred vs. another.

> [@Loader gif in top of table?](https://forum.inductiveautomation.com/t/loader-gif-in-top-of-table/96477/2):
>
> Just use a popup. Here's a simplified version of what I use: play_button decoratorplay_button popup view jsonplay_button css Here's how to use it: When you have a function that may take time to run, put it in your library, and decorate it with the loading decorator. It should look like this: @some\_module.loading("message") def slow\_function(): sleep(20) Now call that function in your transforms or whatever. That's it. You can replace the loading animation by just replacing the svg in the popup. You can find some he…

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 25, 2025, 10:38pm UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/3 "2025-11-25T22:38:51Z")

</div>

Frankly, I don't understand why you'd want to introduce an extra layer of messages and handlers. This requires extra setup, for no gain.  
The general idea is the same: open a popup, process things, close popup.  
The decorator handles this by opening and closing the popup for you, with a try/except/finally to make sure the popup is always closed, even if the code raises an error.  
Bringing message into this only adds steps and complexity for which I can't find a justification.  
The only thing it brings would be that you don't need to add a function in your script library...  
But if that's really an issue, you can define that function in the event/transform and decorate it there. But frankly, if a function may take long enough to warrant a spinner, it probably deserves a spot in the library.

Actually, I guess this could be used to open the spinner on some event and close it on another event, but that sounds like a terrible idea. I really wouldn't do that. I'd rather decorate each event, which adds the possibility of displaying different loading messages for different steps of the process.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2025, 10:21am UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/5 "2025-11-26T10:21:48Z")

</div>

But you are using a popup too, no?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 26, 2025, 10:24am UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/6 "2025-11-26T10:24:42Z")

</div>

Yes, as I said, the general idea is the same:

- open popup
- do the slow processing
- close popup

But I simply call `system.perspective.openPopup` and `closePopup` instead of sending messages.  
This means we don't need message handlers or anything.

Having this in a decorator also means that the error handling is abstracted and you don't need to worry about it

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2025, 10:26am UTC](https://forum.inductiveautomation.com/t/loader-for-graphs-charts/106812/7 "2025-11-26T10:26:19Z")

</div>

ok, great, thanks for the explanation, will try on
