nano-ui-diagrams: Charts and diagrams-lib drawings for nano-ui

[ graphics, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

Places diagrams-lib drawings in nano-ui layouts and builds line, bar, scatter, area, and step charts with axes, legends, and hover lookup.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.20 && <4.23), colour (>=2.3.3 && <2.4), containers (>=0.6.7 && <0.9), diagrams-core (>=1.5 && <1.6), diagrams-lib (>=1.4.6 && <1.7), dlist (>=1.0 && <1.1), effectful-core (>=2.5 && <2.8), hashable (>=1.4 && <1.6), lens (>=5.0 && <5.4), nano-ui (>=0.1 && <0.2), primitive (>=0.8 && <0.10), text (>=2.0 && <2.2), vector (>=0.13 && <0.14) [details]
Tested with ghc ==9.10.3 || ==9.14.1
License MIT
Author goolord
Maintainer zacharyachurchill@gmail.com
Uploaded by goolord at 2026-09-17T17:02:34Z
Category Graphics
Home page https://github.com/goolord/nano-ui
Bug tracker https://github.com/goolord/nano-ui/issues
Source repo head: git clone https://github.com/goolord/nano-ui.git(packages/nano-ui-diagrams)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for nano-ui-diagrams-0.1.0.0

[back to package description]

nano-ui-diagrams

Charts and diagrams drawings for nano-ui.

diagram places a diagrams-lib Diagram in a nano-ui layout. NanoUI.Plot builds line, bar, scatter, area, and step charts with axes, legends, and hover lookup, and thins out long series before drawing them.

{-# LANGUAGE OverloadedStrings #-}

import Data.Text qualified as T
import NanoUI
import NanoUI.Plot

temperatures :: Chart
temperatures =
  withTitle "Temperature" . withLegend LegendBottom $
    chart
      [ line "Indoor" [(0, 20), (1, 21.5), (2, 22), (3, 21)]
      , line "Outdoor" [(0, 8), (1, 11), (2, 14), (3, 12)]
      ]

view :: NanoUI ()
view = column $ do
  resp <- plot (minH 240 . fillW) temperatures
  case plotHover resp of
    Just h -> label (T.pack (show (hoverDataX h, hoverDataY h)))
    Nothing -> pure ()

The Plots tab of nano-ui-sdl-demo in nano-ui-demo shows more charts and a diagram.