Shading a region & repeat into past/future

Optuma Forums Optuma General Discussion Shading a region & repeat into past/future

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #59717
    AvatarJeffrey A.
    • Topics: 26
    • Replies: 34
    • Posts: 60

    Hello,

    Is there a tool or a way to code a show view that would highlight a time region on a chart (ex: June 15 – August 1st) and could repeat this shading into the same region in the future and/or past?

    Jeff

    #59743
    AvatarThomas
    • Topics: 88
    • Replies: 118
    • Posts: 206

    Hi Jeffrey,

    that is a really interesting question.

    Making your question a little bit easier: Is there a way to create a script that highlights/shades a specific time period e.g. 5/12/2020 to 8/17/2020?

    I understand that it is necessary to manually input the dates in the script but having a script would place the highlighted period exactly at the entered dates.

    Currently I use the “Date Region” tool to do the job. That works fine, but having a script would be better. In some way the script would look like the US recession periods using the recession file from the FRED to highlight US recessions but instead of having a file to highlight the specific time period it would be done with a script.

    A great additional feature would be to display the dates when the highlighted time period begins and when it ends.

    Thanks,
    Thomas

    1 user thanked author for this post.
    #59745
    AvatarJeffrey A.
    • Topics: 26
    • Replies: 34
    • Posts: 60

    Hi Thomas,

    Thank you for sharing how you use the “Date Region” tool; this is very handy actually. Everyday I am learning something new here! Amazing software.

    The idea of repeating a shaded region in the past for me would allow a simple way to visually confirm specific areas for seasonal strength or weakness in the annual cycle or perhaps a 4 year presidential cycle, etc.. and having ability to repeat in future would allow for a heads up.

    I see what you are saying about coding to define exact dates – perhaps there is a way to do this.

    Jeff

    #59799
    DarrenDarren
    • Topics: 62
    • Replies: 521
    • Posts: 583

    Hi Jeff,

    It’s a bit tricky but you can use the MONTHNUM() and DAYNUM() functions. There may be a more elegant way to do it, but the following in a Show View will highlight June 15th to the end of the month:

    You can then add a second Show View for July:

    Drag them both over the price chart and the June 15th – August 1st periods will be highlighted:Capture

    2 users thanked author for this post.
    #59807
    AvatarThomas
    • Topics: 88
    • Replies: 118
    • Posts: 206

    Hi Darren,

    a nice trick. I did not believe that it is possible.

    Adding the YEARNUM() function and you can shade any single period in the past.

    But interestingly the “shaded bars” have a fixed width. To cover/shade a periods of a few months you have to add a few Show View scripts to shade the whole period of a few months.

    On the other hand if you want shade a period that is smaller than the fixed width of the “shaded bar” this would not be possible.

    Is there a way to change the “shaded bars” fixed width. Unfortunately the function “Line Width” has no effect.

    Last but not least would it be possible to add in v1.7 a new tool that can shade a user specified time period by entering the beginning and ending period and the time between the two dates would be shaded?

    The new tool should be able to shade a specific time period as well as should be able to repeat the same time period each year to have the seasonality shading as Jeff has described and you have shown in your chart.

    Thanks a lot Darren,
    Thomas

    1 user thanked author for this post.
    #59817
    AvatarJeffrey A.
    • Topics: 26
    • Replies: 34
    • Posts: 60

    Thanks Darren – this is a handy to known how to do! Thank you for explaining.  The only thing, it does not project into the future, but I can use Date Region for future regions for now.

    Jeff

    #60793
    AvatarThomas
    • Topics: 88
    • Replies: 118
    • Posts: 206

    Hi,

    for those interested in shading a region on a chart, Darren has created a really very smart new script.

    Here is the link:

    Shading a Timer Period

    Thanks
    Thomas

    • This reply was modified 2 months, 2 weeks ago by AvatarThomas.
    1 user thanked author for this post.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close