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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      57 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      78 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      41 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      101 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      61 views
      0 likes
      Last Post PaulMohn  
      Working...
      X