chart-unit-0.7.0.0: 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 #

Generic Arrow Source # 

Associated Types

type Rep Arrow :: * -> * #

Methods

from :: Arrow -> Rep Arrow x #

to :: Rep Arrow x -> Arrow #

type Rep Arrow Source # 
type Rep Arrow = D1 * (MetaData "Arrow" "Chart.Arrow" "chart-unit-0.7.0.0-BXvSbD7oeutD6IKgXEsdT" False) (C1 * (MetaCons "Arrow" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "arrowPos") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Pair Double))) (S1 * (MetaSel (Just Symbol "arrowDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Pair Double)))))

data ArrowHTStyle a Source #

ArrowStyles based on diagrams

Instances

Show a => Show (ArrowHTStyle a) Source # 
Generic (ArrowHTStyle a) Source # 

Associated Types

type Rep (ArrowHTStyle a) :: * -> * #

Methods

from :: ArrowHTStyle a -> Rep (ArrowHTStyle a) x #

to :: Rep (ArrowHTStyle a) x -> ArrowHTStyle a #

type Rep (ArrowHTStyle a) Source # 
type Rep (ArrowHTStyle a) = D1 * (MetaData "ArrowHTStyle" "Chart.Arrow" "chart-unit-0.7.0.0-BXvSbD7oeutD6IKgXEsdT" False) ((:+:) * ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "Tri" PrefixI False) (U1 *)) (C1 * (MetaCons "Dart" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "HalfDart" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "Spike" PrefixI False) (U1 *)) (C1 * (MetaCons "Thorn" PrefixI False) (U1 *))))) ((:+:) * ((:+:) * (C1 * (MetaCons "LineHead" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "NoHead" PrefixI False) (U1 *)) (C1 * (MetaCons "Tri2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))))) ((:+:) * (C1 * (MetaCons "Dart2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))) ((:+:) * (C1 * (MetaCons "HalfDart2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))) (C1 * (MetaCons "Spike2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))))))) ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "Thorn2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))) ((:+:) * (C1 * (MetaCons "Tri'" PrefixI False) (U1 *)) (C1 * (MetaCons "Dart'" PrefixI False) (U1 *)))) ((:+:) * (C1 * (MetaCons "HalfDart'" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "Spike'" PrefixI False) (U1 *)) (C1 * (MetaCons "Thorn'" PrefixI False) (U1 *))))) ((:+:) * ((:+:) * (C1 * (MetaCons "LineTail" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "NoTail" PrefixI False) (U1 *)) (C1 * (MetaCons "Quill" PrefixI False) (U1 *)))) ((:+:) * (C1 * (MetaCons "Block" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "Quill2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))) (C1 * (MetaCons "Block2" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a))))))))

data ArrowOptions Source #

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

Instances

Show ArrowOptions Source # 
Generic ArrowOptions Source # 

Associated Types

type Rep ArrowOptions :: * -> * #

Default ArrowOptions Source # 

Methods

def :: ArrowOptions #

type Rep ArrowOptions Source # 

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 -> 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

arrowsExample :: Chart b
arrowsExample =
  arrows
    ( #maxLength .~ 0.5 $
      #maxHeadLength .~ 0.2 $
      #maxStaffWidth .~ 0.01 $ def)
    [ Arrow (Pair x (sin (5 * x))) (Pair x (cos x))
    | x <- grid MidPos (one :: Range Double) 100
    ]

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

A chart of arrows

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

An arrow chart scaled to its own range

arrowChart_Example :: Chart b
arrowChart_Example = arrowChart_ [def] asquare [as]
  where
    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
        ]