| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Chart.Arrow
Description
Charts that depict gradients and similar data, using arrows in positions
- data Arrow = Arrow {}
- data ArrowHTStyle a
- data ArrowOptions = ArrowOptions {}
- normArrows :: [Arrow] -> [Arrow]
- arrows :: Traversable f => ArrowOptions -> f Arrow -> Chart b
- arrowChart :: Traversable f => [ArrowOptions] -> Rect Double -> Rect Double -> [f Arrow] -> Chart b
- arrowChart_ :: Traversable f => [ArrowOptions] -> Rect Double -> [f Arrow] -> Chart b
Documentation
An arrow structure contains position, direction and size information
data ArrowHTStyle a Source #
ArrowStyles based on diagrams
Constructors
| Tri | |
| Dart | |
| HalfDart | |
| Spike | |
| Thorn | |
| LineHead | |
| NoHead | |
| Tri2 a | |
| Dart2 a | |
| HalfDart2 a | |
| Spike2 a | |
| Thorn2 a | |
| Tri' | |
| Dart' | |
| HalfDart' | |
| Spike' | |
| Thorn' | |
| LineTail | |
| NoTail | |
| Quill | |
| Block | |
| Quill2 a | |
| Block2 a |
Instances
| Show a => Show (ArrowHTStyle a) Source # | |
| Generic (ArrowHTStyle a) Source # | |
| type Rep (ArrowHTStyle a) Source # | |
data ArrowOptions Source #
todo: quite a clunky specification of what an arrow is (or could be)
Constructors
| ArrowOptions | |
Fields
| |
Instances
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
]