Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Wrong bar index.

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

    Wrong bar index.

    Hello.

    When I try to get bar index by
    Code:
     ChartControl.GetSlotIndexByX(X)
    sometimes I get wrong bar index. Sometimes it misses bar I'm not sure why.
    I've also tried
    Code:
    ChartBars.GetBarIdxByX(ChartControl,X);
    X coordinate I obtain from mouse click -
    Code:
    GetPosition(ChartControl).X
    .
    The issue occurs only on one PC.
    On others PCs it works well.

    Listed below is my code.

    Code:
    void OnLeftClick(object sender,MouseEventArgs mouse)
    {
    SplitFromCLick((int)mouse.GetPosition(ChartControl).X(float)mouse.GetPosition(ChartControl).Y);
    }	
    public void SplitFromCLick(int X, float Y)
    {
     Print(String.Format("bar_index {0}",ChartControl.GetSlotIndexByX(X)));
    }
    Last edited by blekdzhon; 06-29-2017, 10:33 PM.

    #2
    Hello,

    Thank you for the post.

    To find specific Bars, you should be using GetBarIdxByX.


    GetSlotIndexByX would return the area that can hold a bar which may or may not contain the bar in question.


    Have you tried using the example from the first link and how it gets the mouse point? ChartControl.MouseDownPoint



    If that does not aid in correcting the problem, could you provide an example as a .cs file that I could test to see the specific syntax and how it is used?

    I look forward to being of further assistance.

    Comment


      #3
      Did you finally resolve this? I have the same issue on one PC, but not on the other

      Comment


        #4
        Originally posted by stnk56 View Post
        Did you finally resolve this? I have the same issue on one PC, but not on the other
        Hi. Yes I use the following function to obtain correct x coordinate.
        Code:
        ChartingExtensions.ConvertToHorizontalPixels(mouse.GetPosition(ChartPanel as IInputElement).X, ChartControl.PresentationSource);

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        344 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        557 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X