-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A library for generating 2D Charts and Plots
--   
--   A library for generating 2D Charts and Plots, based upon the cairo
--   graphics library.
@package Chart
@version 0.16


-- | This module contains basic types and functions used for drawing.
--   
--   Note that template haskell is used to derive accessor functions (see
--   <a>Accessor</a>) for each field of the following data types:
--   
--   <ul>
--   <li><a>CairoLineStyle</a></li>
--   <li><a>CairoFontStyle</a></li>
--   </ul>
--   
--   These accessors are not shown in this API documentation. They have the
--   same name as the field, but with the trailing underscore dropped.
--   Hence for data field f_::F in type D, they have type
--   
--   <pre>
--   f :: Data.Accessor.Accessor D F
--   </pre>
module Graphics.Rendering.Chart.Types

-- | A rectangle is defined by two points.
data Rect
Rect :: Point -> Point -> Rect

-- | A point in two dimensions.
data Point
Point :: Double -> Double -> Point
p_x :: Point -> Double
p_y :: Point -> Double
data Vector
Vector :: Double -> Double -> Vector
v_x :: Vector -> Double
v_y :: Vector -> Double
type RectSize = (Double, Double)
type Range = (Double, Double)

-- | Create a rectangle based upon the coordinates of 4 points.
mkrect :: Point -> Point -> Point -> Point -> Rect

-- | Add a point and a vector.
pvadd :: Point -> Vector -> Point

-- | Subtract a vector from a point.
pvsub :: Point -> Vector -> Point

-- | Subtract two points.
psub :: Point -> Point -> Vector

-- | Scale a vector by a constant.
vscale :: Double -> Vector -> Vector

-- | Test if a point is within a rectangle.
within :: Point -> Rect -> Bool
data RectEdge
E_Top :: RectEdge
E_Bottom :: RectEdge
E_Left :: RectEdge
E_Right :: RectEdge
data Limit a
LMin :: Limit a
LValue :: a -> Limit a
LMax :: Limit a

-- | A function mapping between points.
type PointMapFn x y = (Limit x, Limit y) -> Point

-- | Execute a rendering action in a saved context (ie bracketed between
--   C.save and C.restore).
preserveCState :: CRender a -> CRender a
setClipRegion :: Point -> Point -> CRender ()
moveTo :: Point -> CRender ()
lineTo :: Point -> CRender ()

-- | Make a path from a rectangle.
rectPath :: Rect -> [Point]

-- | Draw lines between the specified points.
--   
--   The points will be <a>corrected</a> by the cenv_point_alignfn, so that
--   when drawing bitmaps, 1 pixel wide lines will be centred on the
--   pixels.
strokePath :: [Point] -> CRender ()

-- | Fill the region with the given corners.
--   
--   The points will be <a>corrected</a> by the cenv_coord_alignfn, so that
--   when drawing bitmaps, the edges of the region will fall between
--   pixels.
fillPath :: [Point] -> CRender ()
isValidNumber :: RealFloat a => a -> Bool
maybeM :: Monad m => b -> (a -> m b) -> Maybe a -> m b
defaultColorSeq :: [AlphaColour Double]
setSourceColor :: AlphaColour Double -> Render ()

-- | Data type for the style of a line.
data CairoLineStyle
CairoLineStyle :: Double -> AlphaColour Double -> [Double] -> LineCap -> LineJoin -> CairoLineStyle
line_width_ :: CairoLineStyle -> Double
line_color_ :: CairoLineStyle -> AlphaColour Double
line_dashes_ :: CairoLineStyle -> [Double]
line_cap_ :: CairoLineStyle -> LineCap
line_join_ :: CairoLineStyle -> LineJoin
solidLine :: Double -> AlphaColour Double -> CairoLineStyle
dashedLine :: Double -> [Double] -> AlphaColour Double -> CairoLineStyle
setLineStyle :: CairoLineStyle -> CRender ()

-- | Abstract data type for a fill style.
--   
--   The contained Cairo action sets the required fill style in the Cairo
--   rendering state.
newtype CairoFillStyle
CairoFillStyle :: (CRender ()) -> CairoFillStyle
defaultPointStyle :: CairoPointStyle
solidFillStyle :: AlphaColour Double -> CairoFillStyle
setFillStyle :: CairoFillStyle -> CRender ()

-- | Data type for a font.
data CairoFontStyle
CairoFontStyle :: String -> Double -> FontSlant -> FontWeight -> AlphaColour Double -> CairoFontStyle
font_name_ :: CairoFontStyle -> String
font_size_ :: CairoFontStyle -> Double
font_slant_ :: CairoFontStyle -> FontSlant
font_weight_ :: CairoFontStyle -> FontWeight
font_color_ :: CairoFontStyle -> AlphaColour Double
defaultFontStyle :: CairoFontStyle
setFontStyle :: CairoFontStyle -> CRender ()

-- | Abstract data type for the style of a plotted point.
--   
--   The contained Cairo action draws a point in the desired style, at the
--   supplied device coordinates.
newtype CairoPointStyle
CairoPointStyle :: (Point -> CRender ()) -> CairoPointStyle
filledPolygon :: Double -> Int -> Bool -> AlphaColour Double -> CairoPointStyle
hollowPolygon :: Double -> Double -> Int -> Bool -> AlphaColour Double -> CairoPointStyle
filledCircles :: Double -> AlphaColour Double -> CairoPointStyle
hollowCircles :: Double -> Double -> AlphaColour Double -> CairoPointStyle
plusses :: Double -> Double -> AlphaColour Double -> CairoPointStyle
exes :: Double -> Double -> AlphaColour Double -> CairoPointStyle
stars :: Double -> Double -> AlphaColour Double -> CairoPointStyle
data HTextAnchor
HTA_Left :: HTextAnchor
HTA_Centre :: HTextAnchor
HTA_Right :: HTextAnchor
data VTextAnchor
VTA_Top :: VTextAnchor
VTA_Centre :: VTextAnchor
VTA_Bottom :: VTextAnchor
VTA_BaseLine :: VTextAnchor

-- | Function to draw a textual label anchored by one of its corners or
--   edges.
drawText :: HTextAnchor -> VTextAnchor -> Point -> String -> CRender ()

-- | Function to draw a textual label anchored by one of its corners or
--   edges, with rotation. Rotation angle is given in degrees, rotation is
--   performed around anchor point.
drawTextR :: HTextAnchor -> VTextAnchor -> Double -> Point -> String -> CRender ()

-- | Function to draw a multi-line textual label anchored by one of its
--   corners or edges, with rotation. Rotation angle is given in degrees,
--   rotation is performed around anchor point.
drawTextsR :: HTextAnchor -> VTextAnchor -> Double -> Point -> String -> CRender ()

-- | Return the bounding rectangle for a text string rendered in the
--   current context.
textSize :: String -> CRender RectSize

-- | Recturn the bounding rectangle for a text string positioned where it
--   would be drawn by drawText
textDrawRect :: HTextAnchor -> VTextAnchor -> Point -> String -> CRender Rect

-- | The reader monad containing context information to control the
--   rendering process.
newtype CRender a
DR :: (ReaderT CEnv Render a) -> CRender a

-- | The environment present in the CRender Monad.
data CEnv
CEnv :: (Point -> Point) -> (Point -> Point) -> CEnv

-- | An adjustment applied immediately prior to points being displayed in
--   device coordinates.
--   
--   When device coordinates correspond to pixels, a cleaner image is
--   created if this transform rounds to the nearest pixel. With
--   higher-resolution output, this transform can just be the identity
--   function.
cenv_point_alignfn :: CEnv -> Point -> Point

-- | A adjustment applied immediately prior to coordinates being
--   transformed.
cenv_coord_alignfn :: CEnv -> Point -> Point
runCRender :: CRender a -> CEnv -> Render a
c :: Render a -> CRender a
alignp :: Point -> CRender Point
alignc :: Point -> CRender Point
line_width :: T CairoLineStyle Double
line_color :: T CairoLineStyle (AlphaColour Double)
line_dashes :: T CairoLineStyle [Double]
line_cap :: T CairoLineStyle LineCap
line_join :: T CairoLineStyle LineJoin
font_name :: T CairoFontStyle String
font_size :: T CairoFontStyle Double
font_slant :: T CairoFontStyle FontSlant
font_weight :: T CairoFontStyle FontWeight
font_color :: T CairoFontStyle (AlphaColour Double)
instance Show Point
instance Show Vector
instance Show a => Show (Limit a)
instance Show Rect
instance Functor CRender
instance Monad CRender
instance MonadReader CEnv CRender


