# Subplots are not generating, Colors are hidden but generating randomly - V8.1.32

**URL:** <https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [November 11, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488 "2024-11-11T21:45:30Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/1 "2024-11-11T21:45:30Z")

</div>

Hi Everyone,  
I’ve written a script to load some tag pens onto an Easy Chart. I want subplots to be generated based on the available unit of measures. While the axes are being generated correctly from the unit of measures, the subplots are being ignored. Can anyone explain why this is happening? When I use the Easy Chart Customizer, all my tags are placed on subplot 1, even though I’m passing in a dataset that defines the subplot column.

I left the color column empty for all tag pens and selected auto colors on the Easy Chart. Visually, the Easy Chart displays tag pens with different colors. However, when I open the Easy Chart Customizer, all the colors appear the same, making it difficult to identify which colors belong to which tag pens. Can anyone help explain this?

```python
tagPenHeader = ["Parent_Window", "Name", "Current_Value","Tag_Path","Sub_Plot","Axis","Enabled","Hidden","Color","Group_Name",
				"Dash_Pattern","Render_Style","Line_Weight", "Shape", "Fill_Shape","Aggregation_Mode","Labels","Digital", "Override_Autocolor",
				"User_Selectable","Sort_Order", "User_Removable","UOM"]

axisHeader = ["Name","Label","Type","Label_Color","Tick_Label_Color", "Tick_Mark_Color","Position","Invert","Auto_Range","Auto_Range_Incl_Zero","Auto_Range_Margin",
				"Lower_Bound","Upper_Bound","Auto_Tick_Units","Tick_Unit", "Grid_Unit","Number_Format", "Log_Label_Style","Symbol_String", "Grid_Bands_Visible", 
				"Grid_Band_Color","Grid_Band_Alternate_Color"]				

subplotHeader = ["Weight","Override_Background","Override_Background_Color"]
				

dataset = event.source.parent.parent.getComponent('ExpandedViewGroup').getComponent('Table').data
tableDataset = system.dataset.toPyDataSet(dataset)

easyChartList = []
axisList = []
subplotList = []

#Easy Chart constants

enabled = True
hidden = False
color = None
groupName = ""
dashPattern = ""
renderStyle = 4
lineWeight = 1
shape = ""
fillShape = 1
aggregationMode = "MinMax"
labels = True
digital = False
overrideAutoColor = False
userSelectable = False
sortOrder = ""
userRemovable = False

#Axis Constants
axisType = "Numeric"
labelColor = None
tickLabelColor = None
tickMarkColor = None
position = None
invert = True
autoRange = True
autoRangeWithZero = False
autoRangeMargin = .05
lowerBound = None
upperBound = None
autoTickUnits = True
tickUnit = None
gridUnit = None
numberFormat = None
labelStyle = None
symbolString = None
gridBandsVisible = None
gridBandColor = None
gridBandAltColor = None

#Subplot Constants
weight = 1
overrideColor = None
overrideBackground = False

#first find all unit of measures
def unitOfMeasures(dataset):
	uomList = []
	for row in dataset:
		uom = row["UOM"]
		uomList.append(uom)
	return uomList
	
uomList = list(set(item.upper() for item in unitOfMeasures(tableDataset))) #Remove duplicates, and ignore case

def createAxis(numberOfAxis, uomList):
	for item in range(len(uomList)):
		name = numberOfAxis[item+1]
		uomLabel = uomList[item]
		temp = [name,uomLabel,axisType,labelColor,tickLabelColor, tickMarkColor,position,invert,autoRange,autoRangeWithZero,autoRangeMargin,
						lowerBound,upperBound,autoTickUnits,tickUnit, gridUnit,numberFormat, labelStyle,symbolString, gridBandsVisible, 
						gridBandColor,gridBandAltColor]
		axisList.append(temp)
	return axisList
	
def createSubplots(numberOfSubplots, uomList):
	for item in range(len(uomList)):
		name = numberOfSubplots[item+1]
		uomLabel = uomList[item]
		temp = [weight,overrideBackground, overrideColor]
		subplotList.append(temp)
	return subplotList

#Number of Axis and subplots
numberOfAxis = list(range(len(uomList)+1))
numberOfSubplots = list(range(len(uomList)+1))

axisList = createAxis(numberOfAxis, uomList)
axisData = system.dataset.toDataSet(axisHeader, axisList)

subplotList = createSubplots(numberOfSubplots, uomList)
subplotData = system.dataset.toDataSet(subplotHeader, subplotList)

for index,uomValue in enumerate(uomList):
	axis = numberOfAxis[index]+1
	subplot = numberOfSubplots[index]+1
	for rows in tableDataset:
		uom = rows["UOM"]
		uom = uom.upper()
		parentWindow = rows["Parent Window"]
		tagPath = rows["Tag Path"]
		deviceLabel = rows["Device Label"]
		print uom
		print uomValue
		if uom == uomValue:
			temp = [parentWindow, deviceLabel, 0.0,tagPath,subplot,axis,enabled,hidden,color,groupName,
							dashPattern,renderStyle,lineWeight, shape, fillShape,aggregationMode,labels,digital, overrideAutoColor,
							userSelectable,sortOrder, userRemovable,uom]
			print len(temp)
			easyChartList.append(temp)

easyChartData = system.dataset.toDataSet(tagPenHeader,easyChartList)

window = system.nav.openWindow('Trending/Quick Chart', {"allTagPens": easyChartData, "axisData":axisData, "subplotData":subplotData})
#system.nav.closeParentWindow(event)

```

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

---

<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:** [November 11, 2024, 10:07pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/2 "2024-11-11T22:07:31Z")

</div>

Did you define subplots in the customizer? Only defined subplot numbers are honored. (You can also generate the subplots config dataset dynamically.)

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:11pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/3 "2024-11-11T22:11:39Z")

