Announcement

Collapse
No announcement yet.

No syntax errors, but no plot

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

  • No syntax errors, but no plot

    I think I've followed the EFS internal explanation in the EFS knowledgebase alright. Whith the exception of a few areas that are a little unclear.



    On line 31 I put the
    if xstudy = null;
    And on line 35
    if (xstudy == null) avg =

    but I don't understand what it does or why it's needed, why can't you just start with avg = ??

    I guess that line 35 and 37 is not returning a series (another concept I don't fully understand. I have read some of the explanations by Jason and for some reason can't seem to wrap my mind around it)

    The last thing that was confusing, is that there are two return statements in the example. In the second return statement the source.getValue (0) is confusing. Does source mean open, close or does it mean the name of of the study??


    Any help is appreciated.

    Thanks,

    John
    Attached Files

  • #2
    Re: No syntax errors, but no plot

    Hello John,

    Originally posted by xoprofittaker
    I think I've followed the EFS internal explanation in the EFS knowledgebase alright. Whith the exception of a few areas that are a little unclear.



    On line 31 I put the
    if xstudy = null;
    And on line 35
    if (xstudy == null) avg =

    but I don't understand what it does or why it's needed, why can't you just start with avg = ??
    You certainly can if you prefer. Performing the null check and then initializing the series is simply a programming practice that adds a little efficiency to your formula by performing the initialization only on the first execution of main(). If you leave the null check out, the series still only gets initialized once, but is still evaluated on subsequent executions of main. The efs engine is smart enough to realize that the series was already established and avoids reinitializing the series.

    I guess that line 35 and 37 is not returning a series (another concept I don't fully understand. I have read some of the explanations by Jason and for some reason can't seem to wrap my mind around it)
    The series is null because the source you are telling to use does not exist. You are passing a function name of sDifferenceFunction, which is not defined within your formula. You do have a function defined as difference. You can try using that function name instead. You will also need to return something from that function. The value you return from the difference function will be the data the avg series will contain.

    The last thing that was confusing, is that there are two return statements in the example. In the second return statement the source.getValue (0) is confusing. Does source mean open, close or does it mean the name of of the study??


    Any help is appreciated.

    Thanks,

    John
    The url you posted was not the correct url for the article. However, I can assume that there is a return statement you're looking at that is associated with a null check. This is simply another programming practice that ends the execution of main if one of the variables you need data for a subsequent contions is not yet valid. The last return statement of the main() function or any user-defined function returns execution to the calling function. In the case of main() the return statement is used by the chart to determine the data series to plot on the chart. Hope this helps.
    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
      Still No Plot

      Thankyou Jason.

      I think I've made all the changes that you've suggested, but still I can't get a plot.

      I don't know if my return statement is incorrect or what???

      Thanks for any more suggestions,

      John
      Attached Files

      Comment

      Working...
      X