-- | This module contains the definition of the <a>Renderable</a> type,
--   which is a composable drawing element, along with assorted functions
--   to them.
module Graphics.Rendering.Chart.Renderable

-- | A Renderable is a record of functions required to layout a graphic
--   element.
data Renderable a
Renderable :: CRender RectSize -> (RectSize -> CRender (PickFn a)) -> Renderable a

-- | A Cairo action to calculate a minimum size.
minsize :: Renderable a -> CRender RectSize

-- | A Cairo action for drawing it within a rectangle. The rectangle is
--   from the origin to the given point.
--   
--   The resulting <a>pick</a> function maps a point in the image to a
--   value.
render :: Renderable a -> RectSize -> CRender (PickFn a)

-- | A type class abtracting the conversion of a value to a Renderable.
class ToRenderable a
toRenderable :: ToRenderable a => a -> Renderable ()

-- | A function that maps a point in device coordinates to some value.
--   
--   Perhaps it might be generalised from Maybe a to (MonadPlus m ) =&gt; m
--   a in the future.
type PickFn a = Point -> (Maybe a)

-- | Output the given renderable to a PNG file of the specifed size (in
--   pixels), to the specified file.
renderableToPNGFile :: Renderable a -> Int -> Int -> FilePath -> IO (PickFn a)

-- | Output the given renderable to a PDF file of the specifed size (in
--   points), to the specified file.
renderableToPDFFile :: Renderable a -> Int -> Int -> FilePath -> IO ()

-- | Output the given renderable to a postscript file of the specifed size
--   (in points), to the specified file.
renderableToPSFile :: Renderable a -> Int -> Int -> FilePath -> IO ()

-- | Output the given renderable to an SVG file of the specifed size (in
--   points), to the specified file.
renderableToSVGFile :: Renderable a -> Int -> Int -> FilePath -> IO ()
vectorEnv :: CEnv
bitmapEnv :: CEnv

-- | Overlay a renderable over a solid background fill.
fillBackground :: CairoFillStyle -> Renderable a -> Renderable a

-- | Add some spacing at the edges of a renderable.
addMargins :: (Double, Double, Double, Double) -> Renderable a -> Renderable a
emptyRenderable :: Renderable a

-- | Helper function for using a renderable, when we generate it in the
--   CRender monad.
embedRenderable :: CRender (Renderable a) -> Renderable a

-- | Construct a renderable from a text string, aligned with the axes.
label :: CairoFontStyle -> HTextAnchor -> VTextAnchor -> String -> Renderable String

-- | Construct a renderable from a text string, rotated wrt to axes. The
--   angle of rotation is in degrees.
rlabel :: CairoFontStyle -> HTextAnchor -> VTextAnchor -> Double -> String -> Renderable String

-- | Create a blank renderable with a specified minimum size.
spacer :: RectSize -> Renderable a

-- | Create a blank renderable with a minimum size the same as some other
--   renderable.
spacer1 :: Renderable a -> Renderable b

-- | Replace the pick function of a renderable with another.
setPickFn :: PickFn b -> Renderable a -> Renderable b

-- | Map a function over the result of a renderable's pickfunction, keeping
--   only <a>Just</a> results.
mapMaybePickFn :: (a -> Maybe b) -> Renderable a -> Renderable b

-- | Map a function over result of a renderable's pickfunction.
mapPickFn :: (a -> b) -> Renderable a -> Renderable b
nullPickFn :: PickFn a

-- | Accessor for field rect_minsize_.
rect_minsize :: Accessor Rectangle RectSize

-- | Accessor for field rect_fillStyle_.
rect_fillStyle :: Accessor Rectangle (Maybe CairoFillStyle)

-- | Accessor for field rect_lineStyle_.
rect_lineStyle :: Accessor Rectangle (Maybe CairoLineStyle)

-- | Accessor for field rect_cornerStyle_.
rect_cornerStyle :: Accessor Rectangle RectCornerStyle
instance ToRenderable Rectangle


-- | Type definitions for Axes
module Graphics.Rendering.Chart.Axis.Types

-- | The basic data associated with an axis showing values of type x.
data AxisData x
AxisData :: (Range -> x -> Double) -> (Range -> Double -> x) -> [(x, Double)] -> [[(x, String)]] -> [x] -> AxisData x

-- | The axis_viewport_ function maps values into device coordinates.
axis_viewport_ :: AxisData x -> Range -> x -> Double

-- | The axis_tropweiv_ function maps device coordinates back to values.
axis_tropweiv_ :: AxisData x -> Range -> Double -> x

-- | The tick marks on the axis as pairs. The first element is the position
--   on the axis (in viewport units) and the second element is the length
--   of the tick in output coordinates. The tick starts on the axis, and
--   positive numbers are drawn towards the plot area.
axis_ticks_ :: AxisData x -> [(x, Double)]

-- | The labels on an axis as pairs. The first element of the pair is the
--   position on the axis (in viewport units) and the second is the label
--   text string. Note that multiple sets of labels can be specified, and
--   are shown successively further away from the axis line.
axis_labels_ :: AxisData x -> [[(x, String)]]

-- | The positions on the axis (in viewport units) where we want to show
--   grid lines.
axis_grid_ :: AxisData x -> [x]

-- | Collect the information we need to render an axis. The bool is true if
--   the axis direction is reversed.
data AxisT x
AxisT :: RectEdge -> AxisStyle -> Bool -> (AxisData x) -> AxisT x

-- | Control values for how an axis gets displayed.
data AxisStyle
AxisStyle :: CairoLineStyle -> CairoFontStyle -> CairoLineStyle -> Double -> AxisStyle
axis_line_style_ :: AxisStyle -> CairoLineStyle
axis_label_style_ :: AxisStyle -> CairoFontStyle
axis_grid_style_ :: AxisStyle -> CairoLineStyle

-- | How far the labels are to be drawn from the axis.
axis_label_gap_ :: AxisStyle -> Double

-- | A typeclass abstracting the functions we need to be able to plot
--   against an axis of type a
class Ord a => PlotValue a
toValue :: PlotValue a => a -> Double
fromValue :: PlotValue a => Double -> a
autoAxis :: PlotValue a => AxisFn a

-- | A function to generate the axis data, given the data values to be
--   plotted against it.
type AxisFn x = [x] -> AxisData x
defaultAxisLineStyle :: CairoLineStyle
defaultAxisStyle :: AxisStyle
defaultGridLineStyle :: CairoLineStyle

-- | Construct an axis given the positions for ticks, grid lines, and
--   labels, and the labelling function
makeAxis :: PlotValue x => (x -> String) -> ([x], [x], [x]) -> AxisData x

-- | Construct an axis given the positions for ticks, grid lines, and
--   labels, and the positioning and labelling functions
makeAxis' :: Ord x => (x -> Double) -> (Double -> x) -> (x -> String) -> ([x], [x], [x]) -> AxisData x

-- | Construct a renderable from an axis, in order that it can be composed
--   with other renderables and drawn. This does not include the drawing of
--   the grid, which must be done separately by the <a>renderAxisGrid</a>
--   function.
axisToRenderable :: AxisT x -> Renderable x
renderAxisGrid :: RectSize -> AxisT z -> CRender ()

-- | Calculate the amount by which the labels extend beyond the ends of the
--   axis.
axisOverhang :: Ord x => AxisT x -> CRender (Double, Double)

-- | A linear mapping of points in one range to another.
vmap :: PlotValue x => (x, x) -> Range -> x -> Double

-- | The inverse mapping from device co-ordinate range back to interesting
--   values.
invmap :: PlotValue x => (x, x) -> Range -> Double -> x

-- | A linear mapping of points in one range to another.
linMap :: (a -> Double) -> (a, a) -> Range -> a -> Double

-- | An inverse linear mapping of points from one range to another.
invLinMap :: (Double -> a) -> (a -> Double) -> (a, a) -> Range -> Double -> a

-- | Modifier to position grid lines to line up with the ticks
axisGridAtTicks :: AxisData x -> AxisData x

