Announcement

Collapse
No announcement yet.

gbChartMaster - Discussion

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

  • Tim Lakinir
    replied
    Thank you Everyone , these are very good straight lines graphing programs

    Leave a comment:


  • Dave Biggs
    replied
    Tim,

    This thread might be of interest too..
    https://forum.powerbasic.com/forum/u...le-scatterplot

    Leave a comment:


  • Gary Beene
    replied
    Stuart, thanks for responding to Tim!

    I've just not been able to break free to help out.

    Tim, if you still want something from me, please speak up!

    Leave a comment:


  • Stuart McLachlan
    replied
    For Tim,
    Here's a very simple x,y scatterplot and trendline based on my previous trendline code.

    '
    Code:
    #COMPILE EXE
    #DEBUG ERROR ON
    #DEBUG DISPLAY ON
    #DIM ALL
    #INCLUDE ONCE "WIN32API.INC"
    
    FUNCTION PBMAIN () AS LONG
    LOCAL n, i AS LONG
    LOCAL slope, offset AS EXT
    LOCAL xMin,xMax AS EXT
    LOCAL yMin,yMax,ypmax AS EXT
    LOCAL hGraph AS DWORD
    LOCAL strGType AS STRING
    'Build a data set
        n = 99 ' 100 points -1 because we are using a zero based array
        xMin = 0: xMax = 100 ' range to plot on x Axis.
        DIM dp(n,1) AS EXT ' x values in dp(i,0), y values in dp(i,1)
        RANDOMIZE TIMER
        'Comment out one of the two following plot types
        'scatter plot
         strGType = "Scatter Plot"
        FOR i = 0 TO n
            dp(i,0) = RND(1,100)
            dp(i,1) =  RND(1,100)
            IF dp(i,1) > ypmax THEN ypmax = dp(i,1)
        NEXT
        'linear plot
    '    strGType = "Linear Plot"
    '    FOR i = 0 TO n
    '        dp(i,0) = i
    '        dp(i,1) =  RND(1,20) + i * RND(1,5) ' slowly increment average y
    '        IF dp(i,1) > ypmax THEN ypmax = dp(i,1)          
    '    NEXT
        'Get linear trendline formula
        Trendline dp(),slope,offset
        yMin = offset: yMax = slope * xMax + offset
        ? "Trendline is:  y = " & FORMAT$(slope,"0.00") & IIF$(offset >= 0,"x +","x ")  & FORMAT$(offset,"0.00") & $CRLF _
        &  USING$("Line from (#.# , #.# ) to (#.# , #.#)",xMin,yMin,xMax,yMax)
    
       '===== DRAW GRAPH ===================
       GRAPHIC WINDOW NEW strGType,100,100,600,600 TO hGraph
       'scale window
       GRAPHIC SCALE (-10,ypMax+10) - (xMax+10,-10) 'invert co-ordinate system and put border around graph
       'draw axes
       GRAPHIC LINE (0,0) - (0,ypmax)
       GRAPHIC LINE (0,0) - (xMax,0)
       'Plot points
       FOR i = 0 TO n
           GRAPHIC SET POS (dp(i,0),dp(i,1))
           GRAPHIC PRINT "x"
           'graphic line (dp(i,0),0)-  (dp(i,0),dp(i,1)),%BLACK
    
       NEXT
       'Draw Trendline
       GRAPHIC LINE (xmin,ymin) - (xMax,yMax)
    
       GRAPHIC WAITKEY$
       GRAPHIC WINDOW END hGraph
    END FUNCTION
    
    FUNCTION TrendLine(a() AS EXT,s AS EXT, o AS EXT) AS LONG
    LOCAL i,n,sX,sY,sXY,sX2,sY2 AS EXT
        n = UBOUND(a())
        FOR i = 0 TO n
            sX +=  a(i,0)
            sy +=  a(i,1)
            sXY += a(i,0) * a(i,1)
            sx2 += a(i,0)^2
            sY2 += a(i,1)^2
        NEXT
        s =  (n * sXY - sX*sY)/(n*sX2 - sX^2)
        o = (sY - s *sX)/n
     END FUNCTION
    '

    Leave a comment:


  • Jules Marchildon
    replied
    Tim, are you looking for code to make an X-Y Scatterplot with a linear regression line?

    Leave a comment:


  • Gary Beene
    replied
    Howdy, Tim!

    Without using gbChartMaster? Ouch, my feelings are hurt!

    I'll be away for most of the day - will help out when I get back.

    Leave a comment:


  • Tim Lakinir
    replied
    Hi Gary, can you please provide a simple example code to do an XY graph that can plot random points and jointing them up as well a trend line?
    This gbchartmaster is too complicated, all help is appreciated. Thanks

    Leave a comment:


  • Tim Lakinir
    replied
    Thanks Sir Gary, it is version 2

    Leave a comment:


  • Gary Beene
    replied
    Howdy, Tim!

    When you downloaded and unzipped the file, what version did the EXE show? Should have been 2.0.

    I changed the web site to say 2.0.

    Leave a comment:


  • Tim Lakinir
    replied
    Thanks Gary
    when I tried to download the program from https://www.garybeene.com/sw/gbchartmaster.htm
    your website shows it is version 1.0 ? Is there a latest version?

    Leave a comment:


  • Gary Beene
    replied
    Stuart/Tim,
    Here's the discussion thread for gbChartMaster. I'll be away for several hours - will post another example then. I'll try do one with the DLL and another with the INC.

    Leave a comment:


  • Gary Beene
    replied
    As always please let me know if there are any problems.

    Leave a comment:


  • Jean-Pierre LEROY
    replied
    Originally posted by Gary Beene View Post
    Howdy, Jean-Pierre!

    You can download it here - http://www.garybeene.com/sw/gbchartmaster.htm

    There is no DLL. I separated the charting source code into an INC file, however, to make it easier to use in a PowerBASIC app.

    I once intended to create a DLL, but other tasks took my attention away!
    I got it, thanks a lot Gary.

    Leave a comment:


  • Francisco Castanedo
    replied
    Thanks Gary. It works now.

    I loved the "got distracted" phrase!. I know how we all get distracted at this age!!!!

    Leave a comment:


  • Gary Beene
    replied
    Should work now ... give it a try.

    I think what happened was that I'd deleted the zip file, as part of putting up a new one - then got distracted. I just reloaded it.

    Leave a comment:


  • Francisco Castanedo
    replied
    Hi Darrel, aan you copy and paste the URL to the download? This is not working: "http://www.garybeene.com/files/gbchartmaster.zip"

    Leave a comment:


  • Darrell Price
    replied
    Working for me...

    Leave a comment:


  • Francisco Castanedo
    replied
    Thanks Gary, again, for sharing your valuable software.

    This time though, the link to de zip file is not working.

    Regards,
    Francisco Castanedo

    Leave a comment:


  • Stephane Fonteyne
    replied
    What the hell is that

    Gary Beene Information Center Error 404 - Page not found.

    I'm sorry but that page was not found!

    You came from;


    Leave a comment:


  • Stephane Fonteyne
    replied
    Gary,

    All your files can not downloaded. Broken lInks
    Can you please this repaired this
    Thanks

    Leave a comment:

Working...
X