How do I get the trendline equation from Excel to script?

Discussion in 'Javascript' started by Mattias, Dec 7, 2004.

  1. Mattias

    Mattias Guest

    Hi!
    I want to display a bargraph including a trendline on the Internet
    (using an asp-page). It doesn't matter what I use to display it. I
    have found some graph-components (for example FusionCharts 2.2) that
    seems ok.

    First: What is the easiest way to go?
    1. Calculate the trendline values (with vbscript or javascript) and
    using a graphcomponent
    2. or using a excelcomponent and somehow manipulate it to show the
    graphs (bargraph and trendline) that I want.

    IF 1: Then the problem I have is that I can not figure out how to
    calculate the trendline values.

    I have found a page (http://www.j-walk.com/ss/excel/tips/tip101.htm)
    that has some code used in Excel (see below). But the INDEX, LINEST
    functions doesn't work in vbscript.
    ______________________________________________________
    Logarithmic Trendline
    Equation: y = (c * LN(x)) - b

    c: =INDEX(LINEST(y,LN(x)),1)

    b: =INDEX(LINEST(y,LN(x)),1,2)

    Power Trendline
    Equation: y=c*x^b

    c: =EXP(INDEX(LINEST(LN(y),LN(x),,),1,2))

    b: =INDEX(LINEST(LN(y),LN(x),,),1)
    ______________________________________________________

    IF 2: I am not very used to excel-programming so how can I do this
    trendline using a component? Oh, the person that will see this graph
    does not have the excel program.

    Best regards,
    Mattias in Sweden
    Mattias, Dec 7, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shukla, Sunil Kumar

    parallel CRC equation generator

    Shukla, Sunil Kumar, May 31, 2005, in forum: VHDL
    Replies:
    2
    Views:
    1,157
    Pete Fraser
    May 31, 2005
  2. Weng Tianxiang
    Replies:
    12
    Views:
    1,398
  3. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,498
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  4. Richard D. Moores
    Replies:
    4
    Views:
    1,133
    Richard D. Moores
    Jan 9, 2010
  5. Abder-Rahman Ali

    How can I get the result of this equation

    Abder-Rahman Ali, Jul 14, 2010, in forum: Ruby
    Replies:
    4
    Views:
    80
    James O'Brien
    Jul 14, 2010
Loading...

Share This Page