-- | Modifier to position grid lines to line up with only the major ticks
axisGridAtBigTicks :: AxisData x -> AxisData x

-- | Modifier to position grid lines to line up with the labels
axisGridAtLabels :: AxisData x -> AxisData x

-- | Modifier to remove grid lines from an axis
axisGridHide :: AxisData x -> AxisData x

-- | Modifier to remove ticks from an axis
axisTicksHide :: AxisData x -> AxisData x

-- | Modifier to remove labels from an axis
axisLabelsHide :: AxisData x -> AxisData x

-- | Modifier to change labels on an axis
axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData x
axis_viewport :: T (AxisData x_ahtV) (Range -> x_ahtV -> Double)
axis_tropweiv :: T (AxisData x_ahtV) (Range -> Double -> x_ahtV)
axis_ticks :: T (AxisData x_ahtV) [(x_ahtV, Double)]
axis_labels :: T (AxisData x_ahtV) [[(x_ahtV, String)]]
axis_grid :: T (AxisData x_ahtV) [x_ahtV]
axis_line_style :: T AxisStyle CairoLineStyle
axis_label_style :: T AxisStyle CairoFontStyle
axis_grid_style :: T AxisStyle CairoLineStyle
axis_label_gap :: T AxisStyle Double


-- | Calculate and render unit indexed axes
module Graphics.Rendering.Chart.Axis.Unit
unitAxis :: AxisData ()
instance PlotValue ()


-- | Calculate and render indexed axes
module Graphics.Rendering.Chart.Axis.Indexed

-- | Type for capturing values plotted by index number (ie position in a
--   list) rather than a numerical value.
newtype PlotIndex
PlotIndex :: Int -> PlotIndex
plotindex_i :: PlotIndex -> Int

-- | Create an axis for values indexed by position. The list of strings are
--   the labels to be used.
autoIndexAxis :: Integral i => [String] -> [i] -> AxisData i

-- | Augment a list of values with index numbers for plotting.
addIndexes :: [a] -> [(PlotIndex, a)]
instance Eq PlotIndex
instance Ord PlotIndex
instance Enum PlotIndex
instance Num PlotIndex
instance Real PlotIndex
instance Integral PlotIndex
instance Show PlotIndex
instance PlotValue PlotIndex


-- | Calculate and render floating value axes including doubles with
--   linear, log, and percentage scaling.
module Graphics.Rendering.Chart.Axis.Floating

-- | A wrapper class for doubles used to indicate they are to be plotted
--   against a percentage axis.
newtype Percent
Percent :: Double -> Percent
unPercent :: Percent -> Double
data LinearAxisParams a
LinearAxisParams :: (a -> String) -> Int -> Int -> LinearAxisParams a

-- | The function used to show the axes labels.
la_labelf_ :: LinearAxisParams a -> a -> String

-- | The target number of labels to be shown.
la_nLabels_ :: LinearAxisParams a -> Int

-- | The target number of ticks to be shown.
la_nTicks_ :: LinearAxisParams a -> Int

-- | A wrapper class for doubles used to indicate they are to be plotted
--   against a log axis.
newtype LogValue
LogValue :: Double -> LogValue
data LogAxisParams a
LogAxisParams :: (a -> String) -> LogAxisParams a

-- | The function used to show the axes labels.
loga_labelf_ :: LogAxisParams a -> a -> String
defaultLinearAxis :: (Show a, RealFloat a) => LinearAxisParams a
defaultLogAxis :: (Show a, RealFloat a) => LogAxisParams a

-- | Generate a linear axis with the specified bounds
scaledAxis :: RealFloat a => LinearAxisParams a -> (a, a) -> AxisFn a

-- | Generate a linear axis automatically, scaled appropriately for the
--   input data.
autoScaledAxis :: RealFloat a => LinearAxisParams a -> AxisFn a

-- | Generate a log axis automatically, scaled appropriate for the input
--   data.
autoScaledLogAxis :: RealFloat a => LogAxisParams a -> AxisFn a

-- | Given a target number of values, and a list of input points, find
--   evenly spaced values from the set {1*X, 2*X, 2.5*X, 5*X} (where X is
--   some power of ten) that evenly cover the input points.
autoSteps :: Int -> [Double] -> [Double]
la_labelf :: T (LinearAxisParams a_aplJ) (a_aplJ -> String)
la_nLabels :: T (LinearAxisParams a_aplJ) Int
la_nTicks :: T (LinearAxisParams a_aplJ) Int
loga_labelf :: T (LogAxisParams a_aplI) (a_aplI -> String)
instance Eq Percent
instance Ord Percent
instance Num Percent
instance Real Percent
instance Fractional Percent
instance RealFrac Percent
instance Floating Percent
instance RealFloat Percent
instance Eq LogValue
instance Ord LogValue
instance Num LogValue
instance Real LogValue
instance Fractional LogValue
instance RealFrac LogValue
instance Floating LogValue
instance RealFloat LogValue
instance PlotValue LogValue
instance Show LogValue
instance PlotValue Percent
instance Show Percent
instance PlotValue Double


-- | Calculate and render integer indexed axes
module Graphics.Rendering.Chart.Axis.Int
defaultIntAxis :: Show a => LinearAxisParams a
scaledIntAxis :: (Integral i, PlotValue i) => LinearAxisParams i -> (i, i) -> AxisFn i
autoScaledIntAxis :: (Integral i, PlotValue i) => LinearAxisParams i -> AxisFn i
instance PlotValue Integer
instance PlotValue Int


-- | Calculate and render time axes
module Graphics.Rendering.Chart.Axis.LocalTime

-- | Create an <a>AxisFn</a> to for a time axis. The first <a>TimeSeq</a>
--   sets the minor ticks, and the ultimate range will be aligned to its
--   elements. The second <a>TimeSeq</a> sets the labels and grid. The
--   third <a>TimeSeq</a> sets the second line of labels. The
--   <a>TimeLabelFn</a> is used to format LocalTimes for labels. The values
--   to be plotted against this axis can be created with
--   <a>doubleFromLocalTime</a>.
timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> TimeLabelAlignment -> TimeSeq -> TimeLabelFn -> TimeLabelAlignment -> AxisFn LocalTime

-- | Automatically choose a suitable time axis, based upon the time range
--   of data. The values to be plotted against this axis can be created
--   with <a>doubleFromLocalTime</a>.
autoTimeAxis :: AxisFn LocalTime

-- | A <a>TimeSeq</a> for calendar days.
days :: TimeSeq

-- | A <a>TimeSeq</a> for calendar months.
months :: TimeSeq

-- | A <a>TimeSeq</a> for calendar years.
years :: TimeSeq
instance Show TimeLabelAlignment
instance PlotValue LocalTime


-- | Code to calculate and render axes.
module Graphics.Rendering.Chart.Axis


-- | A container type for values that can be composed by horizonal and
--   vertical layout.
module Graphics.Rendering.Chart.Grid

-- | Abstract datatype representing a grid.
data Grid a
type Span = (Int, Int)

-- | A 1x1 grid from a given value, with no extra space.
tval :: a -> Grid a

-- | A WxH (measured in cells) grid from a given value, with space weight
--   (1,1).
tspan :: a -> Span -> Grid a

-- | A 1x1 empty grid.
empty :: Grid a

-- | A 0x0 empty grid.
nullt :: Grid a

-- | A synonym for <a>beside</a>.
(.|.) :: Grid a -> Grid a -> Grid a

-- | A synonym for <a>above</a>.
(./.) :: Grid a -> Grid a -> Grid a
above :: Grid a -> Grid a -> Grid a
aboveN :: [Grid a] -> Grid a
beside :: Grid a -> Grid a -> Grid a
besideN :: [Grid a] -> Grid a

-- | One grid over the other. The first argument is shallow, the second is
--   deep.
overlay :: Grid a -> Grid a -> Grid a
width :: Grid a -> Int
height :: Grid a -> Int
gridToRenderable :: Grid (Renderable a) -> Renderable a

-- | Sets the space weight of *every* cell of the grid to given value.
weights :: SpaceWeight -> Grid a -> Grid a

-- | A value placed above the grid, occupying 1 row with the same
--   horizontal span as the grid.
fullRowAbove :: a -> Double -> Grid a -> Grid a

