Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class ChartColumn a where
- columnHeader :: Proxy a -> Column
- type ChartRowAuto a = (ADT a, Constraints a ToJSON)
- type ChartRowHeaderAuto a = Constraints a ChartColumn
- autoChart :: forall row. (ChartRowHeaderAuto row, ChartRowAuto row) => ChartOptions -> ChartStyle -> [row] -> Chart
- autoChartWithHeaders :: forall row. ChartRowAuto row => ChartOptions -> ChartStyle -> [Column] -> [row] -> Chart
Documentation
class ChartColumn a where Source #
Class representing types for which a column type can be inferred.
You can implement your own instances for this if you like, but generally shouldn't need to.
columnHeader :: Proxy a -> Column Source #
Instances
ChartColumn Bool Source # | |
Defined in Charts.Internal.Auto | |
ChartColumn Double Source # | |
Defined in Charts.Internal.Auto | |
ChartColumn Float Source # | |
Defined in Charts.Internal.Auto | |
ChartColumn Int Source # | |
Defined in Charts.Internal.Auto | |
ChartColumn Scientific Source # | |
Defined in Charts.Internal.Auto columnHeader :: Proxy Scientific -> Column Source # | |
ChartColumn String Source # | |
Defined in Charts.Internal.Auto | |
ChartColumn Text Source # | |
Defined in Charts.Internal.Auto |
type ChartRowAuto a = (ADT a, Constraints a ToJSON) Source #
A constraint representing a type which can be converted into a chart row
This constraint is satisfied by tuple types containing JSON serializable types.
E.g. data rows of type (Text, Int, Float)
will infer a chart with a String column and two number
columns.
You shouldn't need to implement any instances of this constraint yourself.
type ChartRowHeaderAuto a = Constraints a ChartColumn Source #
A constraint that a column-type can be determined for all elements of the provided tuple type.
autoChart :: forall row. (ChartRowHeaderAuto row, ChartRowAuto row) => ChartOptions -> ChartStyle -> [row] -> Chart Source #
Create a chart from the provided options, style, and data by inferring column header types.
Prefer autoChartWithHeaders
when you know your column headers up front.
E.g. The following generates a 2-series bar chart with 4 sections, A, B, C, D
myAutoChart :: Chart myAutoChart = autoChart defaultChartOptions BarChart myData where myData :: [(T.Text, Float, Int)] myData = [ (A, 16, 20) , (B, 11, 23) , (C, 9, 25) , (D, 8, 34) ]
autoChartWithHeaders :: forall row. ChartRowAuto row => ChartOptions -> ChartStyle -> [Column] -> [row] -> Chart Source #
Create a chart from the provided options, style, and data, but use the explicitly provided column headers and types.
E.g. The following generates a 2-series bar chart with 4 sections, A, B, C, D
myAutoChart :: Chart myAutoChart = autoChartWithHeaders defaultChartOptions BarChart headers myData where headers :: [Column] headers = [StringColumn Series, NumberColumn Successes, NumberColumn Inconclusive] myData :: [(T.Text, Float, Int)] myData = [ (A, 16, 20) , (B, 11, 23) , (C, 9, 25) , (D, 8, 34) ]