charts: use clip-data in draw-gadget*
parent
72c1ccba96
commit
b357c62122
|
@ -83,7 +83,7 @@ PRIVATE>
|
||||||
|
|
||||||
! Return the bottom-left and top-right corners of the visible area.
|
! Return the bottom-left and top-right corners of the visible area.
|
||||||
: chart-axes ( chart -- seq )
|
: chart-axes ( chart -- seq )
|
||||||
drop { { 0 300 } { 300 0 } } ;
|
drop { { 0 300 } { 0 300 } } ;
|
||||||
|
|
||||||
! There are several things to do to present data on the screen.
|
! There are several things to do to present data on the screen.
|
||||||
! Map the data coordinates to the screen coordinates.
|
! Map the data coordinates to the screen coordinates.
|
||||||
|
@ -92,9 +92,9 @@ PRIVATE>
|
||||||
|
|
||||||
M: line draw-gadget*
|
M: line draw-gadget*
|
||||||
dup parent>> dup chart? [
|
dup parent>> dup chart? [
|
||||||
chart-axes drop
|
chart-axes swap
|
||||||
[ color>> gl-color ]
|
[ color>> gl-color ] [ data>> ] bi
|
||||||
[ data>> draw-line ] bi
|
clip-data [ draw-line ] unless-empty
|
||||||
] [ 2drop ] if ;
|
] [ 2drop ] if ;
|
||||||
|
|
||||||
! chart new line new COLOR: blue >>color { { 0 100 } { 100 0 } { 100 50 } { 150 50 } { 200 100 } } >>data add-gadget gadget.
|
! chart new line new COLOR: blue >>color { { 0 100 } { 100 0 } { 100 50 } { 150 50 } { 200 100 } } >>data add-gadget gadget.
|
||||||
|
|
Loading…
Reference in New Issue