-- | A value placed below the grid, occupying 1 row with the same
--   horizontal span as the grid.
fullRowBelow :: a -> Double -> Grid a -> Grid a

-- | A value placed to the left of the grid, occupying 1 column with the
--   same vertical span as the grid.
fullColLeft :: a -> Double -> Grid a -> Grid a

-- | A value placed to the right of the grid, occupying 1 column with the
--   same vertical span as the grid.
fullColRight :: a -> Double -> Grid a -> Grid a

-- | A value placed under a grid, with the same span as the grid.
fullOverlayUnder :: a -> Grid a -> Grid a

-- | A value placed over a grid, with the same span as the grid.
fullOverlayOver :: a -> Grid a -> Grid a
instance Show a => Show (Grid a)
instance ToRenderable a => ToRenderable (Grid a)
instance Functor Grid


-- | Datatypes and functions common to the implementation of the various
--   plot types.
module Graphics.Rendering.Chart.Plot.Types

-- | Interface to control plotting on a 2D area.
data Plot x y
Plot :: (PointMapFn x y -> CRender ()) -> [(String, Rect -> CRender ())] -> ([x], [y]) -> Plot x y

-- | Given the mapping between model space coordinates and device
--   coordinates, render this plot into a chart.
plot_render_ :: Plot x y -> PointMapFn x y -> CRender ()

-- | Details for how to show this plot in a legend. For each item the
--   string is the text to show, and the function renders a graphical
--   sample of the plot.
plot_legend_ :: Plot x y -> [(String, Rect -> CRender ())]

-- | All of the model space coordinates to be plotted. These are used to
--   autoscale the axes where necessary.
plot_all_points_ :: Plot x y -> ([x], [y])

-- | Join any two plots together (they will share a legend).
joinPlot :: Plot x y -> Plot x y -> Plot x y

-- | A type class abstracting the conversion of a value to a Plot.
class ToPlot a
toPlot :: ToPlot a => a x y -> Plot x y
mapXY :: PointMapFn x y -> ((x, y) -> Point)
plot_render :: T (Plot x_aRzu y_aRzv) (PointMapFn x_aRzu y_aRzv -> CRender ())
plot_legend :: T (Plot x_aRzu y_aRzv) [(String, Rect -> CRender ())]
plot_all_points :: T (Plot x_aRzu y_aRzv) ([x_aRzu], [y_aRzv])


-- | Types and functions for handling the legend(s) on a chart. A legend is
--   an area on the chart used to label the plotted values.
module Graphics.Rendering.Chart.Legend
data Legend x y
Legend :: LegendStyle -> [(String, Rect -> CRender ())] -> Legend x y
data LegendStyle
LegendStyle :: CairoFontStyle -> Double -> Double -> LegendOrientation -> LegendStyle
legend_label_style_ :: LegendStyle -> CairoFontStyle
legend_margin_ :: LegendStyle -> Double
legend_plot_size_ :: LegendStyle -> Double
legend_orientation_ :: LegendStyle -> LegendOrientation

-- | Legends can be constructed in two orientations: in rows (where we
--   specify the maximum number of columns), and in columns (where we
--   specify the maximum number of rows)
data LegendOrientation
LORows :: Int -> LegendOrientation
LOCols :: Int -> LegendOrientation
defaultLegendStyle :: LegendStyle
legendToRenderable :: Legend x y -> Renderable String
legend_label_style :: T LegendStyle CairoFontStyle
legend_margin :: T LegendStyle Double
legend_plot_size :: T LegendStyle Double
legend_orientation :: T LegendStyle LegendOrientation
instance ToRenderable (Legend x y)


-- | Line plots
module Graphics.Rendering.Chart.Plot.Lines

-- | Value defining a series of (possibly disjointed) lines, and a style in
--   which to render them.
data PlotLines x y
PlotLines :: String -> CairoLineStyle -> [[(x, y)]] -> [[(Limit x, Limit y)]] -> PlotLines x y
plot_lines_title_ :: PlotLines x y -> String
plot_lines_style_ :: PlotLines x y -> CairoLineStyle

-- | The lines to be plotted
plot_lines_values_ :: PlotLines x y -> [[(x, y)]]

-- | Additional lines to be plotted, specified using the Limit type to
--   allow referencing the edges of the plot area.
plot_lines_limit_values_ :: PlotLines x y -> [[(Limit x, Limit y)]]
defaultPlotLines :: PlotLines x y
defaultPlotLineStyle :: CairoLineStyle

-- | Helper function to plot a single horizontal line.
hlinePlot :: String -> CairoLineStyle -> b -> Plot a b

-- | Helper function to plot a single vertical line.
vlinePlot :: String -> CairoLineStyle -> a -> Plot a b
plot_lines_title :: T (PlotLines x_aSTn y_aSTo) String
plot_lines_style :: T (PlotLines x_aSTn y_aSTo) CairoLineStyle
plot_lines_values :: T (PlotLines x_aSTn y_aSTo) [[(x_aSTn, y_aSTo)]]
plot_lines_limit_values :: T (PlotLines x_aSTn y_aSTo) [[(Limit x_aSTn, Limit y_aSTo)]]
instance ToPlot PlotLines


-- | Functions to plot sets of points, marked in various styles.
module Graphics.Rendering.Chart.Plot.Points

-- | Value defining a series of datapoints, and a style in which to render
--   them.
data PlotPoints x y
PlotPoints :: String -> CairoPointStyle -> [(x, y)] -> PlotPoints x y
plot_points_title_ :: PlotPoints x y -> String
plot_points_style_ :: PlotPoints x y -> CairoPointStyle
plot_points_values_ :: PlotPoints x y -> [(x, y)]
defaultPlotPoints :: PlotPoints x y
plot_points_title :: T (PlotPoints x_aTMR y_aTMS) String
plot_points_style :: T (PlotPoints x_aTMR y_aTMS) CairoPointStyle
plot_points_values :: T (PlotPoints x_aTMR y_aTMS) [(x_aTMR, y_aTMS)]
instance ToPlot PlotPoints


-- | Plots that fill the area between two lines.
module Graphics.Rendering.Chart.Plot.FillBetween

-- | Value specifying a plot filling the area between two sets of Y
--   coordinates, given common X coordinates.
data PlotFillBetween x y
PlotFillBetween :: String -> CairoFillStyle -> [(x, (y, y))] -> PlotFillBetween x y
plot_fillbetween_title_ :: PlotFillBetween x y -> String
plot_fillbetween_style_ :: PlotFillBetween x y -> CairoFillStyle
plot_fillbetween_values_ :: PlotFillBetween x y -> [(x, (y, y))]
defaultPlotFillBetween :: PlotFillBetween x y
plot_fillbetween_title :: T (PlotFillBetween x_aUom y_aUon) String
plot_fillbetween_style :: T (PlotFillBetween x_aUom y_aUon) CairoFillStyle
plot_fillbetween_values :: T (PlotFillBetween x_aUom y_aUon) [(x_aUom, (y_aUon, y_aUon))]
instance ToPlot PlotFillBetween


-- | Plot series of points with associated error bars.
module Graphics.Rendering.Chart.Plot.ErrBars

-- | Value defining a series of error intervals, and a style in which to
--   render them.
data PlotErrBars x y
PlotErrBars :: String -> CairoLineStyle -> Double -> Double -> [ErrPoint x y] -> PlotErrBars x y
plot_errbars_title_ :: PlotErrBars x y -> String
plot_errbars_line_style_ :: PlotErrBars x y -> CairoLineStyle
plot_errbars_tick_length_ :: PlotErrBars x y -> Double
plot_errbars_overhang_ :: PlotErrBars x y -> Double
plot_errbars_values_ :: PlotErrBars x y -> [ErrPoint x y]
defaultPlotErrBars :: PlotErrBars x y
data ErrPoint x y
ErrPoint :: ErrValue x -> ErrValue y -> ErrPoint x y
ep_x :: ErrPoint x y -> ErrValue x
ep_y :: ErrPoint x y -> ErrValue y

-- | Value for holding a point with associated error bounds for each axis.
data ErrValue x
ErrValue :: x -> x -> x -> ErrValue x
ev_low :: ErrValue x -> x
ev_best :: ErrValue x -> x
ev_high :: ErrValue x -> x

