Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartBars.GetBarIdxByX(chartControl, cursorPointX)

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

    ChartBars.GetBarIdxByX(chartControl, cursorPointX)

    Hello,

    Something is strange. I did a for loop:

    Code:
    for(int barIndex = ChartBars.GetBarIdxByX(chartControl, cursorPointX); barIndex <= index1; barIndex++)
                    {
                    }
    When i click on the chart to know what bar is clicked i use
    Code:
      int clickedBarIndex = (ChartBars.GetBarIdxByX(chartControl, cursorPointX));
    and it return the right clicked bar. 4700

    But Printing barIndex in the for loop return the wrong bars. How is it possible?

    For exemple, clickedBarIndex = 4700 but the for loop return bars 4750 to 4800. 4800 is index1. It should return bars 4700 to 4800 ??

    Ty

    #2
    Hi frankduc, thanks for your question.

    You should try Printing the values from the for loop to make sure they are matching up with expectations. Print out the value of ChartBars.GetBarIdxByX(chartControl, cursorPointX) and that will confirm what the for loop is iterating on.

    I look forward to hearing from you.

    Comment


      #3
      my bad wrong variable at the wrong place

      Comment


        #4
        Just one thing bothering me.

        In
        Code:
        string textString = "BarsIndex:" + clickedBarIndex.ToString() + "\nTime:" + timeValue.ToString("H:mm:ss") + "\nclist:" + clist[c].ToString("N4");
        I can get in the chart the clist but color red is flashing turning pale red to bold red from time to time. Any idea why?

        Comment


          #5
          Hello frankduc, thanks for your reply.

          I apologize, I must ask for more context. What is clist and what component of the chart is turning different colors unexpectedly?

          I look forward to hearing from you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          67 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          95 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          53 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          108 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          63 views
          0 likes
          Last Post PaulMohn  
          Working...
          X