chart-unit-0.5.2: Native haskell charts.

Safe HaskellNone
LanguageHaskell2010

Chart.Arrow

Description

Charts that depict gradients and similar data, using arrows in positions

Synopsis

Documentation

data Arrow Source #

An arrow structure contains position, direction and size information

Constructors

Arrow 

Instances

Eq Arrow Source # 

Methods

(==) :: Arrow -> Arrow -> Bool #

(/=) :: Arrow -> Arrow -> Bool #

Show Arrow Source # 

Methods

showsPrec :: Int -> Arrow -> ShowS #

show :: Arrow -> String #

showList :: [Arrow] -> ShowS #

data ArrowOptions a Source #

todo: quite a clunky specification of what an arrow is (or could be)

normArrows :: [Arrow] -> [Arrow] Source #

Equalize the arrow space width with the data space one. this creates the right arrow sizing in physical chart space

arrows :: Traversable f => ArrowOptions Double -> f Arrow -> Chart b Source #

Rescale data across position, and between position and arrow direction.

note that, due to this auto-scaling, there is no such thing as a single arrow_ chart

arrows (def {arrowMaxLength=0.5,arrowMaxHeadLength=0.2,arrowMaxStaffWidth=0.01})
    [Arrow (Pair x (sin (5*x))) (Pair x (cos x)) |
     x<-grid MidPos (one::Range Double) 100]

arrowChart :: Traversable f => [ArrowOptions Double] -> Aspect -> Rect Double -> [f Arrow] -> Chart b Source #

A chart of arrows

arrowChart_ :: Traversable f => [ArrowOptions Double] -> Aspect -> [f Arrow] -> Chart b Source #

An arrow chart scaled to its own range

let as = normArrows [Arrow (Pair x y) (Pair (sin 1/x+0.0001) (cos 1/y+0.0001)) |
                     x<-grid MidPos (one::Range Double) 20,
                     y<-grid MidPos (one::Range Double) 20]
arrowChart_ [def] asquare [as]