]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/ui/gadgets/charts/lines/lines.factor
factor: trim using lists
[factor.git] / extra / ui / gadgets / charts / lines / lines.factor
index 21420fda768c6634ffbb5616e16895a18f2ced36..519588b51aad887683fd1bc3e7dccc920506045d 100644 (file)
@@ -1,13 +1,15 @@
 ! Copyright (C) 2016-2017 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs binary-search combinators
-combinators.short-circuit fry kernel locals make math math.order
-math.statistics math.vectors namespaces opengl opengl.gl
-sequences specialized-arrays.instances.alien.c-types.float
-splitting.monotonic ui.gadgets ui.gadgets.charts
-ui.gadgets.charts.utils ui.render ;
+USING: accessors arrays assocs binary-search colors
+combinators combinators.short-circuit kernel make
+math math.order math.statistics math.vectors opengl opengl.gl
+sequences specialized-arrays splitting.monotonic ui.gadgets
+ui.gadgets.charts ui.gadgets.charts.utils ui.render ;
+QUALIFIED-WITH: alien.c-types c
 IN: ui.gadgets.charts.lines
 
+SPECIALIZED-ARRAY: c:float
+
 ! Data must be a sequence of { x y } coordinates sorted by
 ! non-descending x vaues.
 TUPLE: line < gadget color data ;
@@ -111,7 +113,7 @@ ALIAS: y second
 : calc-point-y ( slope y point -- xy ) over [ calc-x ] dip 2array ;
 
 : xyy>chunk ( x y1 y2 -- chunk )
-    [ over ] dip 2array [ 2array ] dip 2array ;
+    overd 2array [ 2array ] dip 2array ;
 
 :: 2-point-chunk ( left right ymin ymax -- chunk )
     left last :> left-point
@@ -245,7 +247,7 @@ PRIVATE>
 M: line draw-gadget*
     dup parent>> dup chart? [| line chart |
         chart chart-axes
-        line [ color>> gl-color ] [ data>> ] bi
+        COLOR: black line [ default-color ] [ data>> ] bi
         dupd clip-data swap second [ drawable-chunks ] keep
         flip-y-axis
         chart chart-dim first2 [ chart chart-axes first2 ] dip swap