Sample stock graph

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Mike Schneider
    Member
    • Jun 2008
    • 24

    Sample stock graph

    Does anyone have a sample stock graph application code that I could look at?

    Thanks,

    Mike...
  • Richard Angell
    Member
    • May 1994
    • 4258

    #2
    Do you have a link to an example you are looking for?

    In the PBCC 5 Samples, take a look at the GRAPHICS samples. You might find that the PWRGRAPH sample could be of some use in showing some techniques in code.

    Also search this and the programming forum for examples. Searching on "chart", you ought to find some additional help in the first several pages of entries by selectively examining some of the topics.
    Rick Angell

    Comment

    • Mike Schneider
      Member
      • Jun 2008
      • 24

      #3
      No, I don't have a link to anything.

      I was hoping to see a basic stock graphing example. I looked at the graphics examples in the samples directory, but they are not really applicable.

      The two items I am struggling with right now are:

      1) How do I divide up my graphics window into pieces, for the various components of the stock chart, and how do I redimension the size of the various pieces so that I don't have to multiply everything by a scale factor?

      2) How do I change the title of a window when using the same window to load different symbols?

      Mike...

      Comment

      • Eros Olmi
        Member
        • Oct 2001
        • 1896

        #4




        Free and PB samples included. A must have.

        Comment

        • Mike Schneider
          Member
          • Jun 2008
          • 24

          #5
          I'm really hoping to write native code, and not use a plugin.

          I currently use scale factors, and subtract the plot values from the window height so that it doesn't plot upside down. But there must be a cleaner way?

          Just to give you an idea what I have so far... see attached image...
          Attached Files

          Comment

          • Michael Mattias
            Member
            • Aug 1998
            • 43447

            #6
            >Just to give you an idea what I have so far... see attached image



            That looks nice. So what is the problem?

            What's wrong with scale factors? That's how you fit different size stuff onto graphs which go on the same size screen.

            As far as 'upside downing'.... I just did this with the Haru PDF library. I am USED TO and PREFER to have the origin (0,0) at the upper left, working in inches.

            Haru wants Origin at LOWER left, measuring in points . Two dinky little functions solved the whole thing:
            Code:
            FUNCTION TO_XPOINT ( inches AS SINGLE) PRIVATE AS HPDF_REAL
                FUNCTION = inches * 72!
            END FUNCTION
            
            ' convert Y in INCHES FROM TOP OF PAGE
            ' to PDF points FROM BOTTOM OF PAGE
            ' A page is %PAGE_HEIGHT_POINTS high
            
            FUNCTION TO_YPOINT (inches AS SINGLE) PRIVATE AS HPDF_REAL
               FUNCTION = %PAGE_HEIGHT_POINTS - (inches * 72!)
            END FUNCTION
            All the detail printing code looks like:
            Code:
                         ' new page needed
                         ' first print a $LIT_CONTINUED at designated place on THIS page
                          x2  =   %X_CONTINUED/100! + lMargin
                         [COLOR="Red"] xPos =  TO_XPOINT(X2)[/COLOR]
                          Y2   =  Y2 + %CY_LI_LINES/100
                          [COLOR="Red"]Ypos =  TO_YPoint ( Y2)[/COLOR]
                          szText =  $LIT_CONTINUED
            X2, Y2 are in inches, with origin at upper left. Xpos and Ypos are passed to printing functions

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X