</div>

Hi Phil, I want all this stuff to be dynamic. I am defining the subplots when I pass in the tag pen Dataset.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/d/dd7dba624b36f53dfe2bcf87cf7cd2c8f51700e6.png)

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

The subplots have a binding that points to my root container custom properties.

---

<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:** [November 11, 2024, 10:15pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/4 "2024-11-11T22:15:12Z")

</div>

That doesn't exactly answer my question. Do the subplot numbers in the pens exist in the subplots dataset?

(Show them to us, perhaps?)

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:16pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/5 "2024-11-11T22:16:52Z")

</div>

Sorry about that. Yes, the tag pen dataset looks correct:

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

In the easy chart customizer, the tag pens do not match this dataset.

---

<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:** [November 11, 2024, 10:21pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/6 "2024-11-11T22:21:11Z")

</div>

And what's in the subplots dataset?

Consider making your bindings to your root container datasets bidirectional, so changes from the customizers will propagate and can be easily transferred to whatever calls this window.

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:23pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/7 "2024-11-11T22:23:04Z")

</div>

I used the columns it had by default. Here is a snippet of the dataset, and what the subplots look like in the easy chart customizer:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fc8d65e7b5825b11a520d7c6e48e51d2bbb4cc1.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/c/cca52b1941d1679b962f02c565b81f601411507d.png)

---

<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:** [November 11, 2024, 10:28pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/8 "2024-11-11T22:28:47Z")

</div>

Are you sure the tag pens dataset is showing an integer column type for the subplot column?

(When dynamically creating datasets for the chart components, it is usually wise to explicitly set the right column types with the `DatasetBuilder` instead of `system.dataset.toDataSet()`.)

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:30pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/9 "2024-11-11T22:30:01Z")

</div>

Yes, I am truly baffled.

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

---

<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:** [November 11, 2024, 10:31pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/10 "2024-11-11T22:31:59Z")

</div>

Copy your datasets to the clipboard and paste that text here, formatted as code. (The Preformatted text button in the comment editor.)

A simple example of tag pens:

```python
"#NAMES"
"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"
"#TYPES"
"str","str","str","str","I","B","clr","str","I","F","I","B","B","str","B","B","B","B","I","B"
"#ROWS","2"
"CPU","[Forum12main/superm81x:system]gateway/performance/cpu usage","MinMax","Default Axis","1","true","color(85,85,255,255)","","1","1.0","0","true","false","","false","false","false","true",,"false"
"Mem","[Forum12main/superm81x:system]gateway/performance/memory utilization","MinMax","Default Axis","2","true","color(85,255,85,255)","","1","1.0","0","true","false","","false","false","false","true",,"false"

```

and corresponding subplots:

```python
"#NAMES"
"WEIGHT","OVERRIDE_BACKGROUND","OVERRIDE_BACKGROUND_COLOR"
"#TYPES"
"I","B","clr"
"#ROWS","2"
"1","false","color(255,255,255,255)"
"1","false","color(255,255,255,255)"

```

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:34pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/11 "2024-11-11T22:34:07Z")

</div>

Tag Pen Dataset

