charts.demos: add demo vocab

char-rename
Alexander Iljin 2017-01-22 00:52:00 +03:00 committed by John Benediktsson
parent c2f8572393
commit 59f35e4d97
4 changed files with 25 additions and 2 deletions

View File

@ -22,5 +22,3 @@ M: chart pref-dim* drop { 300 300 } ;
! Map the data coordinates to the screen coordinates.
! Cut off data outside the presentation window. When cutting off vertically, split the line into segments and add new points if necessary. Return an array of line segments.
! Remove redundant points from the drawing pass.
! chart new line new COLOR: blue >>color { { 0 100 } { 100 0 } { 100 50 } { 150 50 } { 200 100 } } >>data add-gadget "Chart" open-window

1
demos/authors.txt Normal file
View File

@ -0,0 +1 @@
Alexander Ilin

22
demos/demos.factor Normal file
View File

@ -0,0 +1,22 @@
! Copyright (C) 2017 Alexander Ilin.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays charts charts.lines colors.constants
kernel literals math math.constants math.functions sequences ui
ui.gadgets ;
IN: charts.demos
CONSTANT: -pi $[ pi neg ]
: sine-wave ( steps -- seq )
[ iota ] keep
pi 2 * swap / [ * pi - dup sin 2array ] curry map
${ pi $[ pi sin ] } suffix ;
: chart-demo ( -- )
chart new ${ ${ -pi pi } { -1 1 } } >>axes
line new COLOR: blue >>color 40 sine-wave >>data
add-gadget "Chart" open-window ;
MAIN: chart-demo
! chart new line new COLOR: blue >>color { { 0 100 } { 100 0 } { 100 50 } { 150 50 } { 200 100 } } >>data add-gadget "Chart" open-window

2
demos/tags.txt Normal file
View File

@ -0,0 +1,2 @@
graphics
demos