Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting indicator margin programatically

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

    Setting indicator margin programatically

    Hi, I would like to set a margin of 30 Percent automatically in my indicator code. My code is like so:

    Code:
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    {
    
    chartScale.Properties.AutoScaleMarginType = AutoScaleMarginType.Percent;
    chartScale.Properties.AutoScaleMarginUpper = 30;
    chartScale.Properties.AutoScaleMarginLower = 30;
    
    }
    This code does not generate any errors in the log, but it also prevents my plots from rendering. I just get an empty indicator panel. Did I do it wrong, or is this still not really a supported method? If so, are there any work-arounds to get the same end result? I thought of adding an extra plot above and below that are transparent, but I would rather not have extra plots if possible.

    #2
    Hello torch2k,

    Thank you for your reply.

    Since you're overriding the regular functions of OnRender() with this code, you will need to call the base OnRender() prior to your custom logic so that the plots also render along with your modifications.

    Code:
    protected override void OnRender(ChartControl char tControl, ChartScale chartScale)
    {
      // call the base.OnRender() to ensure standard Plots work as designed
      base.OnRender(chartControl, chartScale);
    
      // custom render logic
    }


    Please let us know if we may be of further assistance to you.

    Comment


      #3
      perfect, thank you!

      Comment

      Latest Posts

      Collapse

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