-- 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, with backends provided -- by Cairo (http://hackage.haskell.org/package/Chart-cairo) and -- Diagrams (http://hackage.haskell.org/package/Chart-diagrams). -- Documentation: https://github.com/timbod7/haskell-chart/wiki. @package Chart @version 1.8.3 module Graphics.Rendering.Chart.Geometry -- | 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 -- | A vector in two dimensions. data Vector Vector :: Double -> Double -> Vector [v_x] :: Vector -> Double [v_y] :: Vector -> Double type RectSize = (Double, Double) type Range = (Double, Double) -- | Convert a Point to a Vector. pointToVec :: Point -> Vector -- | Create a rectangle based upon the coordinates of 4 points. mkrect :: Point -> Point -> Point -> Point -> Rect -- | Make a path from a rectangle. rectPath :: Rect -> Path -- | 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 -- | Angle of a vector (counterclockwise from positive x-axis) vangle :: Vector -> Double -- | Length/magnitude of a vector vlen :: Vector -> Double -- | Scale a vector by a constant. vscale :: Double -> Vector -> Vector -- | Test if a point is within a rectangle. within :: Point -> Rect -> Bool -- | Intersects the rectangles. If they intersect the intersection -- rectangle is returned. LMin is the empty rectangle / -- intersection and LMax is the infinite plane. intersectRect :: Limit Rect -> Limit Rect -> Limit Rect -- | Edge of a rectangle. 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 -- | The path type used by Charts. -- -- A path can consist of several subpaths. Each is started by a -- MoveTo operation. All subpaths are open, except the last one, -- which may be closed using the Close operation. When filling a -- path all subpaths are closed implicitly. -- -- Closing a subpath means that a line is drawn from the end point to the -- start point of the subpath. -- -- If a Arc (or ArcNeg) is drawn a implicit line from the -- last end point of the subpath is drawn to the beginning of the arc. -- Another implicit line is drawn from the end of an arc to the beginning -- of the next path segment. -- -- The beginning of a subpath is either (0,0) or set by a MoveTo -- instruction. If the first subpath is started with an arc the beginning -- of that subpath is the beginning of the arc. data Path MoveTo :: Point -> Path -> Path LineTo :: Point -> Path -> Path Arc :: Point -> Double -> Double -> Double -> Path -> Path ArcNeg :: Point -> Double -> Double -> Double -> Path -> Path End :: Path Close :: Path -- | Move the paths pointer to the given location and draw a straight line -- while doing so. lineTo :: Point -> Path -- | Move the paths pointer to the given location. moveTo :: Point -> Path -- | Short-cut for lineTo, if you don't want to create a -- Point. lineTo' :: Double -> Double -> Path -- | Short-cut for moveTo, if you don't want to create a -- Point. moveTo' :: Double -> Double -> Path -- | Draw the arc of a circle. A straight line connects the end of the -- previous path with the beginning of the arc. The zero angle points in -- direction of the positive x-axis. Angles increase in clock-wise -- direction. If the stop angle is smaller then the start angle it is -- increased by multiples of 2 * pi until is is greater or -- equal. arc :: Point -> Double -> Double -> Double -> Path -- | Short-cut for arc, if you don't want to create a Point. arc' :: Double -> Double -> Double -> Double -> Double -> Path -- | Like arc, but draws from the stop angle to the start angle -- instead of between them. arcNeg :: Point -> Double -> Double -> Double -> Path -- | Short-cut for arcNeg, if you don't want to create a -- Point. arcNeg' :: Double -> Double -> Double -> Double -> Double -> Path -- | A closed empty path. Closes a path when appended. close :: Path -- | Fold the given path to a monoid structure. foldPath :: (Monoid m) => (Point -> m) -> (Point -> m) -> (Point -> Double -> Double -> Double -> m) -> (Point -> Double -> Double -> Double -> m) -> m -> Path -> m -- | Enriches the path with explicit instructions to draw lines, that -- otherwise would be implicit. See Path for details about what -- lines in paths are implicit. makeLinesExplicit :: Path -> Path -- | Transform a point using the given matrix. transformP :: Matrix -> Point -> Point -- | Scale a point. scaleP :: Vector -> Point -> Point -- | Rotate a point around the origin. The angle is given in radians. rotateP :: Double -> Point -> Point -- | Translate a point. translateP :: Vector -> Point -> Point -- | Copied from Graphics.Rendering.Cairo.Matrix data Matrix Matrix :: !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> Matrix [xx] :: Matrix -> !Double [yx] :: Matrix -> !Double [xy] :: Matrix -> !Double [yy] :: Matrix -> !Double [x0] :: Matrix -> !Double [y0] :: Matrix -> !Double -- | Copied from Graphics.Rendering.Cairo.Matrix identity :: Matrix -- | Copied from Graphics.Rendering.Cairo.Matrix Rotations angle is given -- in radians. rotate :: Double -> Matrix -> Matrix -- | Copied and adopted from Graphics.Rendering.Cairo.Matrix scale :: Vector -> Matrix -> Matrix -- | Copied and adopted from Graphics.Rendering.Cairo.Matrix translate :: Vector -> Matrix -> Matrix -- | Copied from Graphics.Rendering.Cairo.Matrix scalarMultiply :: Double -> Matrix -> Matrix -- | Copied from Graphics.Rendering.Cairo.Matrix adjoint :: Matrix -> Matrix -- | Copied from Graphics.Rendering.Cairo.Matrix invert :: Matrix -> Matrix instance GHC.Show.Show Graphics.Rendering.Chart.Geometry.Matrix instance GHC.Show.Show Graphics.Rendering.Chart.Geometry.Rect instance GHC.Show.Show a => GHC.Show.Show (Graphics.Rendering.Chart.Geometry.Limit a) instance GHC.Show.Show Graphics.Rendering.Chart.Geometry.Vector instance GHC.Show.Show Graphics.Rendering.Chart.Geometry.Point instance GHC.Num.Num Graphics.Rendering.Chart.Geometry.Matrix instance GHC.Base.Monoid Graphics.Rendering.Chart.Geometry.Path module Graphics.Rendering.Chart.Backend.Types -- | The different supported line ends. data LineCap -- | Just cut the line straight. LineCapButt :: LineCap -- | Make a rounded line end. LineCapRound :: LineCap -- | Make a square that ends the line. LineCapSquare :: LineCap -- | The different supported ways to join line ends. data LineJoin -- | Extends the outline until they meet each other. LineJoinMiter :: LineJoin -- | Draw a circle fragment to connet line end. LineJoinRound :: LineJoin -- | Like miter, but cuts it off if a certain threshold is exceeded. LineJoinBevel :: LineJoin -- | Data type for the style of a line. data LineStyle LineStyle :: Double -> AlphaColour Double -> [Double] -> LineCap -> LineJoin -> LineStyle -- | The thickness of a line in device units. [_line_width] :: LineStyle -> Double -- | The color of a line. [_line_color] :: LineStyle -> AlphaColour Double -- | The dash pattern. Every value at a even index gives a dash width and -- every value at a odd index gives a gap width in device units. [_line_dashes] :: LineStyle -> [Double] -- | How to end a line. [_line_cap] :: LineStyle -> LineCap -- | How to connect two lines. [_line_join] :: LineStyle -> LineJoin -- | The default line style. -- | The possible slants of a font. data FontSlant -- | Normal font style without slant. FontSlantNormal :: FontSlant -- | With a slight slant. FontSlantItalic :: FontSlant -- | With a greater slant. FontSlantOblique :: FontSlant -- | The default font slant. -- | The possible weights of a font. data FontWeight -- | Normal font style without weight. FontWeightNormal :: FontWeight -- | Bold font. FontWeightBold :: FontWeight -- | The default font weight. -- | Data type for a font. data FontStyle FontStyle :: String -> Double -> FontSlant -> FontWeight -> AlphaColour Double -> FontStyle -- | The font family or font face to use. [_font_name] :: FontStyle -> String -- | The height of the rendered font in device coordinates. [_font_size] :: FontStyle -> Double -- | The slant to render with. [_font_slant] :: FontStyle -> FontSlant -- | The weight to render with. [_font_weight] :: FontStyle -> FontWeight -- | The color to render text with. [_font_color] :: FontStyle -> AlphaColour Double -- | The default font style. -- | Possible horizontal anchor points for text. data HTextAnchor HTA_Left :: HTextAnchor HTA_Centre :: HTextAnchor HTA_Right :: HTextAnchor -- | Possible vertical anchor points for text. data VTextAnchor VTA_Top :: VTextAnchor VTA_Centre :: VTextAnchor VTA_Bottom :: VTextAnchor VTA_BaseLine :: VTextAnchor -- | Text metrics returned by textSize. data TextSize TextSize :: Double -> Double -> Double -> Double -> Double -> TextSize -- | The total width of the text. [textSizeWidth] :: TextSize -> Double -- | The ascent or space above the baseline. [textSizeAscent] :: TextSize -> Double -- | The decent or space below the baseline. [textSizeDescent] :: TextSize -> Double -- | The Y bearing. [textSizeYBearing] :: TextSize -> Double -- | The total height of the text. [textSizeHeight] :: TextSize -> Double -- | Abstract data type for a fill style. -- -- The contained action sets the required fill style in the rendering -- state. newtype FillStyle FillStyleSolid :: AlphaColour Double -> FillStyle [_fill_color] :: FillStyle -> AlphaColour Double -- | The default fill style. -- | A function to align points for a certain rendering device. type AlignmentFn = Point -> Point -- | Holds the point and coordinate alignment function. data AlignmentFns AlignmentFns :: AlignmentFn -> AlignmentFn -> AlignmentFns -- | 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. -- -- This is usually used to align prior to stroking. [afPointAlignFn] :: AlignmentFns -> AlignmentFn -- | The adjustment applied immediately prior to coordinates being -- transformed. -- -- This is usually used to align prior to filling. [afCoordAlignFn] :: AlignmentFns -> AlignmentFn -- | Alignment to render on raster based graphics. bitmapAlignmentFns :: AlignmentFns -- | Alignment to render on vector based graphics. vectorAlignmentFns :: AlignmentFns line_width :: Lens' LineStyle Double line_join :: Lens' LineStyle LineJoin line_dashes :: Lens' LineStyle [Double] line_color :: Lens' LineStyle (AlphaColour Double) line_cap :: Lens' LineStyle LineCap font_weight :: Lens' FontStyle FontWeight font_slant :: Lens' FontStyle FontSlant font_size :: Lens' FontStyle Double font_name :: Lens' FontStyle String font_color :: Lens' FontStyle (AlphaColour Double) fill_color :: Iso' FillStyle (AlphaColour Double) instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.FillStyle instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.FillStyle instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.TextSize instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.TextSize instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.VTextAnchor instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.VTextAnchor instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.VTextAnchor instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.HTextAnchor instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.HTextAnchor instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.HTextAnchor instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.FontStyle instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.FontStyle instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.FontWeight instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.FontWeight instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.FontWeight instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.FontSlant instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.FontSlant instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.FontSlant instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.LineStyle instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.LineStyle instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.LineJoin instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.LineJoin instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.LineJoin instance GHC.Classes.Ord Graphics.Rendering.Chart.Backend.Types.LineCap instance GHC.Classes.Eq Graphics.Rendering.Chart.Backend.Types.LineCap instance GHC.Show.Show Graphics.Rendering.Chart.Backend.Types.LineCap instance Data.Default.Class.Default Graphics.Rendering.Chart.Backend.Types.FillStyle instance Data.Default.Class.Default Graphics.Rendering.Chart.Backend.Types.FontStyle instance Data.Default.Class.Default Graphics.Rendering.Chart.Backend.Types.FontWeight instance Data.Default.Class.Default Graphics.Rendering.Chart.Backend.Types.FontSlant instance Data.Default.Class.Default Graphics.Rendering.Chart.Backend.Types.LineStyle -- | This module provides the implementation details common to all -- ChartBackends. module Graphics.Rendering.Chart.Backend.Impl -- | The abstract drawing operation generated when using the the chart -- drawing API. -- -- See the documentation of the different function for the correct -- semantics of each instruction: -- --
-- f :: Control.Lens.Lens' D F --module Graphics.Rendering.Chart.Drawing -- | The different shapes a point can have. data PointShape -- | A circle. PointShapeCircle :: PointShape -- | Number of vertices and is right-side-up? PointShapePolygon :: Int -> Bool -> PointShape -- | A plus sign. PointShapePlus :: PointShape -- | A cross. PointShapeCross :: PointShape -- | Combination of a cross and a plus. PointShapeStar :: PointShape PointShapeArrowHead :: Double -> PointShape -- | Ratio of minor to major axis and rotation PointShapeEllipse :: Double -> Double -> PointShape -- | Abstract data type for the style of a plotted point. data PointStyle PointStyle :: AlphaColour Double -> AlphaColour Double -> Double -> Double -> PointShape -> PointStyle -- | The color to fill the point with. [_point_color] :: PointStyle -> AlphaColour Double -- | The color to stroke the outline with. [_point_border_color] :: PointStyle -> AlphaColour Double -- | The width of the outline. [_point_border_width] :: PointStyle -> Double -- | The radius of the tightest surrounding circle of the point. [_point_radius] :: PointStyle -> Double -- | The shape. [_point_shape] :: PointStyle -> PointShape -- | Draw a single point at the given location. drawPoint :: PointStyle -> Point -> BackendProgram () -- | Align the path by applying the given function on all points. alignPath :: (Point -> Point) -> Path -> Path -- | Align the path using the environment's alignment function for -- coordinates. This is generally useful when filling. See -- alignPath and getCoordAlignFn. alignFillPath :: Path -> BackendProgram Path -- | Align the path using the environment's alignment function for points. -- This is generally useful when stroking. See alignPath and -- getPointAlignFn. alignStrokePath :: Path -> BackendProgram Path -- | The points will be aligned by the getCoordAlignFn, so that when -- drawing bitmaps, the edges of the region will fall between pixels. alignFillPoints :: [Point] -> BackendProgram [Point] -- | The points will be aligned by the getPointAlignFn, so that when -- drawing bitmaps, 1 pixel wide lines will be centred on the pixels. alignStrokePoints :: [Point] -> BackendProgram [Point] -- | Align the point using the environment's alignment function for -- coordinates. See getCoordAlignFn. alignFillPoint :: Point -> BackendProgram Point -- | Align the point using the environment's alignment function for points. -- See getPointAlignFn. alignStrokePoint :: Point -> BackendProgram Point -- | Draw lines between the specified points. strokePointPath :: [Point] -> BackendProgram () -- | Fill the region with the given corners. fillPointPath :: [Point] -> BackendProgram () -- | Apply a local rotation. The angle is given in radians. withRotation :: Double -> BackendProgram a -> BackendProgram a -- | Apply a local translation. withTranslation :: Point -> BackendProgram a -> BackendProgram a -- | Apply a local scale. withScale :: Vector -> BackendProgram a -> BackendProgram a -- | Apply a local scale on the x-axis. withScaleX :: Double -> BackendProgram a -> BackendProgram a -- | Apply a local scale on the y-axis. withScaleY :: Double -> BackendProgram a -> BackendProgram a -- | Changes the LineStyle and FillStyle to comply with the -- given PointStyle. withPointStyle :: PointStyle -> BackendProgram a -> BackendProgram a withDefaultStyle :: BackendProgram a -> BackendProgram a -- | Draw a line of text that is aligned at a different anchor point. See -- drawText. drawTextA :: HTextAnchor -> VTextAnchor -> Point -> String -> BackendProgram () -- | 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. See drawText. drawTextR :: HTextAnchor -> VTextAnchor -> Double -> Point -> String -> BackendProgram () -- | 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. See drawText. drawTextsR :: HTextAnchor -> VTextAnchor -> Double -> Point -> String -> BackendProgram () -- | Return the bounding rectangle for a text string positioned where it -- would be drawn by drawText. See textSize. textDrawRect :: HTextAnchor -> VTextAnchor -> Point -> String -> BackendProgram Rect -- | Get the width and height of the string when rendered. See -- textSize. textDimension :: String -> BackendProgram RectSize -- | The default sequence of colours to use when plotings different data -- sets in a graph. defaultColorSeq :: [AlphaColour Double] -- | Create a solid line style (not dashed). solidLine :: Double -> AlphaColour Double -> LineStyle -- | Create a dashed line style. dashedLine :: Double -> [Double] -> AlphaColour Double -> LineStyle -- | Style for filled circle points. filledCircles :: Double -> AlphaColour Double -> PointStyle -- | Style for stroked circle points. hollowCircles :: Double -> Double -> AlphaColour Double -> PointStyle -- | Style for filled polygon points. filledPolygon :: Double -> Int -> Bool -> AlphaColour Double -> PointStyle -- | Style for stroked polygon points. hollowPolygon :: Double -> Double -> Int -> Bool -> AlphaColour Double -> PointStyle -- | Plus sign point style. plusses :: Double -> Double -> AlphaColour Double -> PointStyle -- | Cross point style. exes :: Double -> Double -> AlphaColour Double -> PointStyle -- | Combination of plus and cross point style. stars :: Double -> Double -> AlphaColour Double -> PointStyle arrows :: Double -> Double -> Double -> AlphaColour Double -> PointStyle -- | Fill style that fill everything this the given colour. solidFillStyle :: AlphaColour Double -> FillStyle point_color :: Lens' PointStyle (AlphaColour Double) point_border_color :: Lens' PointStyle (AlphaColour Double) point_border_width :: Lens' PointStyle Double point_radius :: Lens' PointStyle Double point_shape :: Lens' PointStyle PointShape instance Data.Default.Class.Default Graphics.Rendering.Chart.Drawing.PointStyle -- | 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 -> BackendProgram ()) -> [(String, Rect -> BackendProgram ())] -> ([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 -> BackendProgram () -- | 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 -> BackendProgram ())] -- | 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 :: forall x_apPL y_apPM. Lens' (Plot x_apPL y_apPM) (PointMapFn x_apPL y_apPM -> BackendProgram ()) plot_legend :: forall x_apPL y_apPM. Lens' (Plot x_apPL y_apPM) [(String, Rect -> BackendProgram ())] plot_all_points :: forall x_apPL y_apPM. Lens' (Plot x_apPL y_apPM) ([x_apPL], [y_apPM]) instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Types.Plot -- | 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 -> PointStyle -> [(x, y)] -> PlotPoints x y [_plot_points_title] :: PlotPoints x y -> String [_plot_points_style] :: PlotPoints x y -> PointStyle [_plot_points_values] :: PlotPoints x y -> [(x, y)] plot_points_title :: forall x_aqd7 y_aqd8. Lens' (PlotPoints x_aqd7 y_aqd8) String plot_points_style :: forall x_aqd7 y_aqd8. Lens' (PlotPoints x_aqd7 y_aqd8) PointStyle plot_points_values :: forall x_aqd7 y_aqd8 x_aqh5 y_aqh6. Lens (PlotPoints x_aqd7 y_aqd8) (PlotPoints x_aqh5 y_aqh6) [(x_aqd7, y_aqd8)] [(x_aqh5, y_aqh6)] instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Points.PlotPoints instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Points.PlotPoints 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 -> LineStyle -> [[(x, y)]] -> [[(Limit x, Limit y)]] -> PlotLines x y [_plot_lines_title] :: PlotLines x y -> String [_plot_lines_style] :: PlotLines x y -> LineStyle -- | 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)]] defaultPlotLineStyle :: LineStyle -- | Helper function to plot a single horizontal line. hlinePlot :: String -> LineStyle -> b -> Plot a b -- | Helper function to plot a single vertical line. vlinePlot :: String -> LineStyle -> a -> Plot a b plot_lines_title :: forall x_aqGG y_aqGH. Lens' (PlotLines x_aqGG y_aqGH) String plot_lines_style :: forall x_aqGG y_aqGH. Lens' (PlotLines x_aqGG y_aqGH) LineStyle plot_lines_values :: forall x_aqGG y_aqGH. Lens' (PlotLines x_aqGG y_aqGH) [[(x_aqGG, y_aqGH)]] plot_lines_limit_values :: forall x_aqGG y_aqGH. Lens' (PlotLines x_aqGG y_aqGH) [[(Limit x_aqGG, Limit y_aqGH)]] instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Lines.PlotLines instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Lines.PlotLines x y) -- | 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 are not -- displayed, but they 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] plot_hidden_x_values :: forall x_arwk y_arwl x_arxk. Lens (PlotHidden x_arwk y_arwl) (PlotHidden x_arxk y_arwl) [x_arwk] [x_arxk] plot_hidden_y_values :: forall x_arwk y_arwl y_arxl. Lens (PlotHidden x_arwk y_arwl) (PlotHidden x_arwk y_arxl) [y_arwl] [y_arxl] instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Hidden.PlotHidden -- | 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 -> FillStyle -> [(x, (y, y))] -> PlotFillBetween x y [_plot_fillbetween_title] :: PlotFillBetween x y -> String [_plot_fillbetween_style] :: PlotFillBetween x y -> FillStyle [_plot_fillbetween_values] :: PlotFillBetween x y -> [(x, (y, y))] plot_fillbetween_title :: forall x_arI8 y_arI9. Lens' (PlotFillBetween x_arI8 y_arI9) String plot_fillbetween_style :: forall x_arI8 y_arI9. Lens' (PlotFillBetween x_arI8 y_arI9) FillStyle plot_fillbetween_values :: forall x_arI8 y_arI9 x_arMX y_arMY. Lens (PlotFillBetween x_arI8 y_arI9) (PlotFillBetween x_arMX y_arMY) [(x_arI8, (y_arI9, y_arI9))] [(x_arMX, (y_arMY, y_arMY))] instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.FillBetween.PlotFillBetween instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.FillBetween.PlotFillBetween x y) -- | 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 -> LineStyle -> Double -> Double -> [ErrPoint x y] -> PlotErrBars x y [_plot_errbars_title] :: PlotErrBars x y -> String [_plot_errbars_line_style] :: PlotErrBars x y -> LineStyle [_plot_errbars_tick_length] :: PlotErrBars x y -> Double [_plot_errbars_overhang] :: PlotErrBars x y -> Double [_plot_errbars_values] :: PlotErrBars x y -> [ErrPoint 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 :: forall x_asp7 y_asp8. Lens' (PlotErrBars x_asp7 y_asp8) String plot_errbars_line_style :: forall x_asp7 y_asp8. Lens' (PlotErrBars x_asp7 y_asp8) LineStyle plot_errbars_tick_length :: forall x_asp7 y_asp8. Lens' (PlotErrBars x_asp7 y_asp8) Double plot_errbars_overhang :: forall x_asp7 y_asp8. Lens' (PlotErrBars x_asp7 y_asp8) Double plot_errbars_values :: forall x_asp7 y_asp8 x_asC2 y_asC3. Lens (PlotErrBars x_asp7 y_asp8) (PlotErrBars x_asC2 y_asC3) [ErrPoint x_asp7 y_asp8] [ErrPoint x_asC2 y_asC3] instance (GHC.Show.Show y, GHC.Show.Show x) => GHC.Show.Show (Graphics.Rendering.Chart.Plot.ErrBars.ErrPoint x y) instance GHC.Show.Show x => GHC.Show.Show (Graphics.Rendering.Chart.Plot.ErrBars.ErrValue x) instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.ErrBars.PlotErrBars instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.ErrBars.PlotErrBars x y) -- | 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 < close) or falls (close < 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 -> LineStyle -> Bool -> FillStyle -> FillStyle -> Double -> Double -> Double -> [Candle x y] -> PlotCandle x y [_plot_candle_title] :: PlotCandle x y -> String [_plot_candle_line_style] :: PlotCandle x y -> LineStyle [_plot_candle_fill] :: PlotCandle x y -> Bool [_plot_candle_rise_fill_style] :: PlotCandle x y -> FillStyle [_plot_candle_fall_fill_style] :: PlotCandle x y -> FillStyle [_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 plot_candle_title :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) String plot_candle_line_style :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) LineStyle plot_candle_tick_length :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) Double plot_candle_width :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) Double plot_candle_centre :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) Double plot_candle_fill :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) Bool plot_candle_rise_fill_style :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) FillStyle plot_candle_fall_fill_style :: forall x_auqG y_auqH. Lens' (PlotCandle x_auqG y_auqH) FillStyle plot_candle_values :: forall x_auqG y_auqH x_auE4 y_auE5. Lens (PlotCandle x_auqG y_auqH) (PlotCandle x_auE4 y_auE5) [Candle x_auqG y_auqH] [Candle x_auE4 y_auE5] instance (GHC.Show.Show y, GHC.Show.Show x) => GHC.Show.Show (Graphics.Rendering.Chart.Plot.Candle.Candle x y) instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Candle.PlotCandle instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Candle.PlotCandle x y) -- | 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. data PlotAnnotation x y PlotAnnotation :: HTextAnchor -> VTextAnchor -> Double -> FontStyle -> [(x, y, String)] -> PlotAnnotation x y [_plot_annotation_hanchor] :: PlotAnnotation x y -> HTextAnchor [_plot_annotation_vanchor] :: PlotAnnotation x y -> VTextAnchor -- | Angle, in degrees, to rotate the annotation about the anchor point. [_plot_annotation_angle] :: PlotAnnotation x y -> Double [_plot_annotation_style] :: PlotAnnotation x y -> FontStyle [_plot_annotation_values] :: PlotAnnotation x y -> [(x, y, String)] plot_annotation_hanchor :: forall x_awRR y_awRS. Lens' (PlotAnnotation x_awRR y_awRS) HTextAnchor plot_annotation_vanchor :: forall x_awRR y_awRS. Lens' (PlotAnnotation x_awRR y_awRS) VTextAnchor plot_annotation_angle :: forall x_awRR y_awRS. Lens' (PlotAnnotation x_awRR y_awRS) Double plot_annotation_style :: forall x_awRR y_awRS. Lens' (PlotAnnotation x_awRR y_awRS) FontStyle plot_annotation_values :: forall x_awRR y_awRS x_axaE y_axaF. Lens (PlotAnnotation x_awRR y_awRS) (PlotAnnotation x_axaE y_axaF) [(x_awRR, y_awRS, String)] [(x_axaE, y_axaF, String)] instance Graphics.Rendering.Chart.Plot.Types.ToPlot Graphics.Rendering.Chart.Plot.Annotation.PlotAnnotation instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Annotation.PlotAnnotation x y) -- | Non chart specific utility functions. module Graphics.Rendering.Chart.Utils -- | Checks if the given value is and actual numeric value and not a -- concept like NaN or infinity. isValidNumber :: (RealFloat a) => a -> Bool -- | Version of maybe that returns a monadic value. maybeM :: (Monad m) => b -> (a -> m b) -> Maybe a -> m b -- | This module contains the definition of the Renderable 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 :: BackendProgram RectSize -> (RectSize -> BackendProgram (PickFn a)) -> Renderable a -- | Calculate the minimum size of the renderable. [minsize] :: Renderable a -> BackendProgram RectSize -- | Draw the renderable with a rectangle, which covers the origin to a -- given point. -- -- The resulting "pick" function maps a point in the image to a value. [render] :: Renderable a -> RectSize -> BackendProgram (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 ) => m -- a in the future. type PickFn a = Point -> Maybe a data Rectangle Rectangle :: RectSize -> Maybe FillStyle -> Maybe LineStyle -> RectCornerStyle -> Rectangle [_rect_minsize] :: Rectangle -> RectSize [_rect_fillStyle] :: Rectangle -> Maybe FillStyle [_rect_lineStyle] :: Rectangle -> Maybe LineStyle [_rect_cornerStyle] :: Rectangle -> RectCornerStyle data RectCornerStyle RCornerSquare :: RectCornerStyle RCornerBevel :: Double -> RectCornerStyle RCornerRounded :: Double -> RectCornerStyle rectangleToRenderable :: Rectangle -> Renderable a -- | Overlay a renderable over a solid background fill. fillBackground :: FillStyle -> 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 -- BackendProgram monad. embedRenderable :: BackendProgram (Renderable a) -> Renderable a -- | Construct a renderable from a text string, aligned with the axes. label :: FontStyle -> HTextAnchor -> VTextAnchor -> String -> Renderable String -- | Construct a renderable from a text string, rotated wrt to axes. The -- angle of rotation is in degrees, measured clockwise from the -- horizontal. rlabel :: FontStyle -> 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 Just 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 rect_minsize :: Lens' Rectangle RectSize rect_fillStyle :: Lens' Rectangle (Maybe FillStyle) rect_lineStyle :: Lens' Rectangle (Maybe LineStyle) rect_cornerStyle :: Lens' Rectangle RectCornerStyle instance GHC.Base.Functor Graphics.Rendering.Chart.Renderable.Renderable instance Data.Default.Class.Default Graphics.Rendering.Chart.Renderable.Rectangle instance Graphics.Rendering.Chart.Renderable.ToRenderable Graphics.Rendering.Chart.Renderable.Rectangle instance Graphics.Rendering.Chart.Renderable.ToRenderable (Graphics.Rendering.Chart.Renderable.Renderable a) -- | Sparklines are mini graphs inspired by Edward Tufte; see -- http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR -- and http://en.wikipedia.org/wiki/Sparkline for more -- information. -- -- The original implementation (by Hitesh Jasani) used the gd package as -- a backend renderer, and is still available at -- http://hackage.haskell.org/package/hsparklines. -- -- The present version integrates with the Chart package, in the sense -- that Sparklines are just another kind of (ToRenderable a => -- a), so they can be composed into grids and used with the rest of -- Chart. -- --
-- dp :: [Double] -- dp = [24,21,32.3,24,15,34,43,55,57,72,74,75,73,72,55,44] -- -- sl = SparkLine barSpark dp -- fopts = FileOptions (sparkSize sl) PNG -- renderableToFile fopts (sparkLineToRenderable sl) "bar_spark.png" --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 -- | Return the width and height of the SparkLine. sparkSize :: SparkLine -> (Int, Int) -- | Render a SparkLine to a drawing surface. renderSparkLine :: SparkLine -> BackendProgram (PickFn ()) -- | Create a renderable from a SparkLine. sparkLineToRenderable :: SparkLine -> Renderable () -- | Compute the width of a SparkLine, for rendering purposes. sparkWidth :: SparkLine -> Int instance GHC.Show.Show Graphics.Rendering.Chart.SparkLine.SparkOptions instance Graphics.Rendering.Chart.Renderable.ToRenderable Graphics.Rendering.Chart.SparkLine.SparkLine -- | 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) -- | When more space is available for an item than the total width of -- items, extra added space is proportional to 'space weight'. type SpaceWeight = (Double, Double) -- | 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 beside. (.|.) :: Grid a -> Grid a -> Grid a -- | A synonym for above. (./.) :: 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 below the grid, occupying 1 row with the same -- horizontal span as the grid. aboveWide :: Grid a -> a -> Grid a -- | A value occupying 1 row with the same horizontal span as the grid. wideAbove :: a -> Grid a -> Grid a -- | A value placed to the left of the grid, occupying 1 column with the -- same vertical span as the grid. tallBeside :: a -> Grid a -> Grid a -- | A value placed to the right of the grid, occupying 1 column with the -- same vertical span as the grid. besideTall :: Grid a -> 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 GHC.Show.Show a => GHC.Show.Show (Graphics.Rendering.Chart.Grid.Grid a) instance GHC.Base.Functor Graphics.Rendering.Chart.Grid.Grid instance Graphics.Rendering.Chart.Renderable.ToRenderable a => Graphics.Rendering.Chart.Renderable.ToRenderable (Graphics.Rendering.Chart.Grid.Grid a) -- | 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: -- --
-- values :: [PieItem] -- values = [...] -- layout :: PieLayout -- layout = pie_plot ^: pie_data ^= values -- $ def -- renderable = toRenderable layout --module Graphics.Rendering.Chart.Plot.Pie data PieLayout PieLayout :: String -> FontStyle -> PieChart -> FillStyle -> Double -> PieLayout [_pie_title] :: PieLayout -> String [_pie_title_style] :: PieLayout -> FontStyle [_pie_plot] :: PieLayout -> PieChart [_pie_background] :: PieLayout -> FillStyle [_pie_margin] :: PieLayout -> Double data PieChart PieChart :: [PieItem] -> [AlphaColour Double] -> FontStyle -> LineStyle -> Double -> PieChart [_pie_data] :: PieChart -> [PieItem] [_pie_colors] :: PieChart -> [AlphaColour Double] [_pie_label_style] :: PieChart -> FontStyle [_pie_label_line_style] :: PieChart -> LineStyle [_pie_start_angle] :: PieChart -> Double data PieItem PieItem :: String -> Double -> Double -> PieItem [_pitem_label] :: PieItem -> String [_pitem_offset] :: PieItem -> Double [_pitem_value] :: PieItem -> Double pieToRenderable :: PieLayout -> Renderable (PickFn a) pieChartToRenderable :: PieChart -> Renderable (PickFn a) pie_title :: Lens' PieLayout String pie_title_style :: Lens' PieLayout FontStyle pie_plot :: Lens' PieLayout PieChart pie_background :: Lens' PieLayout FillStyle pie_margin :: Lens' PieLayout Double pie_data :: Lens' PieChart [PieItem] pie_colors :: Lens' PieChart [AlphaColour Double] pie_label_style :: Lens' PieChart FontStyle pie_label_line_style :: Lens' PieChart LineStyle pie_start_angle :: Lens' PieChart Double pitem_label :: Lens' PieItem String pitem_offset :: Lens' PieItem Double pitem_value :: Lens' PieItem Double instance Data.Default.Class.Default Graphics.Rendering.Chart.Plot.Pie.PieLayout instance Graphics.Rendering.Chart.Renderable.ToRenderable Graphics.Rendering.Chart.Plot.Pie.PieLayout instance Data.Default.Class.Default Graphics.Rendering.Chart.Plot.Pie.PieChart instance Graphics.Rendering.Chart.Renderable.ToRenderable Graphics.Rendering.Chart.Plot.Pie.PieChart instance Data.Default.Class.Default Graphics.Rendering.Chart.Plot.Pie.PieItem -- | 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 -> BackendProgram ())] -> Legend x y data LegendStyle LegendStyle :: FontStyle -> Double -> Double -> LegendOrientation -> LegendPosition -> LegendStyle [_legend_label_style] :: LegendStyle -> FontStyle [_legend_margin] :: LegendStyle -> Double [_legend_plot_size] :: LegendStyle -> Double [_legend_orientation] :: LegendStyle -> LegendOrientation [_legend_position] :: LegendStyle -> LegendPosition -- | 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 -- | Defines the position of the legend, relative to the plot. data LegendPosition LegendAbove :: LegendPosition LegendBelow :: LegendPosition LegendRight :: LegendPosition LegendLeft :: LegendPosition legendToRenderable :: Legend x y -> Renderable String legend_label_style :: Lens' LegendStyle FontStyle legend_margin :: Lens' LegendStyle Double legend_plot_size :: Lens' LegendStyle Double legend_orientation :: Lens' LegendStyle LegendOrientation legend_position :: Lens' LegendStyle LegendPosition instance Graphics.Rendering.Chart.Renderable.ToRenderable (Graphics.Rendering.Chart.Legend.Legend x y) instance Data.Default.Class.Default Graphics.Rendering.Chart.Legend.LegendStyle -- | 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 :: AxisVisibility -> (Range -> x -> Double) -> (Range -> Double -> x) -> [(x, Double)] -> [[(x, String)]] -> [x] -> AxisData x -- | Which parts of the axis shall be displayed. [_axis_visibility] :: AxisData x -> AxisVisibility -- | 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] -- | Configures whick visual elements of a axis are shown at the -- appropriate edge of a plot area. data AxisVisibility AxisVisibility :: Bool -> Bool -> Bool -> AxisVisibility -- | Whether to display a line along the axis. [_axis_show_line] :: AxisVisibility -> Bool -- | Whether to display the tick marks. [_axis_show_ticks] :: AxisVisibility -> Bool -- | Whether to display the labels. [_axis_show_labels] :: AxisVisibility -> Bool -- | 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 :: LineStyle -> FontStyle -> LineStyle -> Double -> AxisStyle -- | LineStyle to use for axis line and ticks. [_axis_line_style] :: AxisStyle -> LineStyle -- | FontStyle to use for axis labels. [_axis_label_style] :: AxisStyle -> FontStyle -- | LineStyle to use for axis grid. [_axis_grid_style] :: AxisStyle -> LineStyle -- | 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 -- | The default LineStyle of an axis. defaultAxisLineStyle :: LineStyle -- | The default LineStyle of a plot area grid. defaultGridLineStyle :: LineStyle -- | 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 renderAxisGrid -- function. axisToRenderable :: AxisT x -> Renderable x renderAxisGrid :: RectSize -> AxisT z -> BackendProgram () -- | Calculate the amount by which the labels extend beyond the ends of the -- axis. axisOverhang :: (Ord x) => AxisT x -> BackendProgram (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 change labels on an axis axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData x axis_show_line :: Lens' AxisVisibility Bool axis_show_ticks :: Lens' AxisVisibility Bool axis_show_labels :: Lens' AxisVisibility Bool axis_visibility :: forall x_aLWU. Lens' (AxisData x_aLWU) AxisVisibility axis_viewport :: forall x_aLWU. Lens' (AxisData x_aLWU) (Range -> x_aLWU -> Double) axis_tropweiv :: forall x_aLWU. Lens' (AxisData x_aLWU) (Range -> Double -> x_aLWU) axis_ticks :: forall x_aLWU. Lens' (AxisData x_aLWU) [(x_aLWU, Double)] axis_labels :: forall x_aLWU. Lens' (AxisData x_aLWU) [[(x_aLWU, String)]] axis_grid :: forall x_aLWU. Lens' (AxisData x_aLWU) [x_aLWU] axis_line_style :: Lens' AxisStyle LineStyle axis_label_style :: Lens' AxisStyle FontStyle axis_grid_style :: Lens' AxisStyle LineStyle axis_label_gap :: Lens' AxisStyle Double instance Data.Default.Class.Default Graphics.Rendering.Chart.Axis.Types.AxisStyle instance Data.Default.Class.Default Graphics.Rendering.Chart.Axis.Types.AxisVisibility -- | Calculate and render unit indexed axes module Graphics.Rendering.Chart.Axis.Unit unitAxis :: AxisData () instance Graphics.Rendering.Chart.Axis.Types.PlotValue () -- | Calculate and render time axes module Graphics.Rendering.Chart.Axis.Time -- | TimeSeq is a (potentially infinite) set of times. When passed a -- reference time, the function returns a a pair of lists. The first -- contains all times in the set less than the reference time in -- decreasing order. The second contains all times in the set greater -- than or equal to the reference time, in increasing order. type TimeSeq = UTCTime -> ([UTCTime], [UTCTime]) -- | How to display a time type TimeLabelFn = UTCTime -> String data TimeLabelAlignment UnderTicks :: TimeLabelAlignment BetweenTicks :: TimeLabelAlignment -- | A typeclass abstracting the functions we need to be able to plot -- against an axis of time type d. class TimeValue t utctimeFromTV :: TimeValue t => t -> UTCTime tvFromUTCTime :: TimeValue t => UTCTime -> t doubleFromTimeValue :: TimeValue t => t -> Double timeValueFromDouble :: TimeValue t => Double -> t -- | Create an AxisFn to for a time axis. -- -- The values to be plotted against this axis can be created with -- doubleFromLocalTime. -- -- Implementation detail: PlotValue constraint is needed to use -- vmap. timeValueAxis :: TimeValue t => TimeSeq -> TimeSeq -> TimeLabelFn -> TimeLabelAlignment -> TimeSeq -> TimeLabelFn -> TimeLabelAlignment -> AxisFn t -- | 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 doubleFromTimeValue. autoTimeValueAxis :: TimeValue t => AxisFn t -- | A TimeSeq for calendar days. days :: TimeSeq -- | A TimeSeq for calendar months. months :: TimeSeq -- | A TimeSeq for calendar years. years :: TimeSeq instance GHC.Show.Show Graphics.Rendering.Chart.Axis.Time.TimeLabelAlignment instance Graphics.Rendering.Chart.Axis.Time.TimeValue Data.Time.Clock.Internal.UTCTime.UTCTime instance Graphics.Rendering.Chart.Axis.Time.TimeValue Data.Time.Calendar.Days.Day instance Graphics.Rendering.Chart.Axis.Time.TimeValue Data.Time.LocalTime.Internal.LocalTime.LocalTime instance Graphics.Rendering.Chart.Axis.Types.PlotValue Data.Time.LocalTime.Internal.LocalTime.LocalTime instance Graphics.Rendering.Chart.Axis.Types.PlotValue Data.Time.Clock.Internal.UTCTime.UTCTime instance Graphics.Rendering.Chart.Axis.Types.PlotValue Data.Time.Calendar.Days.Day -- | Calculate and render time axes -- | Deprecated: Use Graphics.Rendering.Chart.Axis.Time module module Graphics.Rendering.Chart.Axis.LocalTime -- | TimeSeq is a (potentially infinite) set of times. When passed a -- reference time, the function returns a a pair of lists. The first -- contains all times in the set less than the reference time in -- decreasing order. The second contains all times in the set greater -- than or equal to the reference time, in increasing order. type TimeSeq = LocalTime -> ([LocalTime], [LocalTime]) -- | How to display a time type TimeLabelFn = LocalTime -> String data TimeLabelAlignment UnderTicks :: TimeLabelAlignment BetweenTicks :: TimeLabelAlignment -- | Create an AxisFn to for a time axis. -- -- The values to be plotted against this axis can be created with -- doubleFromLocalTime. 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 doubleFromLocalTime. autoTimeAxis :: AxisFn LocalTime -- | A TimeSeq for calendar days. days :: TimeSeq -- | A TimeSeq for calendar months. months :: TimeSeq -- | A TimeSeq for calendar years. years :: TimeSeq -- | Map a LocalTime value to a plot coordinate. doubleFromLocalTime :: LocalTime -> Double instance GHC.Show.Show Graphics.Rendering.Chart.Axis.LocalTime.TimeLabelAlignment -- | 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 GHC.Show.Show Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Real.Integral Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Real.Real Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Num.Num Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Enum.Enum Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Classes.Ord Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance GHC.Classes.Eq Graphics.Rendering.Chart.Axis.Indexed.PlotIndex instance Graphics.Rendering.Chart.Axis.Types.PlotValue Graphics.Rendering.Chart.Axis.Indexed.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] -- | 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 :: forall a_a10gl a_a11HM. Lens (LinearAxisParams a_a10gl) (LinearAxisParams a_a11HM) ([a_a10gl] -> [String]) ([a_a11HM] -> [String]) la_nLabels :: forall a_a10gl. Lens' (LinearAxisParams a_a10gl) Int la_nTicks :: forall a_a10gl. Lens' (LinearAxisParams a_a10gl) Int loga_labelf :: forall a_a10gk a_a11Ju. Iso (LogAxisParams a_a10gk) (LogAxisParams a_a11Ju) ([a_a10gk] -> [String]) ([a_a11Ju] -> [String]) instance GHC.Float.RealFloat Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Float.Floating Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Real.RealFrac Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Real.Fractional Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Real.Real Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Num.Num Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Classes.Ord Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Classes.Eq Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Float.RealFloat Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Float.Floating Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Real.RealFrac Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Real.Fractional Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Real.Real Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Num.Num Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Classes.Ord Graphics.Rendering.Chart.Axis.Floating.Percent instance GHC.Classes.Eq Graphics.Rendering.Chart.Axis.Floating.Percent instance (GHC.Show.Show a, GHC.Float.RealFloat a) => Data.Default.Class.Default (Graphics.Rendering.Chart.Axis.Floating.LogAxisParams a) instance (GHC.Show.Show a, GHC.Float.RealFloat a) => Data.Default.Class.Default (Graphics.Rendering.Chart.Axis.Floating.LinearAxisParams a) instance GHC.Show.Show Graphics.Rendering.Chart.Axis.Floating.LogValue instance Graphics.Rendering.Chart.Axis.Types.PlotValue Graphics.Rendering.Chart.Axis.Floating.LogValue instance GHC.Show.Show Graphics.Rendering.Chart.Axis.Floating.Percent instance Graphics.Rendering.Chart.Axis.Types.PlotValue Graphics.Rendering.Chart.Axis.Floating.Percent instance Graphics.Rendering.Chart.Axis.Types.PlotValue GHC.Types.Double instance Graphics.Rendering.Chart.Axis.Types.PlotValue GHC.Types.Float -- | 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 Graphics.Rendering.Chart.Axis.Types.PlotValue GHC.Types.Int instance Graphics.Rendering.Chart.Axis.Types.PlotValue GHC.Integer.Type.Integer -- | Code to calculate and render axes. module Graphics.Rendering.Chart.Axis -- | Vector plots module Graphics.Rendering.Chart.Plot.Vectors data PlotVectors x y PlotVectors :: String -> VectorStyle -> Double -> [(x, y)] -> ((x, y) -> (x, y)) -> [((x, y), (x, y))] -> PlotVectors x y [_plot_vectors_title] :: PlotVectors x y -> String [_plot_vectors_style] :: PlotVectors x y -> VectorStyle -- | Set to 1 (default) to normalize the length of vectors to a space -- between them (so that the vectors never overlap on the graph). Set to -- 0 to disable any scaling. Values in between 0 and 1 are also permitted -- to adjust scaling. [_plot_vectors_scale] :: PlotVectors x y -> Double -- | Provide a square-tiled regular grid. [_plot_vectors_grid] :: PlotVectors x y -> [(x, y)] -- | Provide a vector field (R^2 -> R^2) function. [_plot_vectors_mapf] :: PlotVectors x y -> (x, y) -> (x, y) -- | Provide a prepared list of (start,vector) pairs. [_plot_vectors_values] :: PlotVectors x y -> [((x, y), (x, y))] data VectorStyle VectorStyle :: LineStyle -> PointStyle -> VectorStyle [_vector_line_style] :: VectorStyle -> LineStyle [_vector_head_style] :: VectorStyle -> PointStyle plotVectorField :: (PlotValue x, PlotValue y) => PlotVectors x y -> Plot x y plot_vectors_mapf :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) ((x_a1854, y_a1855) -> (x_a1854, y_a1855)) plot_vectors_grid :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) [(x_a1854, y_a1855)] plot_vectors_title :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) String plot_vectors_style :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) VectorStyle plot_vectors_scale :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) Double plot_vectors_values :: forall x_a1854 y_a1855. Lens' (PlotVectors x_a1854 y_a1855) [((x_a1854, y_a1855), (x_a1854, y_a1855))] vector_line_style :: Lens' VectorStyle LineStyle vector_head_style :: Lens' VectorStyle PointStyle instance Data.Default.Class.Default Graphics.Rendering.Chart.Plot.Vectors.VectorStyle instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Vectors.PlotVectors x y) -- | 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 -> [(FillStyle, Maybe LineStyle)] -> [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 -> [(FillStyle, Maybe LineStyle)] -- | 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])] 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 -- | Bars are centered around deviceX BarsCentered :: PlotBarsAlignment -- | The right edge of bars is at 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 :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) PlotBarsStyle plot_bars_item_styles :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) [(FillStyle, Maybe LineStyle)] plot_bars_titles :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) [String] plot_bars_spacing :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) PlotBarsSpacing plot_bars_alignment :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) PlotBarsAlignment plot_bars_reference :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) y_a1acg plot_bars_singleton_width :: forall x_a1acf y_a1acg. Lens' (PlotBars x_a1acf y_a1acg) Double plot_bars_values :: forall x_a1acf y_a1acg x_a1avo. Lens (PlotBars x_a1acf y_a1acg) (PlotBars x_a1avo y_a1acg) [(x_a1acf, [y_a1acg])] [(x_a1avo, [y_a1acg])] instance GHC.Show.Show Graphics.Rendering.Chart.Plot.Bars.PlotBarsAlignment instance GHC.Show.Show Graphics.Rendering.Chart.Plot.Bars.PlotBarsSpacing instance GHC.Show.Show Graphics.Rendering.Chart.Plot.Bars.PlotBarsStyle instance Graphics.Rendering.Chart.Plot.Bars.BarsPlotValue y => Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Bars.PlotBars x y) instance Graphics.Rendering.Chart.Plot.Bars.BarsPlotValue GHC.Types.Double instance Graphics.Rendering.Chart.Plot.Bars.BarsPlotValue GHC.Types.Int -- | 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)] area_spots_title :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) String area_spots_linethick :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) Double area_spots_linecolour :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) (AlphaColour Double) area_spots_fillcolour :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) (Colour Double) area_spots_opacity :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) Double area_spots_max_radius :: forall z_a1cKg x_a1cKh y_a1cKi. Lens' (AreaSpots z_a1cKg x_a1cKh y_a1cKi) Double area_spots_values :: forall z_a1cKg x_a1cKh y_a1cKi z_a1d74 x_a1d75 y_a1d76. Lens (AreaSpots z_a1cKg x_a1cKh y_a1cKi) (AreaSpots z_a1d74 x_a1d75 y_a1d76) [(x_a1cKh, y_a1cKi, z_a1cKg)] [(x_a1d75, y_a1d76, z_a1d74)] -- | 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)] area_spots_4d_title :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf. Lens' (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) String area_spots_4d_linethick :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf. Lens' (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) Double area_spots_4d_palette :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf. Lens' (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) [Colour Double] area_spots_4d_opacity :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf. Lens' (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) Double area_spots_4d_max_radius :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf. Lens' (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) Double area_spots_4d_values :: forall z_a1cKc t_a1cKd x_a1cKe y_a1cKf z_a1dco t_a1dcp x_a1dcq y_a1dcr. Lens (AreaSpots4D z_a1cKc t_a1cKd x_a1cKe y_a1cKf) (AreaSpots4D z_a1dco t_a1dcp x_a1dcq y_a1dcr) [(x_a1cKe, y_a1cKf, z_a1cKc, t_a1cKd)] [(x_a1dcq, y_a1dcr, z_a1dco, t_a1dcp)] instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.AreaSpots.AreaSpots4D z t x y) instance (Graphics.Rendering.Chart.Axis.Types.PlotValue z, Graphics.Rendering.Chart.Axis.Types.PlotValue t, GHC.Show.Show t) => Graphics.Rendering.Chart.Plot.Types.ToPlot (Graphics.Rendering.Chart.Plot.AreaSpots.AreaSpots4D z t) instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.AreaSpots.AreaSpots z x y) instance Graphics.Rendering.Chart.Axis.Types.PlotValue z => Graphics.Rendering.Chart.Plot.Types.ToPlot (Graphics.Rendering.Chart.Plot.AreaSpots.AreaSpots z) module Numeric.Histogram type Range a = (a, a) -- | 'binBounds a b n' generates bounds for n bins spaced linearly -- between a and b -- -- Examples: -- --
-- >>> binBounds 0 3 4 -- [(0.0,0.75),(0.75,1.5),(1.5,2.25),(2.25,3.0)] --binBounds :: RealFrac a => a -> a -> Int -> [Range a] -- | 'histValues a b n vs' returns the bins for the histogram of -- vs on the range from a to b with n -- bins histValues :: RealFrac a => a -> a -> Int -> [a] -> Vector (Range a, Int) -- | 'histValues a b n vs' returns the bins for the weighted histogram of -- vs on the range from a to b with n -- bins histWeightedValues :: RealFrac a => a -> a -> Int -> [(Double, a)] -> Vector (Range a, Double) -- | 'histWithBins bins xs' is the histogram of weighted values xs -- with bins -- -- Examples: -- --
-- >>> :{
-- histWithBins
-- (V.fromList [(0.0, 0.75), (0.75, 1.5), (1.5, 2.25), (2.25, 3.0)])
-- [(1, 0), (1, 0), (1, 1), (1, 2), (1, 2), (1, 2), (1, 3)]
-- :}
-- [((0.0,0.75),2),((0.75,1.5),1),((1.5,2.25),3),((2.25,3.0),1)]
--
histWithBins :: (Num w, RealFrac a) => Vector (Range a) -> [(w, a)] -> Vector (Range a, w)
module Graphics.Rendering.Chart.Plot.Histogram
data PlotHist x y
PlotHist :: String -> Int -> [x] -> Bool -> Maybe (x, x) -> Bool -> FillStyle -> LineStyle -> (Double -> Int -> y) -> PlotHist x y
-- | Plot title
[_plot_hist_title] :: PlotHist x y -> String
-- | Number of bins
[_plot_hist_bins] :: PlotHist x y -> Int
-- | Values to histogram
[_plot_hist_values] :: PlotHist x y -> [x]
-- | Don't attempt to plot bins with zero counts. Useful when the y-axis is
-- logarithmically scaled.
[_plot_hist_no_zeros] :: PlotHist x y -> Bool
-- | Override the range of the histogram. If Nothing the range of
-- _plot_hist_values is used.
--
-- Note that any normalization is always computed over the full data set,
-- including samples not falling in the histogram range.
[_plot_hist_range] :: PlotHist x y -> Maybe (x, x)
-- | Plot vertical lines between bins
[_plot_hist_drop_lines] :: PlotHist x y -> Bool
-- | Fill style of the bins
[_plot_hist_fill_style] :: PlotHist x y -> FillStyle
-- | Line style of the bin outlines
[_plot_hist_line_style] :: PlotHist x y -> LineStyle
-- | Normalization function
[_plot_hist_norm_func] :: PlotHist x y -> Double -> Int -> y
-- | Convert a PlotHist to a Plot
--
-- N.B. In principle this should be Chart's ToPlot class but
-- unfortunately this does not allow us to set bounds on the x and y axis
-- types, hence the need for this function.
histToPlot :: (RealFrac x, Num y, Ord y) => PlotHist x y -> Plot x y
-- | The default style is an unnormalized histogram of 20 bins.
defaultPlotHist :: PlotHist x Int
-- | defaultPlotHist but with real counts
defaultFloatPlotHist :: PlotHist x Double
-- | defaultPlotHist but normalized such that the integral of the
-- histogram is one.
defaultNormedPlotHist :: PlotHist x Double
plot_hist_title :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) String
plot_hist_bins :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) Int
plot_hist_values :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) [x_a1gNr]
plot_hist_no_zeros :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) Bool
plot_hist_range :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) (Maybe (x_a1gNr, x_a1gNr))
plot_hist_drop_lines :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) Bool
plot_hist_line_style :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) LineStyle
plot_hist_fill_style :: forall x_a1gNr y_a1gNs. Lens' (PlotHist x_a1gNr y_a1gNs) FillStyle
plot_hist_norm_func :: forall x_a1gNr y_a1gNs y_a1h1z. Lens (PlotHist x_a1gNr y_a1gNs) (PlotHist x_a1gNr y_a1h1z) (Double -> Int -> y_a1gNs) (Double -> Int -> y_a1h1z)
instance Data.Default.Class.Default (Graphics.Rendering.Chart.Plot.Histogram.PlotHist x GHC.Types.Int)
-- | 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
-- Lens) for each field of the following data types:
--
-- -- import Graphics.Rendering.Chart.Easy -- import Graphics.Rendering.Chart.Backend.Cairo -- -- signal :: [Double] -> [(Double,Double)] -- signal xs = [ (x,(sin (x*3.14159/45) + 1) / 2 * (sin (x*3.14159/5))) | x <- xs ] -- -- main = toFile def "example.png" $ do -- layout_title .= "Amplitude Modulation" -- plot (line "am" [signal [0,(0.5)..400]]) -- plot (points "am points" (signal [0,7..400])) ---- -- More examples can be found on the library's wiki module Graphics.Rendering.Chart.Easy -- | Constuct a line plot with the given title and data, using the next -- available color. line :: String -> [[(x, y)]] -> EC l (PlotLines x y) -- | Construct a scatter plot with the given title and data, using the next -- available color and point shape. points :: String -> [(x, y)] -> EC l (PlotPoints x y) -- | Construct a bar chart with the given titles and data, using the next -- available colors bars :: (PlotValue x, BarsPlotValue y) => [String] -> [(x, [y])] -> EC l (PlotBars x y) -- | Set the contents of the colour source, for subsequent plots setColors :: [AlphaColour Double] -> EC l () -- | Set the contents of the shape source, for subsequent plots setShapes :: [PointShape] -> EC l ()