-- | When the error is symmetric, we can simply pass in dx for the error.
symErrPoint :: (Num a, Num b) => a -> b -> a -> b -> ErrPoint a b
plot_errbars_title :: T (PlotErrBars x_aVcI y_aVcJ) String
plot_errbars_line_style :: T (PlotErrBars x_aVcI y_aVcJ) CairoLineStyle
plot_errbars_tick_length :: T (PlotErrBars x_aVcI y_aVcJ) Double
plot_errbars_overhang :: T (PlotErrBars x_aVcI y_aVcJ) Double
plot_errbars_values :: T (PlotErrBars x_aVcI y_aVcJ) [ErrPoint x_aVcI y_aVcJ]
instance Show x => Show (ErrValue x)
instance (Show x, Show y) => Show (ErrPoint x y)
instance ToPlot PlotErrBars


-- | Candlestick charts for financial plotting
module Graphics.Rendering.Chart.Plot.Candle

-- | Value defining a financial interval: opening and closing prices, with
--   maxima and minima; and a style in which to render them. By convention,
--   there are different fill styles depending on whether the price rises
--   (open &lt; close) or falls (close &lt; open). (This plot type can also
--   be re-purposed for statistical intervals, e.g. minimum, first
--   quartile, median, third quartile, maximum.)
data PlotCandle x y
PlotCandle :: String -> CairoLineStyle -> Bool -> CairoFillStyle -> CairoFillStyle -> Double -> Double -> Double -> [Candle x y] -> PlotCandle x y
plot_candle_title_ :: PlotCandle x y -> String
plot_candle_line_style_ :: PlotCandle x y -> CairoLineStyle
plot_candle_fill_ :: PlotCandle x y -> Bool
plot_candle_rise_fill_style_ :: PlotCandle x y -> CairoFillStyle
plot_candle_fall_fill_style_ :: PlotCandle x y -> CairoFillStyle
plot_candle_tick_length_ :: PlotCandle x y -> Double
plot_candle_width_ :: PlotCandle x y -> Double
plot_candle_centre_ :: PlotCandle x y -> Double
plot_candle_values_ :: PlotCandle x y -> [Candle x y]

-- | A Value holding price intervals for a given x-coord. An alternative
--   view is that these are statistical intervals: the 0th, 25th, 50th,
--   75th, and 100th percentiles.
data Candle x y
Candle :: x -> y -> y -> y -> y -> y -> Candle x y
candle_x :: Candle x y -> x
candle_low :: Candle x y -> y
candle_open :: Candle x y -> y
candle_mid :: Candle x y -> y
candle_close :: Candle x y -> y
candle_high :: Candle x y -> y
defaultPlotCandle :: PlotCandle x y
plot_candle_title :: T (PlotCandle x_aXDb y_aXDc) String
plot_candle_line_style :: T (PlotCandle x_aXDb y_aXDc) CairoLineStyle
plot_candle_tick_length :: T (PlotCandle x_aXDb y_aXDc) Double
plot_candle_width :: T (PlotCandle x_aXDb y_aXDc) Double
plot_candle_centre :: T (PlotCandle x_aXDb y_aXDc) Double
plot_candle_fill :: T (PlotCandle x_aXDb y_aXDc) Bool
plot_candle_rise_fill_style :: T (PlotCandle x_aXDb y_aXDc) CairoFillStyle
plot_candle_fall_fill_style :: T (PlotCandle x_aXDb y_aXDc) CairoFillStyle
plot_candle_values :: T (PlotCandle x_aXDb y_aXDc) [Candle x_aXDb y_aXDc]
instance (Show x, Show y) => Show (Candle x y)
instance ToPlot PlotCandle


-- | Bar Charts
module Graphics.Rendering.Chart.Plot.Bars

-- | 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.
data PlotBars x y
PlotBars :: PlotBarsStyle -> [(CairoFillStyle, Maybe CairoLineStyle)] -> [String] -> PlotBarsSpacing -> PlotBarsAlignment -> y -> Double -> [(x, [y])] -> PlotBars x y

-- | This value specifies whether each value from [y] should be shown
--   beside or above the previous value.
plot_bars_style_ :: PlotBars x y -> PlotBarsStyle

-- | 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_item_styles_ :: PlotBars x y -> [(CairoFillStyle, Maybe CairoLineStyle)]

-- | The title of each element of [y]. These will be shown in the legend.
plot_bars_titles_ :: PlotBars x y -> [String]

-- | 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_spacing_ :: PlotBars x y -> PlotBarsSpacing

-- | This value controls how bars for a fixed x are aligned with respect to
--   the device coordinate corresponding to x.
plot_bars_alignment_ :: PlotBars x y -> PlotBarsAlignment

-- | The starting level for the chart (normally 0).
plot_bars_reference_ :: PlotBars x y -> y
plot_bars_singleton_width_ :: PlotBars x y -> Double

-- | The actual points to be plotted.
plot_bars_values_ :: PlotBars x y -> [(x, [y])]
defaultPlotBars :: BarsPlotValue y => PlotBars x y
data PlotBarsStyle

-- | Bars for a fixed x are stacked vertically on top of each other.
BarsStacked :: PlotBarsStyle

-- | Bars for a fixed x are put horizontally beside each other.
BarsClustered :: PlotBarsStyle
data PlotBarsSpacing

-- | All bars have the same width in pixels.
BarsFixWidth :: Double -> PlotBarsSpacing

-- | (BarsFixGap g mw) means make the gaps between the bars equal to g, but
--   with a minimum bar width of mw
BarsFixGap :: Double -> Double -> PlotBarsSpacing

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

-- | The left edge of bars is at deviceX
BarsLeft :: PlotBarsAlignment

-- | The right edge of bars is at deviceX
BarsCentered :: PlotBarsAlignment

-- | Bars are centered around deviceX
BarsRight :: PlotBarsAlignment
class PlotValue a => BarsPlotValue a
barsReference :: BarsPlotValue a => a
barsAdd :: BarsPlotValue a => a -> a -> a
plotBars :: BarsPlotValue y => PlotBars x y -> Plot x y
plot_bars_style :: T (PlotBars x_a10PK y_a10PL) PlotBarsStyle
plot_bars_item_styles :: T (PlotBars x_a10PK y_a10PL) [(CairoFillStyle, Maybe CairoLineStyle)]
plot_bars_titles :: T (PlotBars x_a10PK y_a10PL) [String]
plot_bars_spacing :: T (PlotBars x_a10PK y_a10PL) PlotBarsSpacing
plot_bars_alignment :: T (PlotBars x_a10PK y_a10PL) PlotBarsAlignment
plot_bars_reference :: T (PlotBars x_a10PK y_a10PL) y_a10PL
plot_bars_singleton_width :: T (PlotBars x_a10PK y_a10PL) Double
plot_bars_values :: T (PlotBars x_a10PK y_a10PL) [(x_a10PK, [y_a10PL])]
instance Show PlotBarsStyle
instance Show PlotBarsSpacing
instance Show PlotBarsAlignment
instance BarsPlotValue Int
instance BarsPlotValue Double


-- | Plots that don't show, but occupy space so as to effect axis scaling
module Graphics.Rendering.Chart.Plot.Hidden

-- | Value defining some hidden x and y values. The values don't get
--   displayed, but still affect axis scaling.
data PlotHidden x y
PlotHidden :: [x] -> [y] -> PlotHidden x y
plot_hidden_x_values_ :: PlotHidden x y -> [x]
plot_hidden_y_values_ :: PlotHidden x y -> [y]
instance ToPlot PlotHidden


-- | Show textual annotations on a chart.
module Graphics.Rendering.Chart.Plot.Annotation

