Chart-1.9.5: A library for generating 2D Charts and Plots

Copyright | (c) Tim Docker 2006 2014
License | BSD-style (see chart/COPYRIGHT)
Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Chart.Plot.Bars

Description

Bar Charts

Synopsis

- data PlotBars x y = PlotBars {
  - _plot_bars_settings :: BarsSettings
  - _plot_bars_titles :: [String]
  - _plot_bars_values_with_labels :: [(x, [(y, String)])]
  }
- data PlotBarsStyle
  - = BarsStacked
  - | BarsClustered
- data PlotBarsSpacing
  - = BarsFixWidth Double
  - | BarsFixGap Double Double
- data PlotBarsAlignment
  - = BarsLeft
  - | BarsCentered
  - | BarsRight
- class PlotValue a => BarsPlotValue a where
  - barsIsNull :: a -> Bool
  - barsReference :: [a] -> a
  - barsAdd :: a -> a -> a
- data BarHorizAnchor
  - = BHA_Left
  - | BHA_Centre
  - | BHA_Right
- data BarVertAnchor
  - = BVA_Bottom
  - | BVA_Centre
  - | BVA_Top
- plotBars :: BarsPlotValue y => PlotBars x y -> Plot x y
- plotHBars :: BarsPlotValue x => PlotBars y x -> Plot x y
- plot_bars_style :: forall x y f. Functor f => (PlotBarsStyle -> f PlotBarsStyle) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_item_styles :: forall x y f. Functor f => ([(FillStyle, Maybe LineStyle)] -> f [(FillStyle, Maybe LineStyle)]) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_titles :: forall x y f. Functor f => ([String] -> f [String]) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_spacing :: forall x y f. Functor f => (PlotBarsSpacing -> f PlotBarsSpacing) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_alignment :: forall x y f. Functor f => (PlotBarsAlignment -> f PlotBarsAlignment) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_singleton_width :: forall x y f. Functor f => (Double -> f Double) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_bar_hanchor :: forall x y f. Functor f => (BarHorizAnchor -> f BarHorizAnchor) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_bar_vanchor :: forall x y f. Functor f => (BarVertAnchor -> f BarVertAnchor) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_text_hanchor :: forall x y f. Functor f => (HTextAnchor -> f HTextAnchor) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_text_vanchor :: forall x y f. Functor f => (VTextAnchor -> f VTextAnchor) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_angle :: forall x y f. Functor f => (Double -> f Double) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_style :: forall x y f. Functor f => (FontStyle -> f FontStyle) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_label_offset :: forall x y f. Functor f => (Vector -> f Vector) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_values :: forall x y f. Functor f => ([(x, [y])] -> f [(x, [y])]) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_settings :: forall x y f. Functor f => (BarsSettings -> f BarsSettings) -> PlotBars x y -> f (PlotBars x y)
- plot_bars_values_with_labels :: forall x1 y1 x2 y2 f. Functor f => ([(x1, [(y1, String)])] -> f [(x2, [(y2, String)])]) -> PlotBars x1 y1 -> f (PlotBars x2 y2)
- addLabels :: Show y => [(x, [y])] -> [(x, [(y, String)])]

# Documentation

data PlotBars x y Source #

Constructors

PlotBars |

Fields

- _plot_bars_settings :: BarsSettings
- _plot_bars_titles :: [String]

  The title of each element of [y]. These will be shown in the legend.

- _plot_bars_values_with_labels :: [(x, [(y, String)])]

  The actual points to be plotted, and their labels

#### Instances

Instances details

Default (PlotBars x y) Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods def :: PlotBars x y #

data PlotBarsStyle Source #

Constructors

BarsStacked | Bars for a fixed x are stacked vertically on top of each other.
BarsClustered | Bars for a fixed x are put horizontally beside each other.

#### Instances

Instances details

Show PlotBarsStyle Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods showsPrec :: Int -> PlotBarsStyle -> ShowS Source # show :: PlotBarsStyle -> String Source # showList :: [PlotBarsStyle] -> ShowS Source #

data PlotBarsSpacing Source #

Constructors

BarsFixWidth Double | All bars have the same width in pixels.
BarsFixGap Double Double | (BarsFixGap g mw) means make the gaps between the bars equal to g, but with a minimum bar width of mw

#### Instances

Instances details

