Safe Haskell | None |
---|
A framework for creating 2D charts in Haskell.
The basic model is that you define a value of type Renderable
,
typically by applying toRenderable
to some other value. This
Renderable
is then actually displayed or output by calling either
renderableToPNGFile
, or renderableToWindow
.
Currently, the only useful Renderable
for displaying charts
is created by applying toRenderable
to a value of type
Layout1
For a simpler though less flexible API, see Graphics.Rendering.Chart.Simple.
- data Renderable = Renderable {}
- class ToRenderable a where
- toRenderable :: a -> Renderable
- data Layout1 = Layout1 {}
- data Axis = Axis {
- axis_viewport :: Range -> Double -> Double
- axis_title :: String
- axis_ticks :: [(Double, Double)]
- axis_labels :: [(Double, String)]
- axis_grid :: [Double]
- axis_label_gap :: Double
- axis_title_style :: CairoFontStyle
- axis_line_style :: CairoLineStyle
- axis_label_style :: CairoFontStyle
- axis_grid_style :: CairoLineStyle
- data Plot = Plot {
- plot_render :: PointMapFn -> CRender ()
- plot_render_legend :: Rect -> CRender ()
- plot_all_points :: [Point]
- class ToPlot a where
- data PlotPoints = PlotPoints {}
- data PlotErrBars = PlotErrBars {}
- data PlotLines = PlotLines {}
- data PlotFillBetween = PlotFillBetween {}
- data HAxis
- data VAxis
- data Rect = Rect Point Point
- data Point = Point {}
- data Color = Color {}
- data ErrPoint = ErrPoint {}
- defaultAxisLineStyle :: CairoLineStyle
- defaultPlotLineStyle :: CairoLineStyle
- defaultAxis :: Axis
- defaultPlotPoints :: PlotPoints
- defaultPlotErrBars :: PlotErrBars
- defaultPlotLines :: PlotLines
- defaultPlotFillBetween :: PlotFillBetween
- defaultLayout1 :: Layout1
- filledCircles :: Double -> Color -> CairoPointStyle
- hollowCircles :: Double -> Double -> Color -> CairoPointStyle
- exes :: Double -> Double -> Color -> CairoPointStyle
- plusses :: Double -> Double -> Color -> CairoPointStyle
- stars :: Double -> Double -> Color -> CairoPointStyle
- filledPolygon :: Double -> Int -> Bool -> Color -> CairoPointStyle
- hollowPolygon :: Double -> Double -> Int -> Bool -> Color -> CairoPointStyle
- solidLine :: Double -> Color -> CairoLineStyle
- dashedLine :: Double -> [Double] -> Color -> CairoLineStyle
- solidFillStyle :: Color -> CairoFillStyle
- fontStyle :: String -> Double -> FontSlant -> FontWeight -> CairoFontStyle
- independentAxes :: AxisFn -> AxisFn -> AxesFn
- linkedAxes :: AxisFn -> AxesFn
- linkedAxes' :: AxisFn -> AxesFn
- explicitAxis :: Maybe Axis -> AxisFn
- autoScaledAxis :: Axis -> AxisFn
- autoScaledAxis' :: (Double -> String) -> Axis -> AxisFn
- autoScaledLogAxis :: Axis -> AxisFn
- autoScaledLogAxis' :: (Double -> String) -> Axis -> AxisFn
- timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> Axis -> AxisFn
- autoTimeAxis :: Axis -> AxisFn
- formatTime :: String -> TimeLabelFn
- days :: TimeSeq
- months :: TimeSeq
- years :: TimeSeq
- renderableToPNGFile :: Renderable -> Int -> Int -> FilePath -> IO ()
- renderableToPDFFile :: Renderable -> Int -> Int -> FilePath -> IO ()
- renderableToPSFile :: Renderable -> Int -> Int -> FilePath -> IO ()
- doubleFromClockTime :: ClockTime -> Double
- clockTimeFromDouble :: Double -> ClockTime
- newtype CairoLineStyle = CairoLineStyle (CRender ())
- newtype CairoFillStyle = CairoFillStyle (CRender ())
- newtype CairoFontStyle = CairoFontStyle (CRender ())
Documentation
data Renderable Source
A Renderable is a record of functions required to layout a graphic element.
class ToRenderable a whereSource
A type class abtracting the conversion of a value to a Renderable.
toRenderable :: a -> RenderableSource
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.
The concrete data type for an axis
Axis | |
|
Interface to control plotting on a 2D area.
Plot | |
|
a type class abstracting the conversion of a value to a Plot.
data PlotPoints Source
Value defining a series of datapoints, and a style in which to render them
data PlotErrBars Source
Value defining a series of error intervals, and a style in which to render them
Value defining a series of (possibly disjointed) lines, and a style in which to render them
data PlotFillBetween Source
Value specifying a plot filling the area between two sets of Y coordinates, given common X coordinates.
Value for holding a point with associated error bounds for each axis.
:: Double | radius of circle |
-> Color | colour |
-> CairoPointStyle |
:: Double | radius of circle |
-> Double | thickness of line |
-> Color | |
-> CairoPointStyle |
:: Double | radius of circle |
-> Int | Number of vertices |
-> Bool | Is right-side-up? |
-> Color | |
-> CairoPointStyle |
:: Double | width of line |
-> Color | |
-> CairoLineStyle |
:: Double | width of line |
-> [Double] | the dash pattern in device coordinates |
-> Color | |
-> CairoLineStyle |
:: String | the font name |
-> Double | the font size |
-> FontSlant | the font slant |
-> FontWeight | the font weight |
-> CairoFontStyle |
independentAxes :: AxisFn -> AxisFn -> AxesFnSource
Show independent axes on each side of the layout
linkedAxes :: AxisFn -> AxesFnSource
Show the same axis on both sides of the layout
linkedAxes' :: AxisFn -> AxesFnSource
Show the same axis on both sides of the layout, but with labels only on the primary side
explicitAxis :: Maybe Axis -> AxisFnSource
Explicitly specify an axis
autoScaledAxis :: Axis -> AxisFnSource
autoScaledAxis' :: (Double -> String) -> Axis -> AxisFnSource
Generate a linear axis automatically. The supplied axis is used as a template, with the viewport, ticks, labels and grid set appropriately for the data displayed against that axies. The resulting axis will only show a grid if the template has some grid values.
autoScaledLogAxis' :: (Double -> String) -> Axis -> AxisFnSource
Generate a log axis automatically. The supplied axis is used as a template, with the viewport, ticks, labels and grid set appropriately for the data displayed against that axies. The resulting axis will only show a grid if the template has some grid values.
timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> Axis -> AxisFnSource
Create an AxisFn
to for a time axis. The first TimeSeq
sets the minor ticks,
and the ultimate range will aligned to it's elements. The second TimeSeq
sets
the labels and grid. The TimeLabelFn
is used to format clocktimes for labels.
The values to be plotted against this axis can be created with doubleFromClockTime
autoTimeAxis :: Axis -> AxisFnSource
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 doubleFromClockTime
formatTime :: String -> TimeLabelFnSource
Use an strftime() formatted string to display a time
renderableToPNGFile :: Renderable -> Int -> Int -> FilePath -> IO ()Source
Output the given renderable to a PNG file of the specifed size (in pixels), to the specified file.
renderableToPDFFile :: Renderable -> Int -> Int -> FilePath -> IO ()Source
Output the given renderable to a PDF file of the specifed size (in points), to the specified file.
renderableToPSFile :: Renderable -> Int -> Int -> FilePath -> IO ()Source
Output the given renderable to a postscript file of the specifed size (in points), to the specified file.
doubleFromClockTime :: ClockTime -> DoubleSource
Map a clocktime value to a plot cordinate
clockTimeFromDouble :: Double -> ClockTimeSource
Map a plot cordinate to a clocktime
newtype CairoLineStyle Source
Abstract data type for the style of a line
The contained Cairo action sets the required line in the Cairo rendering state.
CairoLineStyle (CRender ()) |
newtype CairoFillStyle Source
Abstract data type for a fill style
The contained Cairo action sets the required fill style in the Cairo rendering state.
CairoFillStyle (CRender ()) |
newtype CairoFontStyle Source
Abstract data type for a font.
The contained Cairo action sets the required font in the Cairo rendering state.
CairoFontStyle (CRender ()) |