-- | Value for describing a series of text annotations to be placed at
--   arbitrary points on the graph. Annotations can be rotated and styled.
--   Rotation angle is given in degrees, rotation is performend around the
--   anchor point.
data PlotAnnotation x y
PlotAnnotation :: HTextAnchor -> VTextAnchor -> Double -> CairoFontStyle -> [(x, y, String)] -> PlotAnnotation x y
plot_annotation_hanchor_ :: PlotAnnotation x y -> HTextAnchor
plot_annotation_vanchor_ :: PlotAnnotation x y -> VTextAnchor
plot_annotation_angle_ :: PlotAnnotation x y -> Double
plot_annotation_style_ :: PlotAnnotation x y -> CairoFontStyle
plot_annotation_values_ :: PlotAnnotation x y -> [(x, y, String)]
defaultPlotAnnotation :: PlotAnnotation x y
plot_annotation_hanchor :: T (PlotAnnotation x_a13Yw y_a13Yx) HTextAnchor
plot_annotation_vanchor :: T (PlotAnnotation x_a13Yw y_a13Yx) VTextAnchor
plot_annotation_angle :: T (PlotAnnotation x_a13Yw y_a13Yx) Double
plot_annotation_style :: T (PlotAnnotation x_a13Yw y_a13Yx) CairoFontStyle
plot_annotation_values :: T (PlotAnnotation x_a13Yw y_a13Yx) [(x_a13Yw, y_a13Yx, String)]
instance ToPlot PlotAnnotation


-- | Area spots are a collection of unconnected filled circles, with x,y
--   position, and an independent z value to be represented by the relative
--   area of the spots.
module Graphics.Rendering.Chart.Plot.AreaSpots

-- | A collection of unconnected spots, with x,y position, and an
--   independent z value to be represented by the area of the spot.
data AreaSpots z x y
AreaSpots :: String -> Double -> AlphaColour Double -> Colour Double -> Double -> Double -> [(x, y, z)] -> AreaSpots z x y
area_spots_title_ :: AreaSpots z x y -> String
area_spots_linethick_ :: AreaSpots z x y -> Double
area_spots_linecolour_ :: AreaSpots z x y -> AlphaColour Double
area_spots_fillcolour_ :: AreaSpots z x y -> Colour Double
area_spots_opacity_ :: AreaSpots z x y -> Double

-- | the largest size of spot
area_spots_max_radius_ :: AreaSpots z x y -> Double
area_spots_values_ :: AreaSpots z x y -> [(x, y, z)]
defaultAreaSpots :: AreaSpots z x y
area_spots_title :: T (AreaSpots z_a14xa x_a14xb y_a14xc) String
area_spots_linethick :: T (AreaSpots z_a14xa x_a14xb y_a14xc) Double
area_spots_linecolour :: T (AreaSpots z_a14xa x_a14xb y_a14xc) (AlphaColour Double)
area_spots_fillcolour :: T (AreaSpots z_a14xa x_a14xb y_a14xc) (Colour Double)
area_spots_max_radius :: T (AreaSpots z_a14xa x_a14xb y_a14xc) Double
area_spots_values :: T (AreaSpots z_a14xa x_a14xb y_a14xc) [(x_a14xb, y_a14xc, z_a14xa)]

-- | A collection of unconnected spots, with x,y position, an independent z
--   value to be represented by the area of the spot, and in addition, a
--   fourth variable t to be represented by a colour from a given palette.
--   (A linear transfer function from t to palette is assumed.)
data AreaSpots4D z t x y
AreaSpots4D :: String -> Double -> [Colour Double] -> Double -> Double -> [(x, y, z, t)] -> AreaSpots4D z t x y
area_spots_4d_title_ :: AreaSpots4D z t x y -> String
area_spots_4d_linethick_ :: AreaSpots4D z t x y -> Double
area_spots_4d_palette_ :: AreaSpots4D z t x y -> [Colour Double]
area_spots_4d_opacity_ :: AreaSpots4D z t x y -> Double

-- | the largest size of spot
area_spots_4d_max_radius_ :: AreaSpots4D z t x y -> Double
area_spots_4d_values_ :: AreaSpots4D z t x y -> [(x, y, z, t)]
defaultAreaSpots4D :: AreaSpots4D z t x y
area_spots_4d_title :: T (AreaSpots4D z_a14x6 t_a14x7 x_a14x8 y_a14x9) String
area_spots_4d_linethick :: T (AreaSpots4D z_a14x6 t_a14x7 x_a14x8 y_a14x9) Double
area_spots_4d_palette :: T (AreaSpots4D z_a14x6 t_a14x7 x_a14x8 y_a14x9) [Colour Double]
area_spots_4d_max_radius :: T (AreaSpots4D z_a14x6 t_a14x7 x_a14x8 y_a14x9) Double
area_spots_4d_values :: T (AreaSpots4D z_a14x6 t_a14x7 x_a14x8 y_a14x9) [(x_a14x8, y_a14x9, z_a14x6, t_a14x7)]
instance (PlotValue z, PlotValue t, Show t) => ToPlot (AreaSpots4D z t)
instance PlotValue z => ToPlot (AreaSpots z)


-- | A basic pie chart.
--   
--   Pie charts are handled different to other plots, in that they have
--   their own layout, and can't be composed with other plots. A pie chart
--   is rendered with code in the following form:
--   
--   <pre>
--   values :: [PieItem]
--   values = [...]
--   layout :: PieLayout
--   layout = pie_plot ^: pie_data ^= values
--          $ defaultPieLayout
--   renderable = toRenderable layout
--   </pre>
module Graphics.Rendering.Chart.Plot.Pie
data PieLayout
PieLayout :: String -> CairoFontStyle -> PieChart -> CairoFillStyle -> Double -> PieLayout
pie_title_ :: PieLayout -> String
pie_title_style_ :: PieLayout -> CairoFontStyle
pie_plot_ :: PieLayout -> PieChart
pie_background_ :: PieLayout -> CairoFillStyle
pie_margin_ :: PieLayout -> Double
data PieChart
PieChart :: [PieItem] -> [AlphaColour Double] -> CairoFontStyle -> CairoLineStyle -> Double -> PieChart
pie_data_ :: PieChart -> [PieItem]
pie_colors_ :: PieChart -> [AlphaColour Double]
pie_label_style_ :: PieChart -> CairoFontStyle
pie_label_line_style_ :: PieChart -> CairoLineStyle
pie_start_angle_ :: PieChart -> Double
data PieItem
PieItem :: String -> Double -> Double -> PieItem
pitem_label_ :: PieItem -> String
pitem_offset_ :: PieItem -> Double
pitem_value_ :: PieItem -> Double
defaultPieLayout :: PieLayout
defaultPieChart :: PieChart
defaultPieItem :: PieItem
pie_title :: T PieLayout String
pie_title_style :: T PieLayout CairoFontStyle
pie_plot :: T PieLayout PieChart
pie_background :: T PieLayout CairoFillStyle
pie_margin :: T PieLayout Double
pie_data :: T PieChart [PieItem]
pie_colors :: T PieChart [AlphaColour Double]
pie_label_style :: T PieChart CairoFontStyle
pie_label_line_style :: T PieChart CairoLineStyle
pie_start_angle :: T PieChart Double
pitem_label :: T PieItem String
pitem_offset :: T PieItem Double
pitem_value :: T PieItem Double
instance ToRenderable PieChart
instance ToRenderable PieLayout


-- | Code to calculate and render various types of plots.
module Graphics.Rendering.Chart.Plot


-- | This module glues together axes and plots to actually create a
--   renderable for a chart.
--   
--   Note that template haskell is used to derive accessor functions (see
--   <a>Accessor</a>) for each field of the following data types:
--   
--   <ul>
--   <li><a>Layout1</a></li>
--   <li><a>LayoutAxis</a></li>
--   </ul>
--   
--   These accessors are not shown in this API documentation. They have the
--   same name as the field, but with the trailing underscore dropped.
--   Hence for data field f_::F in type D, they have type
--   
--   <pre>
--   f :: Data.Accessor.Accessor D F
--   </pre>
module Graphics.Rendering.Chart.Layout

-- | A Layout1 value is a single plot area, with optional: axes on each of
--   the 4 sides; title at the top; legend at the bottom. It's
--   parameterised by the types of values to be plotted on the horizonal
--   and vertical axes.
data Layout1 x y
Layout1 :: CairoFillStyle -> Maybe CairoFillStyle -> String -> CairoFontStyle -> LayoutAxis x -> LayoutAxis x -> LayoutAxis y -> LayoutAxis y -> (([y], [y]) -> ([y], [y])) -> Double -> [Either (Plot x y) (Plot x y)] -> Maybe LegendStyle -> Bool -> Layout1 x y
layout1_background_ :: Layout1 x y -> CairoFillStyle
layout1_plot_background_ :: Layout1 x y -> Maybe CairoFillStyle
layout1_title_ :: Layout1 x y -> String
layout1_title_style_ :: Layout1 x y -> CairoFontStyle
layout1_bottom_axis_ :: Layout1 x y -> LayoutAxis x
layout1_top_axis_ :: Layout1 x y -> LayoutAxis x
layout1_left_axis_ :: Layout1 x y -> LayoutAxis y
layout1_right_axis_ :: Layout1 x y -> LayoutAxis y

