Home Forums HTBasic Forum Graph

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #4491
    alete
    Participant

    hi sorry my english: i use google translate. why x-axis values are decimal? I would like whole numbers to appear, what can I do? how come the axis of the Y the minimum appears to me 10000, and the maximum 19000, when the minimum of the y is 9656.62 and the maximum 9698? how do i have to have a stair with a pleasure step?thanksI am attaching the listing

    LOAD BIN “BPLUS”
    DIM X(5),Y1(5),Y2(5)

    Name$=”Nasdaq Future”

    !

    ! Define colors

    !

    INTEGER Black,White,Red,Yellow,Green,Cyan,Blue,Magenta

    DATA 0,1,2,3,4,5,6,7

    READ Black,White,Red,Yellow,Green,Cyan,Blue,Magenta

    INTEGER N

    !
    ! SYSTEM MENU entries

    !

    DIM M$(0:5)[16]

    DATA “No Markers”,”One Marker”,”Two Markers”

    DATA “Delta Markers”,”Ratio Markers”,”Quit”

    READ M$(*)

    !

    ! Variables to hold display coordinates

    !

    INTEGER D(1:4),Cursor,Dw,Dh,Gx,Gy,Gw,Gh

    !

    ! Get display size

    !

    GESCAPE CRT,3;D(*)

    Dw=D(3)-D(1)

    Dh=D(4)-D(2)
    CLEAR SCREEN
    Gw=Dw*.7

    Gh=Dh

    Gx=(Dw-Gw)/2

    Gy=(Dh-Gh)/2

    H=1*Gh
    G=0 !

    ! Build XY GRAPH.

    !

    ASSIGN @Graph TO WIDGET “XY GRAPH”;SET (“VISIBLE”:0)

    CONTROL @Graph;SET (“SYSTEM MENU”:M$(*),”MINIMIZABLE”:1)

    CONTROL @Graph;SET (“TITLE”:Name$)

    CONTROL @Graph;SET (“SHARED X”:1,”TRACE COUNT”:2)

    CONTROL @Graph;SET (“SHOW GRID”:1,”TRACE BACKGROUND”:White)

    CONTROL @Graph;SET (“X”:Gx,”Y”:G,”WIDTH”:Gw,”HEIGHT”:H)

    I=5
    !

    CONTROL @Graph;SET (“CURRENT AXIS”:”X”,”ORIGIN”:1,”RANGE”:I)

    ! Set up X data

    FOR I=0 TO 5
    X(I)=I
    NEXT I
    I=5
    CONTROL @Graph;SET (“CURRENT TRACE”:1,”X DATA”:X(*))

    DATA 9656.62,9656.96,9658.19,9658.47,9658.60,9658.77
    READ Y1(*)
    DATA 9698,9697.80,9687.60,9687.80,9690.50,9690.60
    READ Y2(*)
    Mi=MIN(Y1(*))
    Mi=MIN(Mi,Y2(*))
    Ma=MAX(Y1(*))
    Ma=MAX(Ma,Y2(*))

    !

    CONTROL @Graph;SET (“CURRENT AXIS”:”Y”,”ORIGIN”:Mi,”RANGE”:Ma)

    CONTROL @Graph;SET (“CURRENT TRACE”:1,”X DATA”:X(*))

    CONTROL @Graph;SET (“TRACE PEN”:Red,”Y DATA”:Y1(*))

    !
    CONTROL @Graph;SET (“CURRENT TRACE”:2,”Y DATA”:Y2(*))

    CONTROL @Graph;SET (“TRACE PEN”:Blue)

    ! Loop and wait to exit

    !

    CONTROL @Graph;SET (“VISIBLE”:1)

    ON EVENT @Graph,”SYSTEM MENU” GOSUB Handler
    !
    LOOP

    WAIT FOR EVENT

    END LOOP

    STOP

    !
    Handler: !

    STATUS @Graph;RETURN (“SYSTEM MENU EVENT”:N)

    SELECT N

    !

    ! No markers

    !

    CASE 0

    CONTROL @Graph;SET (“MARKER”:”NONE”)

    !

    ! One marker

    !

    CASE 1

    CONTROL @Graph;SET (“MARKER”:”ONE”,”MARKER1 TRACE”:1)

    CONTROL @Graph;SET (“MARKER1 X”:X(I),”MARKER1 Y”:Y1(I))

    !

    ! Two markers

    !

    CASE 2

    CONTROL @Graph;SET (“MARKER”:”TWO”)

    CONTROL @Graph;SET (“MARKER1 TRACE”:1,”MARKER2 TRACE”:2)

    CONTROL @Graph;SET (“MARKER1 X”:X(I),”MARKER2 X”:X(I))

    CONTROL @Graph;SET (“MARKER1 Y”:Y1(I),”MARKER2 Y”:Y2(I))

    !

    ! Delta markers

    !

    CASE 3

    CONTROL @Graph;SET (“MARKER”:”DELTA”)

    CONTROL @Graph;SET (“MARKER1 TRACE”:1,”MARKER2 TRACE”:2)

    CONTROL @Graph;SET (“MARKER1 X”:X(I),”MARKER2 X”:X(I))

    CONTROL @Graph;SET (“MARKER1 Y”:Y1(I),”MARKER2 Y”:Y2(I))

    !

    ! Ratio markers

    !

    CASE 4

    CONTROL @Graph;SET (“MARKER”:”RATIO”)

    CONTROL @Graph;SET (“MARKER1 TRACE”:1,”MARKER2 TRACE”:2)

    CONTROL @Graph;SET (“MARKER1 X”:X(I),”MARKER2 X”:X(I))

    CONTROL @Graph;SET (“MARKER1 Y”:Y1(I),”MARKER2 Y”:Y2(I))

    !

    ! Exit program

    !

    CASE 5

    ASSIGN @Graph TO * ! Delete XY GRAPH widget

    STOP

    END SELECT

    RETURN

    !

    END

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.