Announcement

Collapse
No announcement yet.

drawShapeRelative - performance ?

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

  • drawShapeRelative - performance ?

    Has anyone seen a problem with performance when using drawShapeRelative in version 7.8 ? I have noticed that when I use this in my efs, the CPU usage goes up drastically and the response time decreasing a great deal. Any thoughts on how to use this function without experiencing a drag on the CPU ?

    Thanks !
    Jennifer

  • #2
    Jennifer
    Graphics (lines, shapes, text) will affect performance as they need to be constantly refreshed.
    To work around this you could create a counter that you increase at every bar and then use together with the tag name to limit the number of graphic objects drawn on the chart.
    Alex

    Comment


    • #3
      the other thing..

      is you can reduce your # of days/bars on the chart to compensate for this as a solution.
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment


      • #4
        Jennifer,

        Here is a sample of how you would accomplish limiting the number of lines on the chart, using the method Alex described.

        I just used the structure out of the help file for the draw statement as an example. I am sure you are familiar, but if in doubt, please see the help file for definitions of the dummy variables I used.

        drawLineRelative( x1, y1, x2, y2, style, thickness, color [, tagID] )

        I replaced the [,tagID] with the looping counter Alex described. The text in front of the yourcounter variable makes each unique.

        PHP Code:
        //outside MAIN

        var yourcounter 0;

        //before your graphics statements 
        if (getBarState() == BARSTATE_NEWBAR) { 
          if (
        varcounter 50)
            
        varcounter =0;
          else 
        varcounter++;

          
        //your graphics statements - just an example, they can be text, symbols, whatever, this is how you control the total number on the chart, to minimize performance issues

          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"each"+varcounter ); //first line
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"is"+varcounter ); //second unique line
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"a"+varcounter );//third unique line 
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"different"+varcounter );//fourth unique line 
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"line"+varcounter ); //fifth unique line
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"every"+varcounter ); //sixth unique line
          
        drawLineRelativex1y1x2y2stylethicknesscolor ,"bar"+varcounter ); //seventh unique line

        just a caution, make sure they are implemented only once per bar, otherwise, they will be drawn every tick and you may have only one visble line on your chart.

        Hope this helps
        Last edited by Guest; 04-25-2005, 06:49 PM.

        Comment

        Working...
        X