Show PlotBarsSpacing Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods showsPrec :: Int -> PlotBarsSpacing -> ShowS Source # show :: PlotBarsSpacing -> String Source # showList :: [PlotBarsSpacing] -> ShowS Source #

data PlotBarsAlignment Source #

How bars for a given (x,[y]) are aligned with respect to screen coordinate corresponding to x (deviceX).

Constructors

BarsLeft | The left edge of bars is at deviceX
BarsCentered | Bars are centered around deviceX
BarsRight | The right edge of bars is at deviceX

#### Instances

Instances details

Show PlotBarsAlignment Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods showsPrec :: Int -> PlotBarsAlignment -> ShowS Source # show :: PlotBarsAlignment -> String Source # showList :: [PlotBarsAlignment] -> ShowS Source #

class PlotValue a => BarsPlotValue a where Source #

Methods

barsIsNull :: a -> Bool Source #

barsReference :: [a] -> a Source #

The starting level for the chart, a function of some statistic (normally the lowest value or just const 0).

barsAdd :: a -> a -> a Source #

#### Instances

Instances details

BarsPlotValue LogValue Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods barsIsNull :: LogValue -> Bool Source # barsReference :: [LogValue] -> LogValue Source # barsAdd :: LogValue -> LogValue -> LogValue Source #
BarsPlotValue Double Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods barsIsNull :: Double -> Bool Source # barsReference :: [Double] -> Double Source # barsAdd :: Double -> Double -> Double Source #
BarsPlotValue Int Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods barsIsNull :: Int -> Bool Source # barsReference :: [Int] -> Int Source # barsAdd :: Int -> Int -> Int Source #

data BarHorizAnchor Source #

Constructors

BHA_Left |
BHA_Centre |
BHA_Right |

#### Instances

Instances details

Show BarHorizAnchor Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods showsPrec :: Int -> BarHorizAnchor -> ShowS Source # show :: BarHorizAnchor -> String Source # showList :: [BarHorizAnchor] -> ShowS Source #

data BarVertAnchor Source #

Constructors

BVA_Bottom |
BVA_Centre |
BVA_Top |

#### Instances

Instances details

Show BarVertAnchor Source # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Bars Methods showsPrec :: Int -> BarVertAnchor -> ShowS Source # show :: BarVertAnchor -> String Source # showList :: [BarVertAnchor] -> ShowS Source #

plotBars :: BarsPlotValue y => PlotBars x y -> Plot x y Source #

plotHBars :: BarsPlotValue x => PlotBars y x -> Plot x y Source #

plot_bars_style :: forall x y f. Functor f => (PlotBarsStyle -> f PlotBarsStyle) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_item_styles :: forall x y f. Functor f => ([(FillStyle, Maybe LineStyle)] -> f [(FillStyle, Maybe LineStyle)]) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_titles :: forall x y f. Functor f => ([String] -> f [String]) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_spacing :: forall x y f. Functor f => (PlotBarsSpacing -> f PlotBarsSpacing) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_alignment :: forall x y f. Functor f => (PlotBarsAlignment -> f PlotBarsAlignment) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_singleton_width :: forall x y f. Functor f => (Double -> f Double) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_bar_hanchor :: forall x y f. Functor f => (BarHorizAnchor -> f BarHorizAnchor) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_bar_vanchor :: forall x y f. Functor f => (BarVertAnchor -> f BarVertAnchor) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_text_hanchor :: forall x y f. Functor f => (HTextAnchor -> f HTextAnchor) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_text_vanchor :: forall x y f. Functor f => (VTextAnchor -> f VTextAnchor) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_angle :: forall x y f. Functor f => (Double -> f Double) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_style :: forall x y f. Functor f => (FontStyle -> f FontStyle) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_label_offset :: forall x y f. Functor f => (Vector -> f Vector) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_values :: forall x y f. Functor f => ([(x, [y])] -> f [(x, [y])]) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_settings :: forall x y f. Functor f => (BarsSettings -> f BarsSettings) -> PlotBars x y -> f (PlotBars x y) Source #

plot_bars_values_with_labels :: forall x1 y1 x2 y2 f. Functor f => ([(x1, [(y1, String)])] -> f [(x2, [(y2, String)])]) -> PlotBars x1 y1 -> f (PlotBars x2 y2) Source #

addLabels :: Show y => [(x, [y])] -> [(x, [(y, String)])] Source #