# Ignition Exchange Ribbon Chart issue

**URL:** <https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855>\
**Category:** Ignition Exchange\
**Tags:** perspective\
**Created:** [June 9, 2023, 6:22pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855 "2023-06-09T18:22:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditi.misra](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@aditi.misra](https://forum.inductiveautomation.com/u/aditi.misra)\
**Post date:** [June 9, 2023, 6:22pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/1 "2023-06-09T18:22:41Z")

</div>

Any progress made gets deleted any time I save the project and close the window and come back to it. It reloads the originally data. Any fix besides disabling the script behind the exampleData property.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 9, 2023, 6:31pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/2 "2023-06-09T18:31:49Z")

</div>

What is a '-Status/Ribbon Chart'? It's not listed in the Perspective Components pallette in Version 8.1.25. When you say 'data' do you mean props configuration?

---

<div class="post-metadata">

**Author:** ![aditi.misra](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@aditi.misra](https://forum.inductiveautomation.com/u/aditi.misra)\
**Post date:** [June 9, 2023, 6:34pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/3 "2023-06-09T18:34:48Z")

</div>

It is the template provided by Ignition Exchange -[Ignition Exchange | Inductive Automation](https://inductiveautomation.com/exchange/1514/overview)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 9, 2023, 6:37pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/6 "2023-06-09T18:37:01Z")

</div>

@bmusson is apparently the author, he may be able to provide more information.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [June 9, 2023, 8:56pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/7 "2023-06-09T20:56:34Z")

</div>

There does appear to be a bug in the property change script on `Template.view.params.exampleData`; replacing the script with this one should fix your issue.

```python
#	if (previousValue is None) or (currentValue.value is True):
	if (currentValue.value is True):
		exampleData = [
		  {
			"events": [
			  {
				"mode": "CIP",
				"start": 1569000471549,
				"end": 1569549471549
			  },
			  {
				"mode": "Production",
				"start": 1570000471549,
				"end": 1570149471549
			  }
			],
			"name": "Machine 1"
		  },
		  {
			"events": [
			  {
				"mode": "CIP",
				"start": 1570000471549,
				"end": 1571549471549
			  },
			  {
				"mode": "Production",
				"start": 1568700471549,
				"end": 1569800471549
			  },
			  {
				"mode": "Specified Color Code",
				"start": 1568000471549,
				"end": 1568679471549
			  }
			],
			"name": "Machine 2"
		  }
		]
		exampleModes = [
		  {
			"name": "Production"
		  },
		  {
			"name": "CIP"
		  },
		  {
			"name": "Specified Color Code",
			"color": "#31a131"
		  }
		]
		exampleRange = {
		  "end": 1571149471549,
		  "start": 1567149471549
		}
		
		self.params.data = exampleData
		self.params.modes = exampleModes
		self.params.range = exampleRange

```

I'll also update the version on the exchange to include this change.

---

<div class="post-metadata">

**Author:** ![aditi.misra](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@aditi.misra](https://forum.inductiveautomation.com/u/aditi.misra)\
**Post date:** [June 12, 2023, 6:18pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/8 "2023-06-12T18:18:54Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c9a2de1b7566ea08f09b3c593aed8a84595590dd.jpeg)  
The script provided above helps to retain the props.datasources but the values under Template.view.params.data , Template.view.params.modes and Template.view.params.range is getting wiped off if I am restarting the project. Is it because of some other script or am I missing something ?  
@bmusson

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [June 21, 2024, 5:49am UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/9 "2024-06-21T05:49:30Z")

</div>

Hoping someone can help,

I am having trouble trying to set the Ribbon Chart up. I have managed to get a dataset which populates correctly in the data section, I have added all the different modes and time range I am looking at.

However, the Ribbon Chart only displays one color, even though the data is showing 44 events.

It also appears that it is not using the full time range inputted.

Any help regarding this would be appreciated.

 ![ribbon4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6a632ee0c8f138b2dd93743c4c9f60d99a0e7ab4.png)

 ![ribbon1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d97a5746a3d522724ffb6b8f059c89c74c53e8b1.png)  
 ![ribbon2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/d/6df4edd22505bc793bb41b998ba044d2d11dd968.png)  
 ![ribbon3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a65129d10f2f967306cc8bcda11edb38ee74bff7.png)

The code i am using to convert the dataset into the correct structure (thanks to @drojas)

```python
def transform(self, value, quality, timestamp):
	data = value
	start = system.date.addHours(system.date.now(), -24)
	prevmode = -1
	prevstart = 0
	events = []
	modes = {0:"Shutdown", 1:"ProductionPreparation", 2:"Production", 3:"ProductionFlush", 4:"ProductionShutdownPreparation", 5:"CIPPreparation", 6:"CIP", 7:"CIPShutdownPreparation", 8:"Fault" }
	for row in range(data.getRowCount()):
		mode = data.getValueAt(row,1)
		time = system.date.toMillis(data.getValueAt(row,0))
		if row == 0:
			prevmode = mode
			prevstart = system.date.toMillis(start)
		if row > 0:
			if mode <> prevmode:
				events.append({
					"mode": modes[prevmode],
					"start": prevstart,
					"end": time,
				})
				prevmode = mode
				prevstart = time
	data = ([
		{"name": "ROPlant",
		"events": events
		}
	])
	return data

```

Thanks  
Richard

---

<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:** [June 21, 2024, 2:31pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/10 "2024-06-21T14:31:40Z")

</div>

@richard_hamilton , it has been a while since I played with the ribbon chart. I don't know what version of Ignition you are on, but there was one time I had to divide ALL times by 1000 for the chart to work...then, in a later version it stopped working again, I removed the divide by 1000 and it worked again. I'll open up the project and check out some of the data format and other code.

---

<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:** [June 21, 2024, 2:37pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/11 "2024-06-21T14:37:22Z")

</div>

@richard_hamilton , why does the Shutdown event 2 have the same end time as Production event 1 end time? Is your query to return all the events mutually exclusive (you can't be in more than 1 state at a time)? Since the start and end of Event 2 is the same, it may not even show up on the chart anyways, but this could cause performance issues if you have a lot of events that have the same start/end times.

Actually, you may need to look at your Event 0 start and end time. Does the start of Event 0 equal the range start time? An easy fix to this is to look at how you are getting your events. If using `system.tag.queryTagHistory()`, be sure to add the `includeBoundingValues=True` parameter. Maybe also the `noInterpolation=True` parameter.

Try deleting Event 0 and see if the chart shows all the events.

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [June 24, 2024, 5:35am UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/12 "2024-06-24T05:35:36Z")

</div>

Hi @drojas, thank you for your reply, Yes it appears the problem lies with Event 0.  
I am using a bind with tag history (as below)

 ![bind](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b14a95cb1ee99a2af3164e2a8099b179e947300a.png)

This brings back a dataset  
 ![bind2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/7171e7c1b5cd1dc9327fb0d18074aedbc8a0a313.png)

I then have the script transform you posted which I have altered the modes to fit mine,

 ![bind3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/c/7c4ce2b4a7cb125b589c6abe22c92f5db0ef9214.png)

This morning it is returning 3 events

 ![bind4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42f218dc77159b7050354c21607d16fdb5352a7f.png)

As you mentioned the start time of event 0 is after the end time, if I delete event 0 the graph shows the other 2 events correctly, however, for some reason it is not picking up the 4th event which should start with the end time of event 2 and the end time should be the current time.

If I make Prevent Interpolation true the dataset returns three events instead of 4. It does not return event 0 and even though the third event, Production, which is in the dataset, it does not display it.

Could I be right in that it isn't displaying because it does not have an end time?

If you have the time and notice anything It would be greatly appreciated.

Richard

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [June 24, 2024, 5:44am UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/13 "2024-06-24T05:44:46Z")

</div>

Hi @drojas,

Literally after I posted my reply, I noticed the start times of the tag history binding and the start time in the script where different 🤦

I changed the start time in the script to the same as the tag binding and the chart displayed the first 3 events correctly 🤣

However, I am still missing the current event Production, which is not displaying, it is currently still in Production so does not have an end time.

 ![bind5](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f47ee05fbb9737167348589730c980d4ec96fc19.png)

Richard

EDIT

It appears a weekend away from this has given me a much needed break 😆

I have discovered the two problems causing the issue, both to do with the start and end times.

Firstly in the post above I had two different start times, which I corrected.  
Secondly I had now(0) in as the end time, when this was changed to now() then all 4 events displayed.

My only concern now is that the latest event keeps overwriting every second meaning I am unable to make a selection on this event, sometimes the event disappears for a few seconds then reappears.

The purpose of this was to allow a popup to show the information for the event selected.

Thanks for taking the time to look at this for me.

Much appreciated

Richard

---

<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:** [June 24, 2024, 4:15pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/14 "2024-06-24T16:15:49Z")

</div>

@richard_hamilton, I use a page load script to set the start/end times to some custom properties which is passed on to the ribbon chart...I set the end time to `system.date.now()`. This prevents the constant refresh every second. You won't get true realtime display, but it keeps the ribbon chart fixed so you can interact with it. You could always add a refresh button if someone wants to quickly update the chart themselves with the latest time.

David Rojas

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [June 25, 2024, 6:00am UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/15 "2024-06-25T06:00:29Z")

</div>

@drojas David thanks for your help, I tried what you suggested but for me it still updates every second 😆  
I am also getting the most recent event dropping and disappearing every now and again, I obviously don't have the chart set up correctly somewhere 🤷‍♂️

---

<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:** [June 27, 2024, 3:16pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/16 "2024-06-27T15:16:39Z")

</div>

@richard_hamilton , what about the binding you had for the range start/end times used for the axis? Was that left as system.date.now()? When any of the bindings of the chart change, that causes a redraw of the chart. Screenshots help a lot...feel free to post what you have now.

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [July 1, 2024, 3:45pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/17 "2024-07-01T15:45:45Z")

</div>

@drojas , Sorry for late reply, was off for a few days. I am using a tag history binding so can't use system.date.now() int the end date box only now().

Using now() allows me to see the current step that the plant is in, if I use now(0) this prevents the current step from showing. However, if i try to view the events by expanding data.0.events it keeps closing after a second 😭 so, must be updating somewhere 🤣

Also, on startup I get the following,

Error running Template@D$0:1/root/XYChart.onMessageReceived(self, payload): Traceback (most recent call last): File "function:onMessageReceived", line 4, in onMessageReceived File "", line 7, in load AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'start'

I think I may not have it configured incorrectly, as when I launch the session the ribbon chart does not appear until I click where the chart should be.

Richard

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2024, 4:10pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/18 "2024-07-01T16:10:22Z")

</div>

The expression function `now()`, where the poll rate is omitted, defaults to `now(1000)`, so it retriggers your binding every 1000 milliseconds. Use `now(0)` to get just the one timestamp.

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [July 1, 2024, 4:28pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/19 "2024-07-01T16:28:56Z")

</div>

Hi @pturmel, If i use now(0) then the current step is omitted from the chart, if the plant has been on production for the previous 10 hours and I use now(0) the 10 hour production step does not display.

Richard

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2024, 4:33pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/20 "2024-07-01T16:33:24Z")

</div>

Well, choose. You can either have a static time span, or an updating timespan. 🤷‍♂️

When the timespan updates, the Ribbon ..... wait for it ..... _updates_.

---

<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:** [July 9, 2024, 2:14pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/21 "2024-07-09T14:14:48Z")

</div>

@richard_hamilton, did you get this figured out?

---

<div class="post-metadata">

**Author:** ![richard\_hamilton](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@richard\_hamilton](https://forum.inductiveautomation.com/u/richard_hamilton)\
**Post date:** [July 10, 2024, 12:58pm UTC](https://forum.inductiveautomation.com/t/ignition-exchange-ribbon-chart-issue/74855/22 "2024-07-10T12:58:31Z")

</div>

@drojas no not yet, I had to pause work on it for other projects that came up. I am going on holidays for the next 3 weeks and will be picking it back up on my return.

Richard
