Jump to content

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

Recommended Posts

Frequently Asked Question:

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


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

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. 


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. 


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.


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


  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...