| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Write.Chart
Description
A renderer-independent description of a chart, made from a report.
This is to charts what Hledger.Write.Spreadsheet is to tables:
each chart-capable report has an adapter that turns its report data into a Chart,
choosing a useful default chart for that report (see doc/SPEC-charts.md, "Smart defaults"),
and renderers turn a Chart into text, SVG, CSV or JSON.
The model carries the report's own display information (period headings, account display names, commodity display styles, the report title) so that every renderer labels things exactly as the report's table would. Signs are already as the report shows them (eg normal-balance flipping done by bsiscf).
Values are kept exact here (Quantity); renderers convert them to Double only for drawing.
Synopsis
- data Chart = Chart {}
- data XAxis
- = XCategories [ChartLabel]
- | XPeriods [(DateSpan, Text)]
- | XDates [Day]
- data ChartLabel = ChartLabel {
- lbFull :: Text
- lbShort :: Text
- lbIndent :: Int
- lbType :: Maybe AccountType
- lbAccount :: Bool
- lbTipLines :: [Text]
- data Panel = Panel {}
- data BarLayout
- data Series = Series {
- seLabel :: ChartLabel
- seRole :: SeriesRole
- seMark :: Mark
- seValues :: [Maybe Quantity]
- seGroup :: Int
- seSign :: Int
- data SeriesRole
- data Mark
- data Summary = Summary {
- suKind :: SummaryKind
- suLabel :: Text
- suValue :: Amount
- data SummaryKind
- data Colour
- = TypeColour AccountType Int
- | IndexColour Int
- | LoneColour
- | NeutralColour
- | OtherColour (Maybe AccountType)
- | TotalColour
- seriesColours :: Colouring -> [Series] -> [Colour]
- data Colouring
- chartColouring :: Chart -> Colouring
- stableSlots :: Ord a => Int -> [(Text, a)] -> [Int]
- stableSlotsFavouringFirst :: Ord a => Double -> Int -> [(Text, a)] -> [Int]
- categoryTints :: [ChartLabel] -> [Maybe Quantity] -> [Int]
- seriesSize :: Series -> Quantity
- maxTints :: Int
- mainAccountType :: AccountType -> AccountType
- type SeriesValues = Array Int (Maybe Quantity)
- isContra :: Series -> Quantity -> Bool
- isHatched :: Series -> Quantity -> Bool
- hatchedSeries :: Series -> Bool
- legendListsSeries :: Bool -> [Series] -> Bool
- seriesValues :: Series -> SeriesValues
- valueAt :: SeriesValues -> Int -> Maybe Quantity
- setChartScales :: [Amount] -> Chart -> Chart
- chartWithoutTotalMarks :: Chart -> Chart
- setChartLayout :: Maybe BarLayout -> Chart -> Chart
- scaleSpans :: (Ord a, Fractional a) => a -> a -> a -> (a, a)
- chartAsCsv :: Chart -> CSV
- tests_Hledger_Write_Chart :: TestTree
Documentation
A chart: a title, an x axis, and one or more panels drawn against that x axis. Typically there is one panel per commodity. A chart with no panels, or whose panels have no series, has no data; renderers should say so, not fail.
Constructors
| Chart | |
Instances
| ToJSON Chart Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: Chart -> Encoding toJSONList :: [Chart] -> Value toEncodingList :: [Chart] -> Encoding | |||||
| Eq Chart Source # | |||||
| Generic Chart Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show Chart Source # | |||||
| type Rep Chart Source # | |||||
Defined in Hledger.Write.Chart type Rep Chart = D1 ('MetaData "Chart" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "Chart" 'PrefixI 'True) ((S1 ('MetaSel ('Just "chTitle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "chXAxis") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 XAxis)) :*: (S1 ('MetaSel ('Just "chPanels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Panel]) :*: S1 ('MetaSel ('Just "chNotes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))) | |||||
The x positions of a chart: what each value in a series corresponds to. Every series in the chart has one value per x position (renderers must not assume this, and should ignore extras).
Renderers choose orientation from this: periods and dates are drawn along a horizontal time axis in SVG, categories as horizontal bars. Text charts always draw one row per x position.
Constructors
| XCategories [ChartLabel] | unordered categories, eg the accounts of a single-period balance report |
| XPeriods [(DateSpan, Text)] | consecutive report periods, each with its heading as the report's table shows it |
| XDates [Day] | individual dates, possibly irregular and repeated, eg one per transaction in a register |
Instances
| ToJSON XAxis Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: XAxis -> Encoding toJSONList :: [XAxis] -> Value toEncodingList :: [XAxis] -> Encoding | |||||
| Eq XAxis Source # | |||||
| Generic XAxis Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show XAxis Source # | |||||
| type Rep XAxis Source # | |||||
Defined in Hledger.Write.Chart type Rep XAxis = D1 ('MetaData "XAxis" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "XCategories" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ChartLabel])) :+: (C1 ('MetaCons "XPeriods" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(DateSpan, Text)])) :+: C1 ('MetaCons "XDates" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Day])))) | |||||
data ChartLabel Source #
A name for a category or a series. For accounts this comes from the report's display name, so it follows the report's tree/flat mode and depth.
Constructors
| ChartLabel | |
Fields
| |
Instances
| ToJSON ChartLabel Source # | |||||
Defined in Hledger.Write.Chart Methods toJSON :: ChartLabel -> Value toEncoding :: ChartLabel -> Encoding toJSONList :: [ChartLabel] -> Value toEncodingList :: [ChartLabel] -> Encoding omitField :: ChartLabel -> Bool | |||||
| Eq ChartLabel Source # | |||||
Defined in Hledger.Write.Chart | |||||
| Generic ChartLabel Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show ChartLabel Source # | |||||
Defined in Hledger.Write.Chart Methods showsPrec :: Int -> ChartLabel -> ShowS show :: ChartLabel -> String showList :: [ChartLabel] -> ShowS | |||||
| type Rep ChartLabel Source # | |||||
Defined in Hledger.Write.Chart type Rep ChartLabel = D1 ('MetaData "ChartLabel" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "ChartLabel" 'PrefixI 'True) ((S1 ('MetaSel ('Just "lbFull") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "lbShort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "lbIndent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :*: (S1 ('MetaSel ('Just "lbType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe AccountType)) :*: (S1 ('MetaSel ('Just "lbAccount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "lbTipLines") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]))))) | |||||
One chart area with its own y axis, holding series of values in a single unit.
Constructors
| Panel | |
Fields
| |
Instances
| ToJSON Panel Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: Panel -> Encoding toJSONList :: [Panel] -> Value toEncodingList :: [Panel] -> Encoding | |||||
| Eq Panel Source # | |||||
| Generic Panel Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show Panel Source # | |||||
| type Rep Panel Source # | |||||
Defined in Hledger.Write.Chart type Rep Panel = D1 ('MetaData "Panel" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "Panel" 'PrefixI 'True) (((S1 ('MetaSel ('Just "pnUnit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Amount) :*: S1 ('MetaSel ('Just "pnSeries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Series])) :*: (S1 ('MetaSel ('Just "pnGroupNames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "pnScale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Quantity)))) :*: ((S1 ('MetaSel ('Just "pnLayout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BarLayout) :*: S1 ('MetaSel ('Just "pnCounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "pnSummary") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Summary]) :*: S1 ('MetaSel ('Just "pnValueLabels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Maybe Text]))))) | |||||
How to draw the bars of a panel whose series are in several groups (eg a compound report's sections).
Constructors
| Diverging | all groups stacked in one bar at each x position, positive values above (or right of) zero and negative ones below |
| Grouped | each group stacked in its own bar, the groups' bars side by side (in text, a row per group), with the total marked separately;
values are shown with their usual sign as positive (see |
Instances
| ToJSON BarLayout Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: BarLayout -> Encoding toJSONList :: [BarLayout] -> Value toEncodingList :: [BarLayout] -> Encoding | |||||
| Eq BarLayout Source # | |||||
| Generic BarLayout Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show BarLayout Source # | |||||
| type Rep BarLayout Source # | |||||
Defined in Hledger.Write.Chart type Rep BarLayout = D1 ('MetaData "BarLayout" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "Diverging" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Grouped" 'PrefixI 'False) (U1 :: Type -> Type)) | |||||
A named sequence of values, one per x position.
Constructors
| Series | |
Fields
| |
Instances
| ToJSON Series Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: Series -> Encoding toJSONList :: [Series] -> Value toEncodingList :: [Series] -> Encoding | |||||
| Eq Series Source # | |||||
| Generic Series Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show Series Source # | |||||
| type Rep Series Source # | |||||
Defined in Hledger.Write.Chart type Rep Series = D1 ('MetaData "Series" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "Series" 'PrefixI 'True) ((S1 ('MetaSel ('Just "seLabel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChartLabel) :*: (S1 ('MetaSel ('Just "seRole") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SeriesRole) :*: S1 ('MetaSel ('Just "seMark") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mark))) :*: (S1 ('MetaSel ('Just "seValues") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Maybe Quantity]) :*: (S1 ('MetaSel ('Just "seGroup") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "seSign") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))) | |||||
data SeriesRole Source #
What a series represents, which renderers may show differently (eg a muted colour for SeriesOther).
Constructors
| SeriesItem | an ordinary series, eg one account |
| SeriesOther | several items combined, eg "other (5 accounts)", to limit the number of series |
| SeriesTotal | a total of other series, eg the net total of stacked bars, or net worth |
| SeriesShortfall | an amount missing from what the bar stands for, eg the part of a holding's cost basis lost (beyond its value): drawn hatched, in its place in the stack |
| SeriesProvisional | an amount not yet final, eg an unrealised gain or loss: drawn hatched, in its place in the stack |
Instances
| ToJSON SeriesRole Source # | |||||
Defined in Hledger.Write.Chart Methods toJSON :: SeriesRole -> Value toEncoding :: SeriesRole -> Encoding toJSONList :: [SeriesRole] -> Value toEncodingList :: [SeriesRole] -> Encoding omitField :: SeriesRole -> Bool | |||||
| Eq SeriesRole Source # | |||||
Defined in Hledger.Write.Chart | |||||
| Generic SeriesRole Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show SeriesRole Source # | |||||
Defined in Hledger.Write.Chart Methods showsPrec :: Int -> SeriesRole -> ShowS show :: SeriesRole -> String showList :: [SeriesRole] -> ShowS | |||||
| type Rep SeriesRole Source # | |||||
Defined in Hledger.Write.Chart type Rep SeriesRole = D1 ('MetaData "SeriesRole" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) ((C1 ('MetaCons "SeriesItem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SeriesOther" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "SeriesTotal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SeriesShortfall" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SeriesProvisional" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
How a series is drawn.
Constructors
| MarkBar | a bar from zero to the value |
| MarkLine | a line joining the values (in text charts, drawn as bars) |
| MarkMarker | a marker at the value, not joined, eg a net total over stacked bars, or a budget goal |
| MarkNone | not drawn: values shown only as text (text charts' value column, tooltips, chart data), eg holdings' values, which their bars' solid parts reach already |
Instances
| ToJSON Mark Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: Mark -> Encoding toJSONList :: [Mark] -> Value toEncodingList :: [Mark] -> Encoding | |||||
| Eq Mark Source # | |||||
| Generic Mark Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show Mark Source # | |||||
| type Rep Mark Source # | |||||
Defined in Hledger.Write.Chart type Rep Mark = D1 ('MetaData "Mark" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) ((C1 ('MetaCons "MarkBar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MarkLine" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MarkMarker" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MarkNone" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
A value summarising a panel's values over the whole x axis, such as their total or their average.
Constructors
| Summary | |
Instances
| ToJSON Summary Source # | |||||
Defined in Hledger.Write.Chart Methods toEncoding :: Summary -> Encoding toJSONList :: [Summary] -> Value toEncodingList :: [Summary] -> Encoding | |||||
| Eq Summary Source # | |||||
| Generic Summary Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show Summary Source # | |||||
| type Rep Summary Source # | |||||
Defined in Hledger.Write.Chart type Rep Summary = D1 ('MetaData "Summary" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "Summary" 'PrefixI 'True) (S1 ('MetaSel ('Just "suKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SummaryKind) :*: (S1 ('MetaSel ('Just "suLabel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "suValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Amount)))) | |||||
data SummaryKind Source #
Constructors
| SummaryTotal | the total of all x positions' values |
| SummaryAverage | the average per x position, which SVG charts also draw as a line across the plot (with a legend entry) |
Instances
| ToJSON SummaryKind Source # | |||||
Defined in Hledger.Write.Chart Methods toJSON :: SummaryKind -> Value toEncoding :: SummaryKind -> Encoding toJSONList :: [SummaryKind] -> Value toEncodingList :: [SummaryKind] -> Encoding omitField :: SummaryKind -> Bool | |||||
| Eq SummaryKind Source # | |||||
Defined in Hledger.Write.Chart | |||||
| Generic SummaryKind Source # | |||||
Defined in Hledger.Write.Chart Associated Types
| |||||
| Show SummaryKind Source # | |||||
Defined in Hledger.Write.Chart Methods showsPrec :: Int -> SummaryKind -> ShowS show :: SummaryKind -> String showList :: [SummaryKind] -> ShowS | |||||
| type Rep SummaryKind Source # | |||||
Defined in Hledger.Write.Chart type Rep SummaryKind = D1 ('MetaData "SummaryKind" "Hledger.Write.Chart" "hledger-lib-2.0-5NBavNmBvhzFPKtDMBoaVJ" 'False) (C1 ('MetaCons "SummaryTotal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SummaryAverage" 'PrefixI 'False) (U1 :: Type -> Type)) | |||||
How a series (or a bar) is coloured, in a renderer-independent way.
Constructors
| TypeColour AccountType Int | the conventional hue of this main account type, in its Nth tint (to distinguish several of that type) |
| IndexColour Int | the Nth categorical colour, for series with no account type |
| LoneColour | a hue that no account type uses, for a chart's only series when it is not an account, or for an account of unknown type in a chart with one account per panel |
| NeutralColour | a neutral colour, eg for the contra amounts legend swatch |
| OtherColour (Maybe AccountType) | a muted colour, for a series combining several items: grey, tinged with their main account type's hue if any |
| TotalColour | the ink (text) colour, for a total |
seriesColours :: Colouring -> [Series] -> [Colour] Source #
Colours for a panel's series, in order, for the chart's colouring (see chartColouring).
Coloured by type, each account of known type gets its main type's hue, in one of several tints
(shared when there are more than maxTints of a type). Otherwise, and accounts of unknown type, get categorical colours;
except that a lone series which is not an account (eg a total, or "..." for all accounts), or a lone account of unknown type
in a chart of single accounts, gets a hue that no account type uses.
The tints and categorical colours are chosen by the series' names, not their positions or number (see stableSlots),
so that an account keeps its colour in other charts: eg after removing other accounts (even down to just one), or sorting differently.
A series of known type which is not an account (eg a holding's cost or gain) has its type's first tint,
so that its colour doesn't depend on its name (which may be translated).
How a chart's accounts are coloured (decided for the whole chart, so that colours mean the same in all of its panels).
Constructors
| ByName | in distinct colours chosen by name, to tell them apart: when none has a known type |
| ByType | by main account type (in tints chosen by name): when any has a known type, even if all are of one type, so that a type's hue means the same in every chart, and an account keeps its colour in other charts |
| Single | by type, or if unknown in the lone colour: when each panel shows just one account, so there is nothing to tell apart |
Instances
chartColouring :: Chart -> Colouring Source #
How this chart's accounts should be coloured: considering all of its panels, so that eg in a balance sheet, a commodity's panel with just one asset account shows it in the assets' hue, like the other panels.
stableSlots :: Ord a => Int -> [(Text, a)] -> [Int] Source #
Give each of these names one of n slots (0 to n-1), chosen by the name rather than its position, so that a name tends to get the same slot in other lists: eg a colour that stays with an account in successive charts. Each name has its own order of preference for the slots (from a hash of it), and gets the first one still free. The names choose in order of their sizes (largest first; then by name), so that adding or removing small items (or removing the largest) disturbs few others; positions don't matter. When there are more names than slots, slots are shared: once all are taken, the names choose among them all again.
stableSlotsFavouringFirst :: Ord a => Double -> Int -> [(Text, a)] -> [Int] Source #
Like stableSlots, but with each name's preferences biased towards the first slots, by this much
(0: not at all; 1: fully, so that every name has the same order of preference).
Eg with 0.5, the last of 4 slots is never a name's first choice, and the first is its first choice most often.
categoryTints :: [ChartLabel] -> [Maybe Quantity] -> [Int] Source #
A tint for each of these categories (eg a single-period chart's accounts, with their values), chosen by name
among the categories of the same main account type, as seriesColours chooses them for series:
so that accounts of one type can be told apart, and tend to keep their tints in a multi-period chart.
seriesSize :: Series -> Quantity Source #
A series' size, for ranking: the sum of its absolute values.
How many tints of a type's colour renderers provide, to distinguish several accounts of one type.
mainAccountType :: AccountType -> AccountType Source #
The main account type (asset, liability, equity, revenue or expense) of an account type, which is one of those or a subtype of one.
type SeriesValues = Array Int (Maybe Quantity) Source #
A series' values, indexed by x position, for fast lookup by renderers.
isContra :: Series -> Quantity -> Bool Source #
Is this value of the series a contra amount (of the opposite sign to the series' usual sign) ?
isHatched :: Series -> Quantity -> Bool Source #
Is this value of the series drawn hatched ? Contra amounts are, and the values of hatched series (see hatchedSeries).
hatchedSeries :: Series -> Bool Source #
Is this series drawn hatched throughout, in its colour (and so shown hatched in legends) ?
Shortfalls and provisional amounts are (see SeriesShortfall, SeriesProvisional).
legendListsSeries :: Bool -> [Series] -> Bool Source #
Should a legend list these drawn series (on a category axis, or not) ? Yes when there are several, or one is an "other" series (whose muted colour needs explaining), or a lone series names an account on a time axis (where nothing else would name it). A lone series on a category axis is not listed: its bars are labelled on the axis, and coloured by category.
seriesValues :: Series -> SeriesValues Source #
valueAt :: SeriesValues -> Int -> Maybe Quantity Source #
The value at this x position, if there is one.
setChartScales :: [Amount] -> Chart -> Chart Source #
Give each panel a fixed scale (see pnScale): the absolute quantity of the scale amount in the panel's commodity,
or else of the one with no commodity symbol. When several are in the same commodity, the last one is used.
chartWithoutTotalMarks :: Chart -> Chart Source #
Don't draw the totals (or nets): give each panel's total series no mark (MarkNone),
so that it is still shown as values where those are shown (eg in tooltips), but not drawn.
setChartLayout :: Maybe BarLayout -> Chart -> Chart Source #
Set the bar layout of every panel to this one, if given (otherwise keeping each panel's own), and prepare the panels for it. This should be applied before drawing a chart, or showing its data. The grouped layout is for comparing the groups' sizes, so its series are shown with their usual sign as positive (eg expenses as well as revenues upward, like a compound report's tables), and their contra amounts as negative. (Applying this again does nothing more, since those series' usual sign is then positive.) And since only bars can be side by side, in a panel with several groups, series drawn as lines (eg end balances) become bars. Its series are put in their groups' order.
scaleSpans :: (Ord a, Fractional a) => a -> a -> a -> (a, a) Source #
With a fixed scale (the amount that a chart spans), and the largest positive and (absolute) negative extents of the values, how much of the scale is given to each direction: (above or right of zero, below or left of zero). Negative values get the room they need and positive values the rest (all of it if there are no negative values; if there are only negative values, they get all of it). If the values don't fit, both directions are shrunk in proportion, and the values beyond them will be clipped.
chartAsCsv :: Chart -> CSV Source #
Render a chart's data as CSV (or TSV) records, in long ("tidy") form: one record per value, with a header record. This shows exactly what the chart shows, after any combining of series, and can be charted with other tools.
Values are shown with the panel unit's display precision, without commodity symbol or digit group marks.
A gap (no value) is shown as an empty field.
Each panel's summary values (see pnSummary) follow its series, with role "rowtotal" or "average", and no mark or x.