Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartScale.Properties.HorizontalGridlinesInterval - No Effect

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

    ChartScale.Properties.HorizontalGridlinesInterval - No Effect

    Hi,

    I'm trying to set the Horizontal Grid Line Interval although it doesn't have any effect. I've tried with the code below in both an indicator and a chart style but when outputting chartScale.Properties.HorizontalGridlinesInterval to the output windows it still returns 0 and has no effect on the chart. Should it have the desired effect?

    Example code is below, I've also added the 4 lines within the OnRender method to the CandlStyle chart style but also has no effect.

    Thanks

    namespace NinjaTrader.NinjaScript.ChartStyles
    {
    public class GridLinesChartStyle : ChartStyle
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Chart style here.";
    Name = "GridLinesChartStyle";
    ChartStyleType = (ChartStyleType) 8;
    BarWidth = 2;
    }
    else if (State == State.Configure)
    {
    }
    }

    public override bool IsTransparent { get { return false; } } // replace with your logic to check if entire style is transparent

    public override int GetBarPaintWidth(int barWidth)
    {
    return 1; //replace with your bar width logic
    }

    public override void OnRender(ChartControl chartControl, ChartScale chartScale, ChartBars chartBars)
    {
    chartScale.Properties.HorizontalGridlinesIntervalT ype = HorizontalGridlinesIntervalType.Ticks;
    chartScale.Properties.HorizontalGridlinesInterval = 1;
    base.OnRender(chartControl, chartScale, chartBars);
    Print(chartScale.Properties.HorizontalGridlinesInt erval);
    }

    }
    }
    Last edited by tdouglas; 08-22-2015, 01:48 AM.

    #2
    What is the HorizontalGridlinesCalculation set to? If it's Automatic, that value would return 0. You need to set that to Fixed.

    Code:
    public override void OnRender(ChartControl chartControl, ChartScale chartScale, ChartBars chartBars)
    {
    	Print("HorizontalGridlinesCalculation: " + chartScale.Properties.HorizontalGridlinesCalculation);
    	Print("HorizontalGridlinesInterval: " + chartScale.Properties.HorizontalGridlinesInterval);
    	Print("HorizontalGridlinesIntervalType: " + chartScale.Properties.HorizontalGridlinesIntervalType);
    	
    	if (chartScale.Properties.HorizontalGridlinesCalculation != YAxisRangeType.Fixed)
    		chartScale.Properties.HorizontalGridlinesCalculation = YAxisRangeType.Fixed;
    	
    	chartScale.Properties.HorizontalGridlinesInterval = 100;
    	
    }
    MatthewNinjaTrader Product Management

    Comment


      #3
      Worked perfectly. Thanks!

      Comment

      Latest Posts

      Collapse

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