Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartControl.ChartObjects contains not all drawing objects

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

    ChartControl.ChartObjects contains not all drawing objects

    Hi,
    when I try to get all drawing objects, I get only the objects placed on viewable area of chart and to the left of it. All objects placed to the right of the viewable area does not includes in ChartControl.ChartObjects if it did not shown on the chart after chart refresh.
    How I can get it?

    My code:
    Code:
    foreach (ChartObject co in ChartControl.ChartObjects)
    {
    
    //My code
    }

    #2
    Hello Higeker,

    Thanks for opening the thread.

    Using the sample code provided in the ChartObjects documentation, I have been able to loop through a list containing draw objects in ChartPanel.ChartObjects. I am also observing that this is printing for draw objects that are beyond the visible are of a chart.

    Are you still running into the same issues when applying this code to an indicator?

    Code:
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    {
      base.OnRender(chartControl, chartScale);
     
      IList<Gui.NinjaScript.IChartObject> myObjects = ChartPanel.ChartObjects;
     
      foreach (Gui.NinjaScript.IChartObject thisObject in myObjects)
      {
          Print(String.Format("{0} is of type {1}", thisObject.Name, thisObject.GetType()));
      }
    }


    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you for answer!
      I use NT7 and I did not found OnRender there.
      I try to get all chart objects from timer event handler.

      Comment


        #4
        Hello Higekker,

        Oops, I guess I'm in the wrong forum! Thanks for pointing that out.

        I used your same loop to print the Tag of co, and I can see prints for chart drawing objects that have been placed past the current bar whether or not that Chart Object is visible.

        I have made a barebones indicator with your loop in OnBarUpdate() to achieve this. Here is what I did:
        Code:
        protected override void OnBarUpdate()
        {
        	foreach (ChartObject co in ChartControl.ChartObjects)
        	{
        		Print(co.Tag);
        	}
        }
        Please let me know if you are not getting prints for your Chart's drawing objects. Also, are these drawing objects all manually drawn or from NinjaScripts? Can you confirm if one is printing or the other?

        I look forward to assisting further.

        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