charts.lines: remove middle and its tests

char-rename
Alexander Iljin 2017-01-21 00:25:50 +03:00 committed by John Benediktsson
parent 3e6a6c189c
commit 6aa7aad5b1
2 changed files with 1 additions and 7 deletions

View File

@ -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 } } }
} [

View File

@ -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@ / * ;