Announcement

Collapse
No announcement yet.

drawTextAbsolute cpu issue

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • drawTextAbsolute cpu issue

    I use drawTextAbsolute to put a button on the screen and notice a large increase in cpu usage.

    Is there a way to reduce cpu usage, perhaps with getBarState()? some other trick?

  • #2
    Hello David,

    Without seeing your code, my guess is that you are calling the function on each execution of your formula. Also if you don't specify a unique tag name, you may be drawing multiple buttons on top of each other. You really only need to draw the button once, so use a global flag to control this. Here's an example.

    PHP Code:
    var bButton false;

    function 
    main() {
        
        if (
    bButton == false) {
            
    drawTextAbsolute(blablabla ... , "Unique Tag Name");
            
    bButton true;
        }
        

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Thx again, Jason, that was a great solution.

      MY defintion says

      drawTextAbsolute(xBar, yValue, Text, [FGColor], [BGColor], [Flags], [FontName], [FontSize], [TagName], [cx], [cy])

      and if I change the tagname to 11, the box shrinks in size compared to tagname=12.

      AM I missing something?

      Also, I have two butons, both with tagname 12, is that a problem?, doesnt appear to be.

      Comment


      • #4
        The 12 I was referring to was the font size, not the tagname, sorry for the confusion

        Comment

        Working...
        X