Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect value of the width of the chart

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

    Incorrect value of the width of the chart

    We have a client machine with two graphics cards AMD HD 6570.
    Code:
        public class TestGraphics : Indicator
        {
            private DateTime lastTimeMouseRefresh = DateTime.MinValue;
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description = "TestGraphics";
                    Name = "TestGraphics";
                    Calculate = Calculate.OnEachTick;
                    IsChartOnly = true;
                    IsOverlay = true;
                    DisplayInDataBox = true;
                }
                else if (State == State.Historical)
                {
                    ChartControl.PreviewMouseMove += mouse_move;
                }
                else if (State == State.Terminated)
                {
                    ChartControl.PreviewMouseMove -= mouse_move;
                }
            }
    
            protected override void OnBarUpdate()
            {
            }
    
            protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                DebugMessages("chartScale.Width " + chartScale.Width);
                DebugMessages("ChartPanel.W " + ChartPanel.W);
                DebugMessages("chartControl.CanvasRight " + chartControl.CanvasRight);
                DebugMessages("chartControl.PanelWidth " + chartControl.PanelWidth);
                DebugMessages("---");
                DebugMessages("chartScale.Height " + chartScale.Height);
                DebugMessages("ChartPanel.H " + ChartPanel.H);
                DebugMessages("chartControl.ActualHeight " + chartControl.ActualHeight);
                DebugMessages("------------------------");
            }
    
            private void DebugMessages(string myMessage)
            {
                Log(myMessage, NinjaTrader.Cbi.LogLevel.Information);
            }
    
            private void mouse_move(object sender, MouseEventArgs e)
            {
                if (DateTime.Now >= this.lastTimeMouseRefresh)
                {
                    this.lastTimeMouseRefresh = DateTime.Now.AddMilliseconds(100.0);
                    var position = e.GetPosition(ChartPanel as IInputElement);
    
                    DebugMessages("-position  " + position.X + "  " + position.Y);
                }
            }
    
        }
    in the Log
    2016-11-04 22:58:40:709|1|16|chartScale.Width 1022.4
    2016-11-04 22:58:40:709|1|16|ChartPanel.W 1278
    2016-11-04 22:58:40:709|1|16|chartControl.CanvasRight 1278
    2016-11-04 22:58:40:709|1|16|chartControl.PanelWidth 1022.4
    2016-11-04 22:58:40:709|1|16|hhh
    2016-11-04 22:58:40:709|1|16|chartScale.Height 700.8
    2016-11-04 22:58:40:709|1|16|ChartPanel.H 876
    2016-11-04 22:58:40:709|1|16|chartControl.ActualHeight 728
    Is there any solution without replacing the hardware?

    upd. Quad Core i7, .NET 4.6, Windows 10 Home. NT8 RC2
    Last edited by alexr; 11-04-2016, 07:09 AM.

    #2
    Hello alexr,

    Thank you for your post.

    Have the user check their Display settings under Control Panel > Display > "Set a custom scaling level" > see if it is not set to 100%.
    Attached Files

    Comment


      #3
      I checked it. 100%

      upd. But I found was 125% elsewhere. Tomorrow, after restart the computer will seen.
      Last edited by alexr; 11-04-2016, 09:11 AM.

      Comment


        #4
        Hello alexr,

        Thank you for your response.

        Can you have the user send us their log and trace files? Please have them reference this thread in their note. They can send their files by going to Help > Email Support.

        Comment


          #5
          DPI is definitely the cause of the discrepancy between chart panel (device pixels) and the chart scale (application pixels)



          We have some charting extension you can use on these property values to help convert the values to be compatible with all devices


          MatthewNinjaTrader Product Management

          Comment


            #6
            Originally posted by alexr View Post
            I checked it. 100%

            upd. But I found was 125% elsewhere. Tomorrow, after restart the computer will seen.
            It seems to work correctly when the scaling set 100%. But still I have to rewrite code to avoid such problems in the future.

            2 Patrick, I looked at the log and trace files, nothing interesting.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by gentlebenthebear, Today, 01:30 AM
            2 responses
            13 views
            0 likes
            Last Post gentlebenthebear  
            Started by Kaledus, Today, 01:29 PM
            2 responses
            8 views
            0 likes
            Last Post Kaledus
            by Kaledus
             
            Started by frankthearm, Yesterday, 09:08 AM
            13 responses
            46 views
            0 likes
            Last Post frankthearm  
            Started by PaulMohn, Today, 12:36 PM
            2 responses
            16 views
            0 likes
            Last Post PaulMohn  
            Started by Conceptzx, 10-11-2022, 06:38 AM
            2 responses
            56 views
            0 likes
            Last Post PhillT
            by PhillT
             
            Working...
            X