Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code to set the y-axis to a pre-defined scale?

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

    Code to set the y-axis to a pre-defined scale?

    Currently I am doing the following which only fixes the window to the pre-defined scale that I want when the window is maximized:

    Code:
    this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
    double yAxisSize = yAxisTicksParam * TickSize;
    this.ChartControl.FixedPanelMaxRight = 
        Close[CurrentBar - this.LastBarIndexPainted] + (yAxisSize / 2);
    this.ChartControl.FixedPanelMinRight = 
        Close[CurrentBar - this.LastBarIndexPainted] - (yAxisSize / 2);
    Is there a clever way to set the y-axis so that it is a certain scale no matter what the window size is? e.g. no maximized. Sometimes I want to produce a small chart print-out rather than the maximized size, and it takes ages with the mouse.

    Thanks

    #2
    Hi Adamus, I'm not exactly sure what you mean by -

    'Is there a clever way to set the y-axis so that it is a certain scale no matter what the window size is? e.g. no maximized. Sometimes I want to produce a small chart print-out rather than the maximized size, and it takes ages with the mouse.'

    So would wish to set an absolute fixed scale for the chart that you would otherwise have to set with the mouse?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      I wish to write a snippet of code to add to a button OnClick event which will set the y-axis so that I see 5 points look exactly the same size on my screen no matter what the window size.

      I'm not talking about doing anything really fancy to change the y-axis when the window resizes, although I can see I might try that later. I just want to be able to hit a button and execute code that makes the chart y-axis display at a scale of exactly 5 points per 8mm of vertical screen.

      Thinking about it that way, I figure I need to do per number of pixels, right?

      Comment


        #4
        Thanks adamus, I see. Yes I think first step then would then be knowing the scale you want achieve with that routine. I believe you're an elite member at BMT, there's a MousePan script published that you might find valuable to check into.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by briansaul, Today, 05:31 AM
        0 responses
        2 views
        0 likes
        Last Post briansaul  
        Started by fwendolynlpxz, Today, 05:19 AM
        0 responses
        4 views
        0 likes
        Last Post fwendolynlpxz  
        Started by traderqz, Yesterday, 12:06 AM
        11 responses
        28 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by PaulMohn, Today, 03:49 AM
        0 responses
        8 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Jason  
        Working...
        X