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 elirion, Today, 01:36 AM
        0 responses
        3 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        2 views
        0 likes
        Last Post gentlebenthebear  
        Started by samish18, Yesterday, 08:31 AM
        2 responses
        9 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by Mestor, 03-10-2023, 01:50 AM
        16 responses
        389 views
        0 likes
        Last Post z.franck  
        Started by rtwave, 04-12-2024, 09:30 AM
        4 responses
        33 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X