From 6aa7aad5b1d9c50d24d1a675e44e345fc7bdc966 Mon Sep 17 00:00:00 2001 From: Alexander Iljin <ajsoft@yandex.ru> Date: Sat, 21 Jan 2017 00:25:50 +0300 Subject: [PATCH] charts.lines: remove middle and its tests --- lines/lines-tests.factor | 4 ---- lines/lines.factor | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lines/lines-tests.factor b/lines/lines-tests.factor index 663592498b..29efcbf197 100644 --- a/lines/lines-tests.factor +++ b/lines/lines-tests.factor @@ -220,10 +220,6 @@ IN: charts.lines.tests drawable-chunks [ { } like ] map ] unit-test -{ 0 } [ -10 10 middle ] unit-test -{ 15 } [ 10 20 middle ] unit-test -{ -81/2 } [ -50 -31 middle ] unit-test - { { { { 0 300 } { 1 200 } { 2 150 } { 3 100 } { 4 0 } } } } [ diff --git a/lines/lines.factor b/lines/lines.factor index a6229459f4..6418b94084 100644 --- a/lines/lines.factor +++ b/lines/lines.factor @@ -199,10 +199,8 @@ ALIAS: y second monotonic-split-slice ] 2keep (drawable-chunks) ; -: middle ( min max -- middle ) + 2 / ; - : flip-y-axis ( chunks ymin,ymax -- chunks ) - first2 middle 2 * '[ [ _ swap - ] assoc-map ] map ; + first2 + '[ [ _ swap - ] assoc-map ] map ; ! value' = (value - min) / (max - min) * width : scale ( width value max min -- value' ) neg [ + ] curry bi@ / * ;