charts: add optional axes slot
parent
0c9cb2f0a7
commit
c2f8572393
|
@ -1,15 +1,19 @@
|
|||
! Copyright (C) 2016-2017 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel ui.gadgets ;
|
||||
USING: accessors arrays kernel sequences ui.gadgets ;
|
||||
IN: charts
|
||||
|
||||
TUPLE: chart < gadget ;
|
||||
TUPLE: chart < gadget axes ;
|
||||
|
||||
M: chart pref-dim* drop { 300 300 } ;
|
||||
|
||||
! Return the x and y ranges of the visible area.
|
||||
: chart-axes ( chart -- seq )
|
||||
drop { { 0 300 } { 0 300 } } ;
|
||||
[ dim>> ] [ axes>> ] bi [
|
||||
nip
|
||||
] [
|
||||
[ 0 swap 2array ] map
|
||||
] if* ;
|
||||
|
||||
! Return the { width height } of the visible area, in pixels.
|
||||
: chart-dim ( chart -- seq ) dim>> ;
|
||||
|
|
Loading…
Reference in New Issue