-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Pretty print charts from ghci. -- -- Serve and print charts from ghci or from an svg file, with automatic -- formatting. @package prettychart @version 0.3.0.0 -- | Various common (& pretty) chart patterns. module Prettychart.Charts -- | UTC (time) axis style data UtcAxisStyle UtcAxisStyle :: Bool -> PosDiscontinuous -> Maybe Text -> Int -> UtcAxisStyle [$sel:cont:UtcAxisStyle] :: UtcAxisStyle -> Bool [$sel:posd:UtcAxisStyle] :: UtcAxisStyle -> PosDiscontinuous [$sel:utcFormat:UtcAxisStyle] :: UtcAxisStyle -> Maybe Text [$sel:nTicks:UtcAxisStyle] :: UtcAxisStyle -> Int -- | default UTC (time) axis style defaultUtcAxisStyle :: UtcAxisStyle -- | Create a hud that has time as the x-axis based on supplied UTCTime -- list. utcAxis :: UtcAxisStyle -> [UTCTime] -> AxisOptions -- | Decile (quantile) axis style data DecileAxisStyle DecileAxisStyle :: Double -> [Text] -> DecileAxisStyle [$sel:size:DecileAxisStyle] :: DecileAxisStyle -> Double [$sel:labels:DecileAxisStyle] :: DecileAxisStyle -> [Text] -- | Default decile (quantile) axis style defaultDecileAxisStyle :: DecileAxisStyle -- | Convert a list of quantiles to DecileAxisStyle qsAxisStyle :: [Double] -> DecileAxisStyle -- | Create an axis from a style. decileAxis :: DecileAxisStyle -> AxisOptions -- | Chart style for a digit chart data DigitChartStyle DigitChartStyle :: Maybe UtcAxisStyle -> Maybe DecileAxisStyle -> Style -> Bool -> DigitChartStyle [$sel:utcAxisStyle:DigitChartStyle] :: DigitChartStyle -> Maybe UtcAxisStyle [$sel:decileAxisStyle:DigitChartStyle] :: DigitChartStyle -> Maybe DecileAxisStyle [$sel:glyphStyle:DigitChartStyle] :: DigitChartStyle -> Style [$sel:hasLegend:DigitChartStyle] :: DigitChartStyle -> Bool -- | Default chart style for a digit chart defaultDigitChartStyle :: DigitChartStyle -- | A chart drawing a (quantiled or digitized) time series digitChart :: DigitChartStyle -> [UTCTime] -> [Int] -> ChartOptions -- | Style of a UTC line chart. data UtcLineChartStyle UtcLineChartStyle :: Style -> Maybe UtcAxisStyle -> Maybe AxisOptions -> Maybe LegendOptions -> UtcLineChartStyle [$sel:lineStyle:UtcLineChartStyle] :: UtcLineChartStyle -> Style [$sel:utcAxisStyle:UtcLineChartStyle] :: UtcLineChartStyle -> Maybe UtcAxisStyle [$sel:yAxisStyle:UtcLineChartStyle] :: UtcLineChartStyle -> Maybe AxisOptions [$sel:legendStyle:UtcLineChartStyle] :: UtcLineChartStyle -> Maybe LegendOptions -- | Default style of a UTC line chart. defaultUtcLineChartStyle :: UtcLineChartStyle -- | Line chart for a UTC time series. utcLineChart :: UtcLineChartStyle -> [Text] -> [(UTCTime, [Double])] -> ChartOptions -- | countChart style data CountChartStyle CountChartStyle :: Maybe Text -> Colour -> Maybe LegendOptions -> CountChartStyle [$sel:title:CountChartStyle] :: CountChartStyle -> Maybe Text [$sel:titleColour:CountChartStyle] :: CountChartStyle -> Colour [$sel:legendStyle:CountChartStyle] :: CountChartStyle -> Maybe LegendOptions -- | Default CountChart style defaultCountChartStyle :: CountChartStyle -- | Count chart countChart :: CountChartStyle -> [Text] -> [Int] -> ChartOptions -- | Simple Rect chart simpleRectChart :: [Double] -> Style -> ChartOptions -- | interpret a [Double] as a line with x coordinates of [0..] simpleLineChart :: Double -> Colour -> [Double] -> Chart -- | interpret a [Double] as a scatter chart with x coordinates of [0..] simpleScatterChart :: Double -> Colour -> [Double] -> Chart -- | convert from [a] to [Point a], by adding the index as the x axis -- --
--   >>> xify [1..3]
--   [Point 0.0 1.0,Point 1.0 2.0,Point 2.0 3.0]
--   
xify :: [Double] -> [Point Double] -- | convert from [a] to [Point a], by adding the index as the y axis -- --
--   >>> yify [1..3]
--   [Point 1.0 0.0,Point 2.0 1.0,Point 3.0 2.0]
--   
yify :: [Double] -> [Point Double] -- | common pattern of chart title, x-axis title and y-axis title titles3 :: Double -> (Text, Text, Text) -> [Priority TitleOptions] -- | histogram chart histChart :: Range Double -> Int -> [Double] -> ChartOptions -- | horizontal histogram chart hhistChart :: Range Double -> Int -> [Double] -> ChartOptions -- | horizontal histogram chart hhistCharts :: Range Double -> Int -> [(Style, [Double])] -> ChartOptions -- | scatter chart scatterChart :: [[Point Double]] -> [Chart] -- | blendMidLineStyle n w produces n lines of width w -- interpolated between two colors. blendMidLineStyles :: Int -> Double -> (Colour, Colour) -> [Style] -- | Format quantile-style numbers -- --
--   >>> quantileNames [0.01, 0.5, 0.99]
--   ["1.0%","50%","99%"]
--   
quantileNames :: Functor f => f Double -> f Text -- | Chart template for quantiles. quantileChart :: [Text] -> [Style] -> [[Double]] -> ChartOptions -- | A histogram based on quantile information quantileHistChart :: Maybe [Text] -> [Double] -> [Double] -> ChartOptions -- | Surface chart of quantile vs quantile counts digitSurfaceChart :: SurfaceStyle -> SurfaceLegendOptions -> (Text, Text, Text) -> [Text] -> [(Int, Int)] -> ChartTree instance GHC.Generics.Generic Prettychart.Charts.UtcAxisStyle instance GHC.Generics.Generic Prettychart.Charts.DecileAxisStyle instance GHC.Generics.Generic Prettychart.Charts.DigitChartStyle instance GHC.Generics.Generic Prettychart.Charts.UtcLineChartStyle instance GHC.Generics.Generic Prettychart.Charts.CountChartStyle -- | Read some text and attempt to make a chart. module Prettychart.Any -- | Attempt to read some text and interpret it as data suitable for -- charting. -- -- In the example below, anyChart determines that the input text -- is of type [(Double, Double)] and renders a scatter chart of the data. -- --
--   >>> unknownData = (,) <$> (((\x -> sin (pi * x/40)) . fromIntegral <$> ([1..40] :: [Int]))) <*> (((\x -> cos (pi * x/40)) . fromIntegral <$> ([1..40] :: [Int])))
--   
--   >>> let c = anyChart $ show $ unknownData
--   
--   >>> writeFile "other/anychart.svg" $ either id (unpack . renderChartOptions) c
--   
-- anyChart :: String -> Either String ChartOptions -- | Attempt to read chart data and write to file. anyWrite :: FilePath -> String -> IO () -- | Read a String and try a chart with a particular shape. tryChart :: Read a => String -> (a -> ChartOptions) -> Either String ChartOptions -- | Default chart for a single list. anyList1 :: [Double] -> ChartOptions -- | Default chart for a double list. anyList2 :: [[Double]] -> ChartOptions -- | Default scatter chart for paired data anyTuple2 :: [[(Double, Double)]] -> ChartOptions -- | Bar chart for a labelled list. anySingleNamedBarChart :: [(Text, Double)] -> ChartOptions -- | Bar chart for a double list. anyBar2 :: [[Double]] -> ChartOptions -- | Multiple line chart. anyLineChart :: [[Double]] -> ChartOptions -- | Default pixel chart for double list. anySurfaceChart :: [[Double]] -> ChartOptions -- | Serve a chart web page with a web socket in it, that accepts -- ChartOptions. module Prettychart.Server -- | Start the chart server. Returns the chart consumer, and a server quit -- signal effect. -- -- An iconic ghci session transcript: -- --
--   > import Chart.Examples
--   > (sendChart, quitChartServer) <- startChartServer (Just "prettychart")
--   > sendChart unitExample
--   
-- -- ... point browser to localhost:9160 ... -- --
--   > quitChartServer
--   
startChartServer :: Maybe String -> IO (ChartOptions -> IO Bool, IO ()) -- | Start the chart server protocol with bespoke SocketConfig and -- Page configurations. -- --
--   startChartServerWith (defaultSocketConfig & #port .~ 4567) (defaultSocketPage & #htmlBody %~ divClass_ "row" "bespoke footnote")
--   
startChartServerWith :: SocketConfig -> Page -> IO (ChartOptions -> IO Bool, IO ()) -- | Print a chart supplying a ChartOptions consumer, and a showable -- thing that may be chartable. The first argument flags whether to also -- print the item to stdout. printChart :: Show a => Bool -> (ChartOptions -> IO Bool) -> a -> IO () -- | Page containing a web socket and javascript needed to run it. chartSocketPage :: Maybe ByteString -> Page -- | Start a file server protocol with bespoke SocketConfig and -- Page configurations. -- --
--   startFileServerWith (defaultSocketConfig & #port .~ 4567) (defaultSocketPage & #htmlBody %~ divClass_ "row" "bespoke footnote")
--   
startFileServerWith :: SocketConfig -> Page -> IO (FilePath -> IO Bool, IO ()) -- | Emit from the fsnotify watch manager. watchE :: [Char] -> Codensity IO (Emitter IO Event) -- | Emit from the fsnotify watch manager. > glue' toStdout $| -- fmap (Text.pack . show) $ watchE "." watchSvg :: FilePath -> CoEmitter IO FilePath -- | Filter for svg file additions and modifications. svgEvent :: Event -> Maybe FilePath -- | Create a file committer to serve an SVG file. displayFile :: SocketConfig -> Page -> IO (Committer IO FilePath, IO ()) -- | A haskell library to serve charts via ghci. module Prettychart