Safe Haskell | None |
---|---|
Language | Haskell2010 |
textual chart elements
- data TextOptions = TextOptions {}
- newtype TextPathOptions = TextPathOptions {}
- data TextSvgOptions = TextSvgOptions {}
- data TextType
- data TextFont
- = Lin2
- | FromFontFile Text
- textFont :: TextFont -> PreparedFont Double
- text_ :: TextOptions -> Text -> Chart b
- texts :: R2 r => TextOptions -> [(Text, r Double)] -> Chart b
- textChart :: Traversable f => [TextOptions] -> Rect Double -> Rect Double -> [f (Text, Pair Double)] -> Chart b
- textChart_ :: [TextOptions] -> Rect Double -> [[(Text, Pair Double)]] -> Chart b
- data LabelOptions = LabelOptions {
- text :: TextOptions
- orientation :: Pair Double
- gap :: Double
- labelled :: LabelOptions -> Text -> Chart b -> Chart b
Documentation
data TextOptions Source #
text options
TextOptions | |
|
newtype TextPathOptions Source #
options specific to text as an SVG path
text as a path or as svg text
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!"
Text can be either SVG text or text rendered as an SVG path. Text as SVG can be overridden by an opinionated browser. SVG Text not have a size, according to diagrams, and according to the svg standards for all I know. textSvg corrects for this by adding an approximately bounding rectangle so that size is forced.
text_SvgExample :: Chart b text_SvgExample = text_ (#textType .~ TextSvg (#textBox .~ def $ #svgFont .~ Just "Comic Sans MS" $ def) $ #size .~ 0.2 $ def) "abc & 0123 & POW!"
Text as an SVG path can use the fonts supplied in SVGFonts, follow the instructions there to make your own, or use the Hasklig font supplied in chart-unit.
text_PathExample :: Chart b text_PathExample = text_ (#textType .~ TextPath (#font .~ FromFontFile "other/Hasklig-Regular.svg" $ def) $ #size .~ 0.2 $ def) "0123 <*> <$> <| |> <> <- -> => ::"
texts :: R2 r => TextOptions -> [(Text, r Double)] -> Chart b Source #
Create positioned text from a list
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
ts :: [(Text, Pair Double)] ts = zip (map Text.singleton ['a' .. 'z']) [Pair (sin (x * 0.1)) x | x <- [0 .. 25]] 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
LabelOptions | |
|