# Trend color issue

**URL:** <https://forum.inductiveautomation.com/t/trend-color-issue/108943>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting\
**Created:** [July 25, 2025, 7:45am UTC](https://forum.inductiveautomation.com/t/trend-color-issue/108943 "2025-07-25T07:45:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gauravavhad.1989](https://avatars.discourse-cdn.com/v4/letter/g/e5b9ba/32.png) [@gauravavhad.1989](https://forum.inductiveautomation.com/u/gauravavhad.1989)\
**Post date:** [July 25, 2025, 7:45am UTC](https://forum.inductiveautomation.com/t/trend-color-issue/108943/1 "2025-07-25T07:45:50Z")

</div>

```python
def runAction(self, event):
	end = self.getSibling("DateTimeInput_0").props.value
	start = self.getSibling("DateTimeInput").props.value
	ds = system.tag.queryTagHistory(
		paths=['[CPMS_TRIAL1/ignition-desktop-eeasmk4:cpms_trial]1_mfm_1-1_mfm_40/1_mfm_7'],
		startDate=start,
		endDate=end,
		returnSize=200,
	)
	if len(self.getSibling("TimeSeriesChart").props.series) == 0:
		self.getSibling("TimeSeriesChart").props.series.append({
			"name": "",
			"data": [],
			"style": {},
			"render": "line"
		})

	# Get the actual tag name from the dataset
	columnNames = ds.getColumnNames()
	if len(columnNames) < 2:
		system.perspective.print("Unexpected dataset structure: " + str(columnNames))
		return
	tagColumn = columnNames[1].strip()
	system.perspective.print(tagColumn)# index 0 is usually 'timestamp'
	self.getSibling("TimeSeriesChart").props.autoGenerateSeriesStyles = False
	series = self.getSibling("TimeSeriesChart").props.series[0]
	series.data = ds
	series.name = tagColumn
	series.render = "line"
	series.style = {"stroke": "#00ff00"}
	self.getSibling("TimeSeriesChart").props.plots[0].trends = [
		{
			"data": tagColumn,
			"visible": True,
			"color": "#00ff00",
			"lineStyle": "solid",
			"lineWidth": 2
		}
	]

```

I am using this script to show trend.  
I have defined green color for both series and plot in script, but the trend is shown in reddish color  
Why?

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [July 25, 2025, 2:23pm UTC](https://forum.inductiveautomation.com/t/trend-color-issue/108943/2 "2025-07-25T14:23:41Z")

</div>

You aren't populating the trend properly. `data` exists under `series` and `color` exists under trend `columns`:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/771047955cfd1ab9939697011db2c46740d1c722.png)

EDIT: Oh now I see you do have the data in the right place, but the "data" in the trend at the end should be "series", and the color/style needs to go under `columns`:

```python
self.getSibling("TimeSeriesChart").props.plots[0].trends = [
		{
			"series": tagColumn,
			"visible": True,
			"columns": [
						"key": " ____"
						"color": "#00ff00"
			]
		}

```
