Show or Hide Clouds

Daedalus77

Daedalus77

New member
Does anyone know if there is a way to give users the option to selectively hide or reveal clouds generated with the AddCloud function?
 
T

tomsk

Well-known member
VIP
The easiest way to do so is to add an input selector which adds as a toggle switch to either display clouds or not. Here is an example code that displays cloud between two dates, run this on a daily aggregation. To turn the cloud off, go into the user interface and set the input selector to the variable "showCloud" to no.

Code:
# Displays cloud between two dates 

declare hide_on_intraday;

input showCloud = yes;

input Day1 = 20191103;
input Day2 = 20191208;

plot cond1 = if GetYYYYMMDD() >= Day1 and GetYYYYMMDD() <= Day2 then double.positive_infinity else double.nan;
plot cond2 = if GetYYYYMMDD() <= Day2 and GetYYYYMMDD() >= Day1 then double.negative_infinity else double.nan;

AddCloud(if showCloud then cond1 else Double.NaN, cond2, color.red, color.red);
 

Similar threads

Top