# \[FEATURE\] Perspective Power Chart - Make x-trace box more intuitive

**URL:** <https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 20, 2023, 10:53pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345 "2023-03-20T22:53:49Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 20, 2023, 10:53pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/1 "2023-03-20T22:53:49Z")

</div>

It's been a while since I made a fuss about the Power Chart in Perspective, but my frustrations with it are well and truly all still there..

> [@\[FEATURE\] Increase usability of the Perspective Power Chart component](https://forum.inductiveautomation.com/t/feature-increase-usability-of-the-perspective-power-chart-component/51474):
>
> 8.1.5 Putting it bluntly, the Perspective trend tool has a lot of work left to be done to it in order for it to be a useful tool. In its current state, it's very difficult to use. To me, the ability to easily view and diagnose issues from a trend is a cornerstone of any SCADA application. EDIT: Demos from another SCADA: The main things are: Edit: 0) IMO, these are the 2 biggest issues currently with the Power Chart: [[FEATURE] Increase usability of the Perspective Power Chart component - #55…](https://forum.inductiveautomation.com/t/feature-increase-usability-of-the-perspective-power-chart-component/51474/55)

Another one to add to the list:  
The x-trace box is not very intuitive or user-friendly. When you have a lot of pens, it's difficult to identify which pen is which without a link of the label/value to the pen trace. In other platforms, there are either separate boxes with a line that extends to the pen trace, or the label/value font colour matches the pen trace. Adding a coloured box beside each label would work as well. I know I can look at the legend, but having to have to always look at the legend, the x-trace box, and the chart just to decipher the chart is exhausting. This should be the easy part, leaving all mental capacity to analyse the charts instead of having to use it up trying to read it.

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

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [March 21, 2023, 3:32am UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/2 "2023-03-21T03:32:53Z")

</div>

I've had the same exact complaint from some of our operators.

My solution was to use CSS to color the pens names the same as the actual color of the pen. Haven't heard a complaint since.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/d/2d16c489baace3094920881973f62c89875353b8.png)

I can post the css tomorrow if you're interested

Edit: Actually... I don't use the power chart. So my css may or may not apply here 🤔

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 21, 2023, 5:58am UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/3 "2023-03-21T05:58:36Z")

</div>

That looks a tonne better than it looks by default! I'll be very interested to see how you did it, and see if I can apply it to the Power Chart as well.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 21, 2023, 10:39am UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/4 "2023-03-21T10:39:05Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/788d4372a35475fbbf3f86718797e6e9c43adec0.png)  
you cant rly know which colors the pen have... but if they have a fixed order and color this could work

(you have to start with 2)

```auto
.ia_timeMarker g g g:nth-child(2) .ia_powerChartComponent __xTrace__ box__label tspan{
    fill: red;
}

.ia_timeMarker g g g:nth-child(3) .ia_powerChartComponent __xTrace__ box__label tspan{
    fill: blue;
}

```

or you could also give the pens a fixed color through stylign to match i guess

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/3/03422e7a2688b338d0604b7ac9ca8f1c1e031082.png)  
(here you do start from 1)

```auto
.chart-row.ia_chartRow .ia_lineChart:nth-of-type(1) path {
    stroke:red !important
}
.chart-row.ia_chartRow .ia_lineChart:nth-of-type(2) path {
    stroke:blue !important
}

.flexBodyInnerScrollContainer .ia_table __body__ row:nth-of-type(1) .pen-visibility-checkbox{
    fill:red !important
}

.flexBodyInnerScrollContainer .ia_table __body__ row:nth-of-type(2) .pen-visibility-checkbox{
    fill:blue !important
}

```

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [March 21, 2023, 3:04pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/5 "2023-03-21T15:04:10Z")

</div>

Looks like @victordcq beat me to it!

Here's how I'm doing it on a TimeSeriesChart:

Just like Victors, you need to change the `N` to a number starting with 2.

```auto
.psc-TrendXTraceStyle_default_grouped .ia_timeMarker > g > g > g > g:nth-child(N) > text:nth-child(1) {fill: #0000D9 !important}
.psc-TrendXTraceStyle_default_split .ia_chartContainer > g:nth-child(3) > g > g:nth-child(2) > g > g:nth-last-child(1) > g > g > g > g > g:nth-child(N) > text:nth-child(1) {fill: #0000D9 !important}

```

^---- I'm also sure those css rules could be cleaned up. I suck at CSS.

For having them dynamic per user, I give operators the ability to change their colors but tell them they need to **wait a short period of time** then logout / log in for them to take effect.

To accomplish this I have a value change script on a dataset tag we have to hold user colors that updates a file in our themes folder:

Dataset has 2 columns: UserName and Colors (json encoded string containing a list of colors)

Tag value change script:

