chart-unit-0.6.0.2: Native haskell charts.

Safe HaskellNone
LanguageHaskell2010

Chart.Text

Description

textual chart elements

Synopsis

Documentation

data TextOptions Source #

text options

newtype TextPathOptions Source #

options specific to text as an SVG path

data TextType Source #

text as a path or as svg text

data TextFont Source #

ADT of fonts

Constructors

Lin2 
Lin 
Bit 

textFont :: TextFont -> PreparedFont Double Source #

transform from chart-unit to SVGFonts rep of font

text_ :: TextOptions -> Text -> Chart b Source #

Create a textual chart element

text_ def "Welcome to chart-unit!"

texts :: R2 r => TextOptions -> [(Text, r Double)] -> Chart b Source #

Create positioned text from a list

ts :: [(Text, Pair Double)]
ts = zip
  (map Text.singleton ['a' .. 'z'])
  [Pair (sin (x * 0.1)) x | x <- [0 .. 25]]

textsExample :: Chart b
textsExample = texts def ts

textChart :: Traversable f => [TextOptions] -> Rect Double -> Rect Double -> [f (Text, Pair Double)] -> Chart b Source #

A chart of text

textChart_ :: [TextOptions] -> Rect Double -> [[(Text, Pair Double)]] -> Chart b Source #

A chart of text scaled to its own range

textChart_Example :: Chart b
textChart_Example =
  textChart_ [#size .~ 0.33 $ def] widescreen [ts]

data LabelOptions Source #

A label is a text element attached to a chart element

labelled :: LabelOptions -> Text -> Chart b -> Chart b Source #

Label a chart element with some text

labelledExample :: Chart b
labelledExample =
  labelled
    (LabelOptions
       (#alignH .~ AlignLeft $ #rotation .~ 45 $ def)
       (Pair 1 1)
       0.05)
    "a label"
    (glyph_ def)