-- | Function to map points from the left/right plot to the left/right
--   axes. The default value is <a>id</a>.
layout1_yaxes_control_ :: Layout1 x y -> ([y], [y]) -> ([y], [y])
layout1_margin_ :: Layout1 x y -> Double
layout1_plots_ :: Layout1 x y -> [Either (Plot x y) (Plot x y)]
layout1_legend_ :: Layout1 x y -> Maybe LegendStyle

-- | True if the grid is to be rendered on top of the Plots.
layout1_grid_last_ :: Layout1 x y -> Bool
data LayoutAxis x
LayoutAxis :: CairoFontStyle -> String -> AxisStyle -> ([x] -> Bool) -> AxisFn x -> (AxisData x -> AxisData x) -> Bool -> LayoutAxis x
laxis_title_style_ :: LayoutAxis x -> CairoFontStyle
laxis_title_ :: LayoutAxis x -> String
laxis_style_ :: LayoutAxis x -> AxisStyle

-- | Function that determines whether an axis should be visible, based upon
--   the points plotted on this axis. The default value is 'not.null'.
laxis_visible_ :: LayoutAxis x -> [x] -> Bool

-- | Function that generates the axis data, based upon the points plotted.
--   The default value is <a>autoAxis</a>.
laxis_generate_ :: LayoutAxis x -> AxisFn x

-- | Function that can be used to override the generated axis data. The
--   default value is <a>id</a>.
laxis_override_ :: LayoutAxis x -> AxisData x -> AxisData x

-- | True if left to right (bottom to top) is to show descending values.
laxis_reverse_ :: LayoutAxis x -> Bool
data Layout1Pick x y
L1P_Legend :: String -> Layout1Pick x y
L1P_Title :: String -> Layout1Pick x y
L1P_BottomAxisTitle :: String -> Layout1Pick x y
L1P_TopAxisTitle :: String -> Layout1Pick x y
L1P_LeftAxisTitle :: String -> Layout1Pick x y
L1P_RightAxisTitle :: String -> Layout1Pick x y
L1P_PlotArea :: x -> y -> y -> Layout1Pick x y
L1P_BottomAxis :: x -> Layout1Pick x y
L1P_TopAxis :: x -> Layout1Pick x y
L1P_LeftAxis :: y -> Layout1Pick x y
L1P_RightAxis :: y -> Layout1Pick x y

-- | A <tt>MAxisFn</tt> is a function that generates an (optional) axis
--   given the points plotted against that axis.
type MAxisFn t = [t] -> Maybe (AxisData t)
defaultLayout1 :: (PlotValue x, PlotValue y) => Layout1 x y
layout1ToRenderable :: (Ord x, Ord y) => Layout1 x y -> Renderable (Layout1Pick x y)
linkAxes :: ([a], [a]) -> ([a], [a])
independentAxes :: (a, b) -> (a, b)

-- | Helper to update all axis styles on a Layout1 simultaneously.
updateAllAxesStyles :: (AxisStyle -> AxisStyle) -> Layout1 x y -> Layout1 x y

-- | Helper to set the forground color uniformly on a Layout1.
setLayout1Foreground :: AlphaColour Double -> Layout1 x y -> Layout1 x y
defaultLayoutAxis :: PlotValue t => LayoutAxis t
laxis_title_style :: T (LayoutAxis x_a1aNe) CairoFontStyle
laxis_title :: T (LayoutAxis x_a1aNe) String
laxis_style :: T (LayoutAxis x_a1aNe) AxisStyle
laxis_visible :: T (LayoutAxis x_a1aNe) ([x_a1aNe] -> Bool)
laxis_generate :: T (LayoutAxis x_a1aNe) (AxisFn x_a1aNe)
laxis_override :: T (LayoutAxis x_a1aNe) (AxisData x_a1aNe -> AxisData x_a1aNe)
laxis_reverse :: T (LayoutAxis x_a1aNe) Bool
layout1_background :: T (Layout1 x_a1aMl y_a1aMm) CairoFillStyle
layout1_plot_background :: T (Layout1 x_a1aMl y_a1aMm) (Maybe CairoFillStyle)
layout1_title :: T (Layout1 x_a1aMl y_a1aMm) String
layout1_title_style :: T (Layout1 x_a1aMl y_a1aMm) CairoFontStyle
layout1_left_axis :: T (Layout1 x_a1aMl y_a1aMm) (LayoutAxis y_a1aMm)
layout1_right_axis :: T (Layout1 x_a1aMl y_a1aMm) (LayoutAxis y_a1aMm)
layout1_top_axis :: T (Layout1 x_a1aMl y_a1aMm) (LayoutAxis x_a1aMl)
layout1_bottom_axis :: T (Layout1 x_a1aMl y_a1aMm) (LayoutAxis x_a1aMl)
layout1_yaxes_control :: T (Layout1 x_a1aMl y_a1aMm) (([y_a1aMm], [y_a1aMm]) -> ([y_a1aMm], [y_a1aMm]))
layout1_margin :: T (Layout1 x_a1aMl y_a1aMm) Double
layout1_plots :: T (Layout1 x_a1aMl y_a1aMm) [Either (Plot x_a1aMl y_a1aMm) (Plot x_a1aMl y_a1aMm)]
layout1_legend :: T (Layout1 x_a1aMl y_a1aMm) (Maybe LegendStyle)
layout1_grid_last :: T (Layout1 x_a1aMl y_a1aMm) Bool

-- | Render several layouts with the same abscissa type stacked so that
--   their origins and axis titles are aligned horizontally with respect to
--   each other. The exterior margins and background are taken from the
--   first element.
renderLayout1sStacked :: Ord x => [AnyLayout1 x] -> Renderable ()

-- | Encapsulates a <a>Layout1</a> with a fixed abscissa type but arbitrary
--   ordinate type.
data AnyLayout1 x
withAnyOrdinate :: (Ord x, Ord y) => Layout1 x y -> AnyLayout1 x
instance (Show x, Show y) => Show (Layout1Pick x y)
instance (Ord x, Ord y) => ToRenderable (Layout1 x y)


-- | Created : 2008-02-26 Modified : 2011-02-11 Version : 0.2
--   
--   Sparklines implementation in Haskell. Sparklines are mini graphs
--   inspired by Edward Tufte.
--   
--   The original implementation (by Hitesh Jasani) used the gd package as
--   a backend renderer, and is still available at
--   http:<i></i>hackage.haskell.org<i>package</i>hsparklines The present
--   version uses Cairo as its renderer, and integrates with the Chart
--   package, in the sense that Sparklines are just another kind of
--   (ToRenderable a =&gt; a), so can be composed into grids etc.
--   
--   <pre>
--   dp :: [Double]
--   dp = [24,21,32.3,24,15,34,43,55,57,72,74,75,73,72,55,44]
--   
--   sparkLineToPNG "bar_spark.png" (SparkLine barSpark dp)
--   </pre>
module Graphics.Rendering.Chart.SparkLine

-- | A sparkline is a single sequence of data values, treated as y-values.
--   The x-values are anonymous and implicit in the sequence.
data SparkLine
SparkLine :: SparkOptions -> [Double] -> SparkLine
sl_options :: SparkLine -> SparkOptions
sl_data :: SparkLine -> [Double]

-- | Options to render the sparklines in different ways.
data SparkOptions
SparkOptions :: Bool -> Int -> Int -> (Double, Double) -> Colour Double -> Colour Double -> Colour Double -> Colour Double -> Bool -> Bool -> Bool -> SparkOptions

-- | smooth or bars
so_smooth :: SparkOptions -> Bool

-- | step size
so_step :: SparkOptions -> Int

-- | graph height (pixels)
so_height :: SparkOptions -> Int

-- | data point limits
so_limits :: SparkOptions -> (Double, Double)

-- | background color
so_bgColor :: SparkOptions -> Colour Double

-- | color of minimum datapoint
so_minColor :: SparkOptions -> Colour Double

