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?

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        65 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        23 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        26 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        52 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X