]> gitweb.factorcode.org Git - factor.git/blob - extra/ui/gadgets/charts/charts.factor
Switch to https urls
[factor.git] / extra / ui / gadgets / charts / charts.factor
1 ! Copyright (C) 2016-2017 Alexander Ilin.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays kernel sequences ui.gadgets ;
4 IN: ui.gadgets.charts
5
6 TUPLE: chart < gadget axes ;
7
8 M: chart pref-dim* drop { 300 300 } ;
9
10 ! Return the x and y ranges of the visible area.
11 : chart-axes ( chart -- seq )
12     [ dim>> ] [ axes>> ] bi [
13         nip
14     ] [
15         [ 0 swap 2array ] map
16     ] if* ;
17
18 ! Return the { width height } of the visible area, in pixels.
19 : chart-dim ( chart -- seq ) dim>> ;