# Easy Chart configChart flashing?

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [December 3, 2024, 2:36am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345 "2024-12-03T02:36:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [December 3, 2024, 2:36am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/1 "2024-12-03T02:36:49Z")

</div>

```python
def configureChart(self, chart):
	# Put your code here
	self.startDate = self.parent.startDT
	self.endDate = self.parent.endDT
	
	headers = ["NAME","TAG_PATH","AGGREGATION_MODE","AXIS","SUBPLOT","ENABLED","COLOR","DASH_PATTERN","RENDER_STYLE","LINE_WEIGHT","SHAPE","FILL_SHAPE","LABELS","GROUP_NAME","DIGITAL","OVERRIDE_AUTOCOLOR","HIDDEN","USER_SELECTABLE","SORT_ORDER","USER_REMOVABLE"]
	data = []
	
	data.append(["LIT0101","[default]Item1/Sensors/LIT0101/SensorStatus/value","MinMax","cm","1","true","color(255,85,85,255)","","1","1.0","0","true","false","","false","false","false","true",3,"true"])
	data.append(["LIT0201","[default]Item1/Sensors/LIT0201/SensorStatus/value","MinMax","cm","1","true","color(85,85,255,255)","","1","1.0","0","true","false","","false","false","false","true",2,"true"])
	data.append(["LIT0202","[default]Item1/Sensors/LIT0202/SensorStatus/value","MinMax","cm","1","true","color(85,255,85,255)","","1","1.0","0","true","false","","false","false","false","true",1,"true"])
	dataset = system.dataset.toDataSet(headers, data)
	
	self.tagPens = dataset

```

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

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

When this chart show, it always flashing?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 3, 2024, 3:24am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/2 "2024-12-03T03:24:02Z")

</div>

I don't believe I would do any of that in configureChart. The dataset, once saved in the designer shouldn't need to be recreated, but if it needed to be scripted at initialization for some reason, the easy chart's propertyChange event handler would be where I would put it. The code would look something like this:

```python
# Run only once at initialization
# componentRunning only works in the designer if preview mode is on before the window is opened
if event.propertyName == 'componentRunning' and event.newValue:

	# Get the tag pen headers
	headers = list(system.dataset.getColumnHeaders(event.source.tagPens))
	
	# Get the tag pen parameter information in some way and assemble it into a list of lists
	data = [
		["LIT0101","[default]Item1/Sensors/LIT0101/SensorStatus/value","MinMax","cm","1","true","color(255,85,85,255)","","1","1.0","0","true","false","","false","false","false","true",3,"true"],
		["LIT0201","[default]Item1/Sensors/LIT0201/SensorStatus/value","MinMax","cm","1","true","color(85,85,255,255)","","1","1.0","0","true","false","","false","false","false","true",2,"true"],
		["LIT0202","[default]Item1/Sensors/LIT0202/SensorStatus/value","MinMax","cm","1","true","color(85,255,85,255)","","1","1.0","0","true","false","","false","false","false","true",1,"true"]]
	
	# Compile the data into a dataset and assign it to the tag pens property
	event.source.tagPens = system.dataset.toDataSet(headers, data)

```

As for the dynamic start and end parameters, I would move this script out of configureChart and onto the parent container's `propertyChange` event handler:

```python
# Validate the events, so this script only runs when the start and end date properties change
if event.propertyName in ['startDT', 'endDT']:

	# Get the current start and end dates
	startDate = event.source.startDT
	endDate = event.source.endDT
	
	# Validate the start and end dates in some way before assigning them to the chart parameters
	if endDate and startDate and endDate > startDate:
		easyChart = event.source.parent.getComponent('Easy Chart')
		easyChart.startDate = startDate
		easyChart.endDate = endDate

```

---

<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:** [December 3, 2024, 1:27pm UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/3 "2024-12-03T13:27:12Z")

</div>

The `configureChart` method is called when the component has gathered and analyzed all of the pen data and base configuration data to plot. It gives you a chance to tweak the _ **presentation** _. Assignment to chart properties makes the component re-analyze everything, and call `configureChart` _again_.

Don't assign to component properties in `configureChart`. Ever.

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [December 5, 2024, 7:15am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/4 "2024-12-05T07:15:57Z")

</div>

> [@pturmel](#):
>
> Don't assign to component properties in `configureChart`. Ever.

I set the tagPens in propertyChange Script.

 ![69f877a94cd8f1e8f9cbc93275c0fb5](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/3/53dbd98e893da54f43d313dd3e0e0350a7dab313.png)

I set DT in configChart Script.

 ![0984e98a6e4d1b9608c70892226b62a](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5a954110296af2e6edd8953373864c6460757b26.png)

Maybe it's right now!

---

<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:** [December 5, 2024, 1:45pm UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/5 "2024-12-05T13:45:45Z")

</div>

No! Resetting the start/end in configureChart causes configureChart to run again.

> [@pturmel](#):
>
> Don't assign to component properties in `configureChart`.

🤷‍♂️

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 5, 2024, 6:05pm UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/6 "2024-12-05T18:05:20Z")

</div>

Use the parent container's property change event handler to set the start and end dates whenever the custom properties change. I assume the custom properties have some type of binding? See [my example](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/2).

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [December 6, 2024, 2:26am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/7 "2024-12-06T02:26:50Z")

</div>

![07d11214b1aff2dd4bdfc2b3b25ba92](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/c/1cb93e0a60a1e6e05663927baa04f76ec9f7f550.png)

```python
if event.propertyName in ['startDT', 'endDT']:

```

There's nothing you said in the propertyName startDT endDT...  
There is startDate or endDate .

 ![e3f926117e144f6c11cd886e6546337](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/c/fc4dbc7f1b0fe6f456662d3830cad924ebdaf23b.png)

 ![a7a3a834b6944995c93f32ad3346177](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/eff1eb89c664cc6e4e997e1ec83ffae8fb0d7bf2.png)

In this case startDate , change two times.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2024, 4:00am UTC](https://forum.inductiveautomation.com/t/easy-chart-configchart-flashing/99345/8 "2024-12-06T04:00:59Z")

</div>

> [@taohongyu88](#):
>
> There's nothing you said

That's because you're displaying the property change events of the easy chart itself and not the property change events of the easy chart's parent where your custom properties are.

> [@justinedwards.jle](#):
>
> Use the **parent container's** property change event handler t

> [@justinedwards.jle](#):
>
> , I would move this script out of configureChart and onto the **parent container's** `propertyChange` event handler
