How to plot a line with 2 colour

Forums ProRealTime English forum ProBuilder support How to plot a line with 2 colour

Viewing 4 posts - 1 through 4 (of 4 total)
  • #196922

    This is the code I made from Average Filter Regression in this library:

    It looks like the first screenshot. How can I make it look like the second screenshot: If Velo > 0 then the line is green, If Velo <= 0 then the line is red?

    Thank you

    #196929

    Hi..      I think this follows you description.

    The ‘if’ statement follows your logical criteria of ‘ Velo’ which set the value’s for ‘r’ and ‘g’. Then the addition of the ‘coloured’ modifier uses them to set the RGB colour of your ‘AFR’  line.

    Additional lines 16-22,   modified line 24.

     

    1 user thanked author for this post.
    #196939

    Thanks, It works. You are a legend.

    1 user thanked author for this post.
    #196982

    Thanks for you kind comment.

    I recall a saying – If it’s not broken don’t try and fix it!     Bare that in mind.

    Since I’m on a steep learning curve trying to get in to PRT and the coding side, I decided to analyse the code you posted as an exercise. If this is beyond or distracting to what your doing, feel free to ignore. Just sharing.

    The code here is just main code but the .itf file has a lot more comments in it, why I changed and/or added things.

    I’ve learned a lot doing this and wouldn’t have done it if it wasn’t for your post and well laid out request/spec.

    In analyzing I have, replaced/altered/created some variables with stock/new, replaced original ‘if’ block and added a value guard, error message and logic control  to the ‘K’ variable if invalid.

    Additionally, it made me figure out a couple of technique when checking that code changers give same outcome’s. These such as creating alternate, by a numbered index, variable’s to calculate a kind of before and after type scenario and by subtracting one from the other it should result in zero if there the same

    Also by having a indicator panel with original  and a new file with the original copied in it, as changes are made you can see if expected result are obtained. Also have a original in price window. A plan is better than no plan.

    Not possibly rocket science or ground breaking but, kept me focused on the task for a while. As always do your own testing.

    All the best.

     

     

Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login