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

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

Graphics.Rendering.Chart.Plot.Bars

Description

Bar Charts

Synopsis

- data PlotBars x y = PlotBars {
  - _plot_bars_style :: PlotBarsStyle
  - _plot_bars_item_styles :: [(FillStyle, Maybe LineStyle)]
  - _plot_bars_titles :: [String]
  - _plot_bars_spacing :: PlotBarsSpacing
  - _plot_bars_alignment :: PlotBarsAlignment
  - _plot_bars_reference :: y
  - _plot_bars_singleton_width :: Double
  - _plot_bars_values :: [(x, [y])]
  }
- data PlotBarsStyle
  - = BarsStacked
  - | BarsClustered
- data PlotBarsSpacing
  - = BarsFixWidth Double
  - | BarsFixGap Double Double
- data PlotBarsAlignment
  - = BarsLeft
  - | BarsCentered
  - | BarsRight
- class PlotValue a => BarsPlotValue a where
  - barsReference :: a
  - barsAdd :: a -> a -> a
- plotBars :: BarsPlotValue y => PlotBars x y -> Plot x y
- plot_bars_style :: forall x y. Lens' (PlotBars x y) PlotBarsStyle
- plot_bars_item_styles :: forall x y. Lens' (PlotBars x y) [(FillStyle, Maybe LineStyle)]
- plot_bars_titles :: forall x y. Lens' (PlotBars x y) [String]
- plot_bars_spacing :: forall x y. Lens' (PlotBars x y) PlotBarsSpacing
- plot_bars_alignment :: forall x y. Lens' (PlotBars x y) PlotBarsAlignment
- plot_bars_reference :: forall x y. Lens' (PlotBars x y) y
- plot_bars_singleton_width :: forall x y. Lens' (PlotBars x y) Double
- plot_bars_values :: forall x y x. Lens (PlotBars x y) (PlotBars x y) [(x, [y])] [(x, [y])]

# Documentation

data PlotBars x y Source #

Value describing how to plot a set of bars. Note that the input data is typed [(x,[y])], ie for each x value we plot several y values. Typically the size of each [y] list would be the same.

Constructors

PlotBars |

Fields

- _plot_bars_style :: PlotBarsStyle

  This value specifies whether each value from [y] should be shown beside or above the previous value.

- _plot_bars_item_styles :: [(FillStyle, Maybe LineStyle)]

  The style in which to draw each element of [y]. A fill style is required, and if a linestyle is given, each bar will be outlined.

- _plot_bars_titles :: [String]

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

- _plot_bars_spacing :: PlotBarsSpacing

  This value controls how the widths of the bars are calculated. Either the widths of the bars, or the gaps between them can be fixed.

- _plot_bars_alignment :: PlotBarsAlignment

  This value controls how bars for a fixed x are aligned with respect to the device coordinate corresponding to x.

- _plot_bars_reference :: y

  The starting level for the chart (normally 0).

- _plot_bars_singleton_width :: Double
- _plot_bars_values :: [(x, [y])]

  The actual points to be plotted.

#### Instances

Instances details

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

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

barsReference :: a Source #

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

#### Instances

Instances details

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

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

plot_bars_style :: forall x y. Lens' (PlotBars x y) PlotBarsStyle Source #

plot_bars_item_styles :: forall x y. Lens' (PlotBars x y) [(FillStyle, Maybe LineStyle)] Source #

plot_bars_titles :: forall x y. Lens' (PlotBars x y) [String] Source #

plot_bars_spacing :: forall x y. Lens' (PlotBars x y) PlotBarsSpacing Source #

plot_bars_alignment :: forall x y. Lens' (PlotBars x y) PlotBarsAlignment Source #

plot_bars_reference :: forall x y. Lens' (PlotBars x y) y Source #

plot_bars_singleton_width :: forall x y. Lens' (PlotBars x y) Double Source #

plot_bars_values :: forall x y x. Lens (PlotBars x y) (PlotBars x y) [(x, [y])] [(x, [y])] Source #