```python
"#NAMES"
"Parent_Window","Name","Current_Value","Tag_Path","Sub_Plot","Axis","Enabled","Hidden","Color","Group_Name","Dash_Pattern","Render_Style","Line_Weight","Shape","Fill_Shape","Aggregation_Mode","Labels","Digital","Override_Autocolor","User_Selectable","Sort_Order","User_Removable","UOM"
"#TYPES"
"str","str","D","str","I","I","B","B","str","str","str","I","I","str","I","str","B","B","B","B","str","B","str"
"#ROWS","12"
"Blender Graphics","FT103082 GPM","0.0","[IgnitionHistorical]Instruments/BS103/FT103082/VolumeFlowrate","1","1","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","GPM"
"Blender Graphics","FT103059 GPM","0.0","[IgnitionHistorical]Instruments/BS103/FT103059/VolumeFlowrate","1","1","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","GPM"
"Blender Graphics","FT103099 GPM","0.0","[IgnitionHistorical]Instruments/BS103/FT103099/VolumeFlowrate","1","1","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","GPM"
"Blender Graphics","FT103437 GPM","0.0","[IgnitionHistorical]Instruments/BS103/FT103437/VolumeFlowrate","1","1","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","GPM"
"CIP 1 Graphics","FT501003 gpm","0.0","[IgnitionHistorical]Instruments/CIP1/FT501003/Reading","1","1","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","GPM"
"CIP 1 Graphics","CT501008 mS","0.0","[IgnitionHistorical]Instruments/CIP1/CT501008/Reading","2","2","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","MS"
"CIP 1 Graphics","PT501002 psi","0.0","[IgnitionHistorical]Instruments/CIP1/PT501002/Reading","3","3","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","PSI"
"Blender Graphics","PU103430 Hz","0.0","[IgnitionHistorical]Devices/BS103/PU103430/VFD/ActualSpeed","4","4","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","HZ"
"Blender Graphics","TT103557 °F","0.0","[IgnitionHistorical]Instruments/BS103/TT103557/Reading","5","5","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","°F"
"Blender Graphics","FT103059 °F","0.0","[IgnitionHistorical]Instruments/BS103/FT103059/Temperature","5","5","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","°F"
"Blender Graphics","FT103099 °F","0.0","[IgnitionHistorical]Instruments/BS103/FT103099/Temperature","5","5","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","°F"
"CIP 1 Graphics","TT501004 °F","0.0","[IgnitionHistorical]Instruments/CIP1/TT501004/Reading","5","5","true","false",,"","","4","1","","1","MinMax","true","false","false","false","","false","°F"

```

Axis Dataset

```python
"#NAMES"
"Name","Label","Type","Label_Color","Tick_Label_Color","Tick_Mark_Color","Position","Invert","Auto_Range","Auto_Range_Incl_Zero","Auto_Range_Margin","Lower_Bound","Upper_Bound","Auto_Tick_Units","Tick_Unit","Grid_Unit","Number_Format","Log_Label_Style","Symbol_String","Grid_Bands_Visible","Grid_Band_Color","Grid_Band_Alternate_Color"
"#TYPES"
"I","str","str","str","str","str","str","B","B","B","D","str","str","B","str","str","str","str","str","str","str","str"
"#ROWS","5"
"1","GPM","Numeric",,,,,"true","true","false","0.05",,,"true",,,,,,,,
"2","MS","Numeric",,,,,"true","true","false","0.05",,,"true",,,,,,,,
"3","PSI","Numeric",,,,,"true","true","false","0.05",,,"true",,,,,,,,
"4","HZ","Numeric",,,,,"true","true","false","0.05",,,"true",,,,,,,,
"5","°F","Numeric",,,,,"true","true","false","0.05",,,"true",,,,,,,,

```

SubPlots Dataset:

```python
"#NAMES"
"Weight","Override_Background","Override_Background_Color"
"#TYPES"
"I","B","str"
"#ROWS","5"
"1","false",
"1","false",
"1","false",
"1","false",
"1","false",

```

---

<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:** [November 11, 2024, 10:36pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/12 "2024-11-11T22:36:12Z")

</div>

Your subplots dataset is supplying a string column where the component expects a java color column.

In your tag pens dataset, your subplot column name has an underscore.

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:37pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/13 "2024-11-11T22:37:20Z")

</div>

I am going to give these edits a try. One moment please.

---

<div class="post-metadata">

**Author:** ![Noah\_St\_Mark](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Noah\_St\_Mark](https://forum.inductiveautomation.com/u/Noah_St_Mark)\
**Post date:** [November 11, 2024, 10:53pm UTC](https://forum.inductiveautomation.com/t/subplots-are-not-generating-colors-are-hidden-but-generating-randomly-v8-1-32/98488/14 "2024-11-11T22:53:18Z")

</div>

The component let me delete the override Color and override background columns. The new dataset looks like this:

```python
"#NAMES"
"Weight"
"#TYPES"
"I"
"#ROWS","5"
"1"
"1"
"1"
"1"
"1"

```

I updated the column name to "SubPlot". It is working now. Thank you Phil!