```auto
logger = system.util.getLogger('Tag_User_NonDefaultTrendColors')
	
# File params
folderPath = r'\\servername\c$\Program Files\Inductive Automation\Ignition\data\modules\com.inductiveautomation.perspective\themes\light-custom\common'
fileName = 'time-series-chart-dynamic-xtrace.css'
filePath = '{}\{}'.format(folderPath, fileName)
	
# Default colors
defaultColors = ["#0000D9","#D900D9","#00D9D9","#00D900","#D9D900","#D97700","#D90000","#B45BFF"]
	
try:
	if previousValue and currentValue:
		pV = dict(system.dataset.toPyDataSet(previousValue.value))
		cV = dict(system.dataset.toPyDataSet(currentValue.value))
		
		# if our dictionaries are different, update our file
		if pV != cV:				
			# Convert color string back to it's list counterpart
			for key, value in cV.iteritems():
				cV[key] = system.util.jsonDecode(value)
			
			# Add Default value to our dictionary
			cV['default'] = defaultColors
			
			# Build our style classes (split and grouped trends) for each user & the default
			styles = []
			for style in cV:
				for idx, color in enumerate(cV[style]):
					styles.append((".psc-TrendXTraceStyle_%s_grouped .ia_timeMarker > g > g > g > g:nth-child(%s) > text:nth-child(1) {fill: %s !important}" % (style, idx+2, color)))
				
				for idx, color in enumerate(cV[style]):
					styles.append(".psc-TrendXTraceStyle_%s_split .ia_chartContainer > g:nth-child(3) > g > g:nth-child(%s) > g > g:nth-last-child(1) > g > g > g > g > g:nth-child(2) > text:nth-child(1) {fill: %s !important}" % (style, idx+2, color))
			styles = '\n'.join(styles)
			
			# Write to our file / overwriting existing changes
			system.file.writeFile(filePath, styles, False)
			
			logger.info("{} successfully updated".format(fileName))
except:
	logger.info("There was an error updating file")

```

The code writes css rules for all users in my dataset tag, as well as the rules for the default colors.

I then have a binding on `style.classes` for my TimeSeriesChart that adds the required style class in. Default or the users style for grouped / split charts.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 21, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/6 "2023-03-21T15:18:28Z")

</div>

updating the file.css actually gets picked up fast enough for it to load in? hehe thats neat to know.  
i tried modifing some views before but it only gets loaded in after like 5 minutes

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [March 21, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/7 "2023-03-21T15:20:03Z")

</div>

Yeah i believe the css files are pulled in when a user logs in, but don't quote me on that.

~~All i know is that when i log out and back in after changing my colors it works. haha~~

I was wrong. Takes a short period of time to take effect.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 21, 2023, 3:28pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/8 "2023-03-21T15:28:29Z")

</div>

if you treat it like a theme you might be able to get away with not having to log in. as a theme change does try to look for css files... but idk if the gateway will pick them up or if you will need to wait those 5 minutes

edit: heh it might work fast enough its not instant, but if you put in a tiny delay its probably faster than relogging (10 sec seems to be enough, 5 not)

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [March 21, 2023, 4:00pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/9 "2023-03-21T16:00:46Z")

</div>

you're right. I apparently was misremembering 🤔

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 22, 2023, 7:36am UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/10 "2023-03-22T07:36:11Z")

</div>

no you'll need a relog if you didnt change the theme/ themes filename

---

<div class="post-metadata">

**Author:** ![ziad](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ziad/32/6841_2.png) [@ziad](https://forum.inductiveautomation.com/u/ziad)\
**Post date:** [March 26, 2023, 7:54pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/11 "2023-03-26T19:54:45Z")

</div>

Looks great. How did you get the seconds in the date/time? I've been digging in the CSS to find that for power chart. Though I see you mention that this isn't a power chart. @nminchin, do you have this problem also? The default x-trace only shows down to minutes.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 26, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/12 "2023-03-26T20:12:52Z")

</div>

> [@ziad](#):
>
> do you have this problem also? The default x-trace only shows down to minutes.

Yes, it's another issue Ive mentioned already to IA

---

<div class="post-metadata">

**Author:** ![Gregory\_Pierce](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Gregory\_Pierce](https://forum.inductiveautomation.com/u/Gregory_Pierce)\
**Post date:** [October 10, 2025, 9:20pm UTC](https://forum.inductiveautomation.com/t/feature-perspective-power-chart-make-x-trace-box-more-intuitive/71345/13 "2025-10-10T21:20:01Z")

</div>

I’ve got to ask, how is this not a standard thing yet? It makes it incredibly difficult for our users to identify the value they’re looking at when the X trace text is all one color. We should be able to pull from the pen color to display in the X trace. Please…..
