Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic assignment / update of Plot properties

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamic assignment / update of Plot properties

    Support,

    Can you confirm this is not possible. I tried to assign the color of a plot using a string that I could change in the code and I got some system errors.

    Question #1

    In state set defaults I assigned the brush color to the string variable.

    BrushColor_1 = "Brushes.DimGray";

    In the plot code, I attempted to substitute the string but got errors... Is this just not possible?

    AddPlot(new Stroke (BrushColor_1, DashStyleHelper.Solid, 1,Opacity_03), PlotStyle.Line, Level_00_Label );

    Question #2

    It appears that once the plot names get assigned and the indicator is loaded, the only way to change the plot names displayed is to use the "reset template" option in the indicator dialog.

    Is there a way to do this using a bool option in the indicator and have the plot labels change based on the bool selected. I tried putting a set of strings in the State.configure code block thinking it would dynamically change the plot labels, but no luck.

    else if (State == State.Configure)
    {
    if (usePlotLabelOption2)
    {PlotString_01 = "testing label change";}​
    }​


    AddPlot(new Stroke (Brushes.Lime, DashStyleHelper.Solid, 1,Opacity_03), PlotStyle.Line, PlotString_01 );



    Any other options to have these plot names dynamically change without getting into the code and then resetting the template?

    Thanks

    #2
    Hello MattD888,

    A string is not the same as a Brush, that cannot be used interchangeably with AddPlot.If you want to type in a value rather than selecting a brush you would still use a Brush property, the brush selector by default lets you type in colors as hex codes.

    Regarding the name, you can change that dynamically from State.Configure. The AddPlot would move from SetDefaults to Configure in that use case.


    Code:
    public bool toggle {get;set;}
    protected override void OnStateChange()
    {
        if(State == State.Configure)
       {
          if(toggle)
             AddPlot(new Stroke(Brushes.Red), PlotStyle.Dot, "Test");
          else
             AddPlot(new Stroke(Brushes.Red), PlotStyle.Dot, "Test1");
       }
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    338 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X