granite-0.7.4.0: Easy terminal plotting.
Copyright(c) 2025
LicenseMIT
Maintainermschavinda@gmail.com
Safe HaskellNone
LanguageGHC2021

Granite.Render.Chrome

Description

Backend-agnostic chart chrome: axes, title, legend. Each helper returns a list of primitive Marks.

Synopsis

Documentation

data PlotBox Source #

Pixel rectangle the chart body occupies, plus the overall scene bounds. Margins around the plot area host title, axis labels, legend.

Constructors

PlotBox 

Fields

Instances

Instances details
Show PlotBox Source # 
Instance details

Defined in Granite.Render.Chrome

Eq PlotBox Source # 
Instance details

Defined in Granite.Render.Chrome

Methods

(==) :: PlotBox -> PlotBox -> Bool #

(/=) :: PlotBox -> PlotBox -> Bool #

data Margins Source #

Inputs that grow the plot margins beyond the theme defaults. marExtraBottom enlarges the bottom margin (for rotated x-labels) and marLeftWanted requests a left margin (to fit long y-labels / the rotated labels' leftward reach); both fall back to the defaults when 0/small.

Instances

Instances details
Show Margins Source # 
Instance details

Defined in Granite.Render.Chrome

Eq Margins Source # 
Instance details

Defined in Granite.Render.Chrome

Methods

(==) :: Margins -> Margins -> Bool #

(/=) :: Margins -> Margins -> Bool #

data AxisLayout Source #

How the bottom (x) axis labels are laid out, plus the extra margins that choice needs. Decided exactly once per chart so margin sizing and the actual label rendering can never disagree (the bug when each recomputed the policy from a slightly different plot width). XLabelMode is threaded to axesMarks; alExtraBottom/alLeftWanted feed computePlotBox.

data XLabelMode Source #

What a panel's x-axis renderer should do. XFixed carries the chart-global decision verbatim (single panel). XLocalNoRotate lets a faceted panel pick upright/thin from its own width, but never rotate — rotation needs a per-cell margin reservation the facet layout doesn't make.

xModeNoRotate :: XLabelMode Source #

The mode for axes that never rotate their labels (polar; also the faceted default).

axisLayout :: Theme -> Size -> Bool -> Bool -> [Text] -> [Text] -> AxisLayout Source #

Decide the bottom-axis label policy and the margins it needs, in one pass. A wide left label grows the left margin (up to ~42% of the scene); rotated bottom labels also reach down (bottom margin) and left (left margin) by sin 45° of their width. Faceted charts never rotate, so they reserve no extra bottom margin.

domainLabels :: TrainedScale -> [Text] Source #

A trained scale's in-domain tick labels, in break order.