Skip to main content
saratogacoach
Inspiring
July 25, 2017
Question

Graphing Line

  • July 25, 2017
  • 1 reply
  • 604 views

Using ActionScript (Flash CS6) or JavaScript (Animate) need to graph a line for an eLearning lesson's survey scores. Kglad suggested a similar script for a different graph for a question that I asked: normal distribution graph to show data . The new graph is different : inverse proportion line with equation: y = -8.44x-31.12 .

The graph line larger sample results can be placed using an image. (here's the article with original graph-Figure 1- and data: https://scholar.google.com/scholar_url?url=https://brage.bibsys.no/xmlui/bitstream/handle/11250/277366/R%25F8ysamb_2014_… )

The challenge is placing a new survey score on that line if you only have X.

The Kglad script example was for a normal distribution, and only the X score indicator was moved on the X axis (Y in this example was a constant on the Y axis). This graph needs to move both X and Y and you only have X position and equation for the line (see above).

Would appreciate any help with AS script (and JS script if later using Animate) for this different line and graph. I have tried to adapt Kglad's script but with no success.

Thank you for your help.

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    July 25, 2017

    i'm not sure what you're looking for because graphing a line is pretty simple expecially if you're not animating the graph.

    here are some animated graphing snippets:  http://www.kglad.com > snippets > function graphs

    saratogacoach
    Inspiring
    July 25, 2017

    Hi kglad,

    Thank you for writing  and these snippets. I checked them but I don't think any of the snippets would apply to this inverse linear plotting.

    I am trying to use a different graph than normal distribution and place scores on it. The score has an X value, so needs to be translated into an X position, moved there. There is no Y for the score unless it can be calculated from the X based on the line's equation (y=some factor*x + a constant--derived from the original articles Figure 1 graph.) The article's actual graph has 4 ranges and there are 3 linear splines. So I've broken it up into 3 splines, an equation for each. First spline equation (from Excel trend line) is y = -8.44x-31.12.

    spline 1 (there are 3 splines, each with a different slope and equation)

    first known intersect (from article, graph in-Figure 1): X=14.24, Y=2

    second known intersect (from article, graph in-Figure 1): X=5.80, Y=3

    So, if there is a new score of 2.75 (X), how to script getting Y, and moving a score indicator/marker to the correct X,Y location on this line.

    Moving a score to X position is the same as in your original Normal Distribution example. But I need to then (1) derive Y using the equation and (2) also move it to the score's Y position. I can't figure out how to script # 2, since the Y Axis is up-down instead of side to side like for X. My scripting is a little limited with converting/adding this to the X script.

    Also if possible, since may use CS6 or Animate CC, would like to translate the AS version including both X and Y to JavaScript for later use.

    Hope that this is a better explanation of what I am trying to achieve in this new eLearning lesson and graph display.

    Thank you for your kind help.

    kglad
    Community Expert
    Community Expert
    July 26, 2017

    that's more work than i would do for free.  maybe someone else will help or, if you want to hire me to do that, send an email via http://www.kglad.com > contact