-- | color of maximum datapoint
so_maxColor :: SparkOptions -> Colour Double

-- | color of last datapoint
so_lastColor :: SparkOptions -> Colour Double

-- | display minimum marker
so_minMarker :: SparkOptions -> Bool

-- | display maximum marker
so_maxMarker :: SparkOptions -> Bool

-- | display last marker
so_lastMarker :: SparkOptions -> Bool

-- | Default options for a smooth sparkline.
smoothSpark :: SparkOptions

-- | Default options for a barchart sparkline.
barSpark :: SparkOptions
sparkSize :: SparkLine -> (Int, Int)

-- | Render a SparkLine to a drawing surface using cairo.
renderSparkLine :: SparkLine -> CRender (PickFn ())

-- | Generate a PNG for the sparkline, using its natural size.
sparkLineToPNG :: FilePath -> SparkLine -> IO (PickFn ())

-- | Generate a PDF for the sparkline, using its natural size.
sparkLineToPDF :: FilePath -> SparkLine -> IO ()
instance Show SparkOptions
instance ToRenderable SparkLine


-- | A framework for creating 2D charts in Haskell.
--   
--   The basic model is that you define a value of type <a>Renderable</a>,
--   typically by applying <a>toRenderable</a> to some other value. This
--   <a>Renderable</a> is then actually displayed or output by calling
--   either <a>renderableToPNGFile</a>, or <tt>renderableToWindow</tt>.
--   
--   Currently, there are two kinds of <a>Renderable</a> for displaying
--   charts:
--   
--   <ul>
--   <li>a standard two axes chart can be is created by applying
--   <a>toRenderable</a> to a value of type <a>Layout1</a></li>
--   <li>a pie chart can be is created by applying <a>toRenderable</a> to a
--   value of type <a>PieLayout</a></li>
--   </ul>
--   
--   Multiple Renderables can be composed using the
--   <a>Graphics.Rendering.Chart.Grid</a> module.
--   
--   Many of the record structure involved in the API have a large number
--   of fields. For each record type X, there is generally a default value
--   called defaultX with sensibly initialised fields. For example,
--   <a>Layout1</a> has <a>defaultLayout1</a>, etc.
--   
--   For a simpler though less flexible API, see
--   <a>Graphics.Rendering.Chart.Simple</a>.
module Graphics.Rendering.Chart

module Graphics.Rendering.Chart.Simple.Internal
styleColor :: Int -> AlphaColour Double
styleSymbol :: Int -> PlotKind
iplot :: [InternalPlot Double Double] -> Layout1 Double Double
name :: [PlotKind] -> String
str2k :: String -> [PlotKind]
str2khelper :: String -> PlotKind -> [PlotKind]

-- | Type to define a few simple properties of each plot.
data PlotKind
Name :: String -> PlotKind
FilledCircle :: PlotKind
HollowCircle :: PlotKind
Triangle :: PlotKind
DownTriangle :: PlotKind
Square :: PlotKind
Diamond :: PlotKind
Plus :: PlotKind
Ex :: PlotKind
Star :: PlotKind
Symbols :: PlotKind
LittleDot :: PlotKind
Dashed :: PlotKind
Dotted :: PlotKind
Solid :: PlotKind
data InternalPlot x y
IPY :: [y] -> [PlotKind] -> InternalPlot x y
IPX :: [x] -> [PlotKind] -> InternalPlot x y
newtype Layout1DDD
Layout1DDD :: Layout1 Double Double -> Layout1DDD
plotLayout :: Layout1DDD -> Layout1 Double Double
uplot :: [UPlot] -> Layout1DDD

-- | The main plotting function. The idea behind PlotType is shamelessly
--   copied from Text.Printf (and is not exported). All you need to know is
--   that your arguments need to be in class PlotArg. And PlotArg consists
--   of functions and [Double] and String and PlotKind or [PlotKind].
plot :: PlotType a => a
class PlotType t
pl :: PlotType t => [UPlot] -> t

-- | Save a plot as a PDF file.
plotPDF :: PlotPDFType a => String -> a
class PlotPDFType t
pld :: PlotPDFType t => FilePath -> [UPlot] -> t

-- | Save a plot as a postscript file.
plotPS :: PlotPSType a => String -> a
class PlotPSType t
pls :: PlotPSType t => FilePath -> [UPlot] -> t

-- | Save a plot as a png file.
plotPNG :: PlotPNGType a => String -> a
class PlotPNGType t
plp :: PlotPNGType t => FilePath -> [UPlot] -> t
data UPlot
UString :: String -> UPlot
UDoubles :: [Double] -> UPlot
UFunction :: (Double -> Double) -> UPlot
UKind :: [PlotKind] -> UPlot
X :: [Double] -> UPlot
xcoords :: [Double] -> UPlot
class PlotArg a
toUPlot :: PlotArg a => a -> [UPlot]
class IsPlot c
toUPlot' :: IsPlot c => [c] -> [UPlot]
instance Eq PlotKind
instance Show PlotKind
instance Ord PlotKind
instance (IsPlot p, IsPlot q) => IsPlot (p, q)
instance (IsPlot p, IsPlot q, IsPlot r) => IsPlot (p, q, r)
instance IsPlot p => IsPlot [p]
instance IsPlot Char
instance IsPlot Double
instance IsPlot PlotKind
instance PlotArg PlotKind
instance PlotArg UPlot
instance (Real a, Real b, Fractional a, Fractional b) => IsPlot (a -> b)
instance (Real a, Real b, Fractional a, Fractional b) => PlotArg (a -> b)
instance IsPlot p => PlotArg [p]
instance PlotPNGType (IO a)
instance (PlotArg a, PlotPNGType r) => PlotPNGType (a -> r)
instance PlotPSType (IO a)
instance (PlotArg a, PlotPSType r) => PlotPSType (a -> r)
instance PlotPDFType (IO a)
instance (PlotArg a, PlotPDFType r) => PlotPDFType (a -> r)
instance PlotType Layout1DDD
instance (PlotArg a, PlotType r) => PlotType (a -> r)
instance ToRenderable Layout1DDD


-- | An even simpler framework for creating 2D charts in Haskell.
--   
--   The basic idea is to make it as easy to plot as octave, which means
--   that you provide no more information than you wish to provide. We
--   provide four plotting functions, which differ only in their output.
--   One produces a <a>Layout1</a> that you can customize using other
--   Graphics.Rendering.Chart functions. The other three produce their
--   output directly. All three accept the same input and produce the same
--   plots.
--   
--   The plot functions accept a variable number of arguments. You must
--   provide a [Double] which defines the points on the x axis, which must
--   precede any of the <a>y</a> values. The y values may either be
--   [Double] or functions. After any given y value, you can give either
--   Strings or PlotKinds describing how you'd like that y printed.
--   
--   Examples:
--   
--   <pre>
--   plotPDF "foo.pdf" [0,0.1..10] sin "- " cos ". " cos "o"
--   </pre>
--   
--   <pre>
--   plotPS "foo.ps" [0,0.1..10] (sin . exp) "- " (sin . exp) "o-"
--   </pre>
module Graphics.Rendering.Chart.Simple

-- | The main plotting function. The idea behind PlotType is shamelessly
--   copied from Text.Printf (and is not exported). All you need to know is
--   that your arguments need to be in class PlotArg. And PlotArg consists
--   of functions and [Double] and String and PlotKind or [PlotKind].
plot :: PlotType a => a

-- | Type to define a few simple properties of each plot.
data PlotKind
Name :: String -> PlotKind
FilledCircle :: PlotKind
HollowCircle :: PlotKind
Triangle :: PlotKind
DownTriangle :: PlotKind
Square :: PlotKind
Diamond :: PlotKind
Plus :: PlotKind
Ex :: PlotKind
Star :: PlotKind
Symbols :: PlotKind
LittleDot :: PlotKind
Dashed :: PlotKind
Dotted :: PlotKind
Solid :: PlotKind
xcoords :: [Double] -> UPlot

-- | Save a plot as a PDF file.
plotPDF :: PlotPDFType a => String -> a

-- | Save a plot as a postscript file.
plotPS :: PlotPSType a => String -> a
plotLayout :: Layout1DDD -> Layout1 Double Double

-- | Save a plot as a png file.
plotPNG :: PlotPNGType a => String -> a
data Layout1DDD
