prettychart-0.2.0.0: Pretty print charts from ghci.
Safe HaskellSafe-Inferred
LanguageGHC2021

Prettychart.Any

Description

Read some text and attempt to make a chart.

Synopsis

Documentation

anyChart :: String -> Either String ChartOptions Source #

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

anyWrite :: FilePath -> String -> IO () Source #

Attempt to read chart data and write to file.

tryChart :: Read a => String -> (a -> ChartOptions) -> Either String ChartOptions Source #

Read a String and try a chart with a particular shape.

anyList1 :: [Double] -> ChartOptions Source #

Default chart for a single list.

anyList2 :: [[Double]] -> ChartOptions Source #

Default chart for a double list.

anyTuple2 :: [[(Double, Double)]] -> ChartOptions Source #

Default scatter chart for paired data

anySingleNamedBarChart :: [(Text, Double)] -> ChartOptions Source #

Bar chart for a labelled list.

anyBar2 :: [[Double]] -> ChartOptions Source #

Bar chart for a double list.

anyLineChart :: [[Double]] -> ChartOptions Source #

Multiple line chart.

anySurfaceChart :: [[Double]] -> ChartOptions Source #

Default pixel chart for double list.