# Change Color of Overlayed Signals in Capsule Time View Based on Conditions

## Recommended Posts

• Seeq Team

Is there a way to change the color of my signals overlaid in capsule time view to highlight the different capsules?

Solution:

One approach to changing the color of the signal being overlaid in capsule time view is to create separate signals for each desired display color that only contain samples during specific capsule(s). The examples below provide a step-wise approach to coloring based on either logic or time.

Logic Based Coloring:

Scenario: We start out with a temperature signal that we are overlaying based on a daily condition. We want the temperature signal to show up in red if the daily average temperature is greater than 80F, and blue if the daily average temperature is below 80F.

1. Switch back to calendar view and calculate the Average Daily Temperature using the Signal from Condition tool. In this example, we choose the "duration" time stamp to simplify subsequent steps.

2. Use the Value Search tool to identify days in which the Average Daily Temp signal is greater than 80F.

3. Repeat step 2 to find the days where the average daily temperature was below 80F.

4. Use Formula to break the original temperature signal into two pieces, one when daily average temperature is above 80F,

and one when then daily average temperature is below 80F.

The formula code to complete step 4 is:

```//take the temperature signal and keep only samples within the Avg Daily Temp < 80F condition
\$temp.within(\$DailyAvgLow)```

5. Finally, switch back to capsule time view, and use dimming to display only your new "Temp signal during High Avg Daily Temp" and "Temp signal during Low Avg Daily Temp" signals. Use the "One Lane" and "One Y-axis" buttons to display in a single lane on the same axis.

Time Based Coloring:

Scenario: We have a temperature signal and we want to overlay data from the last 4 weeks in different colors so we can easily see changes in the signal from week to week.

1. Use Formula to create a condition for the past 7 days.

```//Create a condition with max capsule duration 8d, comprised of a single capsule that begins at now-7d and ends at the current time.
condition(8d,capsule(now()-7d,now()))```

2. Use Capsule Adjustments in Formula (move() function) to create a capsule for 2 weeks prior.

```//Shift the capsule for last week back in time by 7d.
\$lastWeekCapsule.move(-7d)```

3. Repeat step 2, shifting by -14d and -21d to create capsules for 3 weeks prior and 4 weeks prior.

4. Use Formula to break the original temperature signal into 4 pieces, one for each of the previous 4 weeks.

```//Create a new signal from the original temp signal that contains only samples that fall within the prior 7d.
\$temp.within(\$lastWeek)```

5. Switch to capsule time view, and put all the new temperature signals on one lane and 1 y-axis.

• 2
• 1
##### Share on other sites

• 9 months later...

In versions R22.0.48.00 and later users now have coloring options available to them in capsule time.  This simplifies the first section of this solution where coloring by condition.  For more information on the new capabilities visit our Knowledge Base

## Create an account

Register a new account