-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell wrapper for the Google Chart API -- -- This module is a wrapper around the Google Chart API. It exposes a -- rich set of Haskell data types to specify your chart data, which can -- then be converted into a URL that generates the PNG image of the -- chart. @package hs-gchart @version 0.2 -- | This module contains the Haskell data model for the Google Chart API. -- -- Details about the parameters can be found on the Google Chart API -- website : http://code.google.com/apis/chart/ -- -- Some chart types are not supported yet : -- -- -- -- Some parameters are not supported yet : -- -- module Graphics.GChart.Types -- | Chart monad which wraps a State monad in turn to keep track of -- the chart state and make it convenient to update it type ChartM a = State Chart a -- | Typeclass abstracting all the fields in a chart class ChartItem c set :: (ChartItem c) => c -> ChartM () encode :: (ChartItem c) => c -> [(String, String)] -- | Typeclass abstracting the numeric data that can be encoded. This helps -- in passing Int and Float values as chart data, which are then encoded -- correctly class (Num a) => ChartDataEncodable a addEncodedChartData :: (ChartDataEncodable a) => [a] -> ChartData -> ChartData -- | Data type for the chart data Chart Chart :: ChartSize -> ChartType -> ChartData -> Maybe ChartTitle -> Maybe ChartColors -> Maybe ChartFills -> Maybe ChartLegend -> Maybe ChartAxes -> Maybe ChartMarkers -> Maybe ChartGrid -> Maybe ChartLabels -> Maybe ChartMargins -> Maybe BarChartWidthSpacing -> Chart chartSize :: Chart -> ChartSize chartType :: Chart -> ChartType chartData :: Chart -> ChartData chartTitle :: Chart -> Maybe ChartTitle chartColors :: Chart -> Maybe ChartColors chartFills :: Chart -> Maybe ChartFills chartLegend :: Chart -> Maybe ChartLegend chartAxes :: Chart -> Maybe ChartAxes chartMarkers :: Chart -> Maybe ChartMarkers chartGrid :: Chart -> Maybe ChartGrid chartLabels :: Chart -> Maybe ChartLabels chartMargins :: Chart -> Maybe ChartMargins barChartWidthSpacing :: Chart -> Maybe BarChartWidthSpacing -- | Size of the chart. width and height specified in pixels data ChartSize Size :: Int -> Int -> ChartSize -- | Chart data along with encoding. XY data for is encoded a pair of | -- consecutive data sets | -- http://code.google.com/apis/chart/formats.html data ChartData -- | lets you specify integer values from 0-61, inclusive Simple :: [[Int]] -> ChartData -- | supports floating point numbers from 0-100, inclusive Text :: [[Float]] -> ChartData -- | lets you specify integer values from 0-4095, inclusive Extended :: [[Int]] -> ChartData -- | Chart type http://code.google.com/apis/chart/types.html data ChartType -- | Line Chart Line :: ChartType -- | Sparklines Sparklines :: ChartType -- | Line Chart w/ XY co-ordinates LineXY :: ChartType -- | Horizontal bar chart w/ stacked bars BarHorizontalStacked :: ChartType -- | Vertical bar chart w/ stacked bars BarVerticalStacked :: ChartType -- | Horizontal bar chart w/ grouped bars BarHorizontalGrouped :: ChartType -- | Vertical bar chart w/ grouped bars BarVerticalGrouped :: ChartType -- | Two dimensional pie chart Pie :: ChartType -- | Three dimensional pie chart Pie3D :: ChartType -- | Concentric pie chart PieConcentric :: ChartType -- | Venn Diagram Venn :: ChartType -- | Scatter Plot ScatterPlot :: ChartType -- | Radar Chart Radar :: ChartType -- | Google-o-meter GoogleOMeter :: ChartType -- | Chart colors specified as a list of Color values for each data -- point. -- http://code.google.com/apis/chart/colors.html#chart_colors data ChartColors ChartColors :: [Color] -> ChartColors -- | Color data specified as a hex string type Color = String -- | Chart fills, as a list of Fills type ChartFills = [Fill] -- | Constructor for a chart fill data Fill Fill :: FillKind -> FillType -> Fill -- | Specifies the kind of fill data FillKind -- | Solid Fill -- http://code.google.com/apis/chart/colors.html#solid_fill Solid :: Color -> FillKind -- | Linear Gradient -- http://code.google.com/apis/chart/colors.html#linear_gradient LinearGradient :: Angle -> [(Color, Offset)] -> FillKind -- | Linear Stripes -- http://code.google.com/apis/chart/colors.html#linear_stripes LinearStripes :: Angle -> [(Color, Width)] -> FillKind -- | Specifies the type of fill data FillType -- | Background fill Background :: FillType -- | Chart area fill Area :: FillType -- | Apply transparency to whole chart (applicable to Solid fill -- only) Transparent :: FillType -- | Specifies at what point the color is pure. In this parameter, 0 -- specifies the right-most chart position and 1 specifies the left-most -- chart position. Applicable to LinearGradient type Offset = Float -- | Width of the stripe. must be between 0 and 1, where 1 is the full -- width of the chart type Width = Float -- | Specifies the angle of the gradient between 0 (horizontal) and 90 -- (vertical). Applicable to LinearGradient and -- LinearStripes type Angle = Float -- | Title of the chart | -- http://code.google.com/apis/chart/labels.html#chart_title data ChartTitle ChartTitle :: String -> Maybe Color -> Maybe FontSize -> ChartTitle -- | Title titleStr :: ChartTitle -> String -- | Title Color titleColor :: ChartTitle -> Maybe Color -- | Title Font Size titleFontSize :: ChartTitle -> Maybe FontSize -- | Specifies a chart legend -- http://code.google.com/apis/chart/labels.html#chart_legend data ChartLegend Legend :: [String] -> (Maybe LegendPosition) -> ChartLegend -- | Position of legend on chart. Applies to ChartLegend data LegendPosition -- | Bottom of chart, horizontally LegendBottom :: LegendPosition -- | Top of chart, horizontally LegendTop :: LegendPosition -- | Bottom of chart, vertically LegendVBottom :: LegendPosition -- | Bottom of chart, vertically LegendVTop :: LegendPosition -- | Left of chart LegendRight :: LegendPosition -- | Right of chart LegendLeft :: LegendPosition -- | Labels for Pie Chart and Google-o-meter. Specify a list with a single -- label for Google-o-meter data ChartLabels ChartLabels :: [String] -> ChartLabels -- | List of Axis for chart type ChartAxes = [Axis] -- | Specify an axis for chart. -- http://code.google.com/apis/chart/labels.html#axis_styles data Axis Axis :: AxisType -> Maybe [AxisLabel] -> Maybe [AxisPosition] -> Maybe AxisRange -> Maybe AxisStyle -> Axis axisType :: Axis -> AxisType axisLabels :: Axis -> Maybe [AxisLabel] axisPositions :: Axis -> Maybe [AxisPosition] axisRange :: Axis -> Maybe AxisRange axisStyle :: Axis -> Maybe AxisStyle -- | Type of Axis -- http://code.google.com/apis/chart/labels.html#axis_type data AxisType -- | Bottom x-axis AxisBottom :: AxisType -- | Top x-axis AxisTop :: AxisType -- | Left y-axis AxisLeft :: AxisType -- | Right y-axis AxisRight :: AxisType -- | Axis Labels. -- http://code.google.com/apis/chart/labels.html#axis_labels type AxisLabel = String -- | Axis Label Positions. -- http://code.google.com/apis/chart/labels.html#axis_label_positions -- -- Labels with a specified position of 0 are placed at the bottom of the -- y- or r-axis, or at the left of the x- or t-axis. -- -- Labels with a specified position of 100 are placed at the top of the -- y- or r-axis, or at the right of the x- or t-axis. type AxisPosition = Float -- | Font size in pixels. Applicable to AxisStyle and -- ChartTitle type FontSize = Int -- | Axis Range -- http://code.google.com/apis/chart/labels.html#axis_range -- -- The range is specifies with a tuple containing the start and end -- values. An optional interval value can be specified. data AxisRange Range :: (Float, Float) -> (Maybe Float) -> AxisRange -- | Specify Axis style -- http://code.google.com/apis/chart/labels.html#axis_styles data AxisStyle Style :: Color -> Maybe FontSize -> Maybe AxisStyleAlignment -> Maybe DrawingControl -> Maybe Color -> AxisStyle axisColor :: AxisStyle -> Color axisFontSize :: AxisStyle -> Maybe FontSize axisStyleAlign :: AxisStyle -> Maybe AxisStyleAlignment axisDrawingControl :: AxisStyle -> Maybe DrawingControl tickMarkColor :: AxisStyle -> Maybe Color -- | Control drawing of Axis. Applicable to AxisStyle data DrawingControl -- | Draw axis lines only DrawLines :: DrawingControl -- | Draw tick marks only DrawTicks :: DrawingControl -- | Draw axis lines and tick marks DrawLinesTicks :: DrawingControl -- | Alignment of Axis labels. Applies to AxisStyle data AxisStyleAlignment -- | Left aligned labels AxisStyleLeft :: AxisStyleAlignment -- | Centered labels AxisStyleCenter :: AxisStyleAlignment -- | Right aligned labels AxisStyleRight :: AxisStyleAlignment -- | Bar Width and Spacing. type BarChartWidthSpacing = (Maybe BarWidth, Maybe BarGroupSpacing) -- | Bar Width data BarWidth -- | Automatic resizing Automatic :: BarWidth -- | Bar width in pixels BarWidth :: Int -> BarWidth -- | Bar and Group Spacing data BarGroupSpacing -- | Fixed spacing values in pixels Fixed :: (Int, Int) -> BarGroupSpacing -- | Relative values as percentages Relative :: (Float, Float) -> BarGroupSpacing -- | Chart Margins. All margin values specified are the minimum margins -- around the plot area, in pixels. -- http://code.google.com/apis/chart/styles.html#chart_margins data ChartMargins ChartMargins :: Int -> Int -> Int -> Int -> Maybe (Int, Int) -> ChartMargins -- | Left margin around plot area leftMargin :: ChartMargins -> Int -- | Right margin around plot area rightMargin :: ChartMargins -> Int -- | Top margin around plot area topMargin :: ChartMargins -> Int -- | Bottom margin around plot area bottomMargin :: ChartMargins -> Int -- | Minimum width and height of legend legendMargins :: ChartMargins -> Maybe (Int, Int) -- | Grid Lines for Chart -- http://code.google.com/apis/chart/styles.html#grid data ChartGrid ChartGrid :: Float -> Float -> Maybe Float -> Maybe Float -> Maybe Float -> Maybe Float -> ChartGrid -- | x-axis step size (0-100) xAxisStep :: ChartGrid -> Float -- | y-axis step size (0-100) yAxisStep :: ChartGrid -> Float -- | length of line segment lineSegmentLength :: ChartGrid -> Maybe Float -- | length of blank segment blankSegmentLength :: ChartGrid -> Maybe Float -- | x axis offset xOffset :: ChartGrid -> Maybe Float -- | y axis offset yOffset :: ChartGrid -> Maybe Float -- | Data type to abstract over all kinds of ChartMarker data AnyChartMarker AnyChartMarker :: w -> AnyChartMarker -- | Typeclass to abstract over different chart markers class (Show a) => ChartMarker a encodeChartMarker :: (ChartMarker a) => a -> String type ChartMarkers = [AnyChartMarker] -- | Shape type of ShapeMarker data ShapeType -- | Arrow ShapeArrow :: ShapeType -- | Cross ShapeCross :: ShapeType -- | Diamond ShapeDiamond :: ShapeType -- | Circle ShapeCircle :: ShapeType -- | Square ShapeSquare :: ShapeType -- | Vertical line from x-axis to data point VerticalLine :: ShapeType -- | Vertical line across the chart VerticalLineFull :: ShapeType -- | Horizontal line across the chart HorizontalLine :: ShapeType -- | X shape ShapeX :: ShapeType -- | Data point value of ShapeMarker data MarkerDataPoint -- | A specific data point in the dataset. Use a decimal value to -- interpolate between two points DataPoint :: Float -> MarkerDataPoint -- | Draw a marker on each data point DataPointEvery :: MarkerDataPoint -- | Draw a marker on every n-th data point DataPointEveryN :: Int -> MarkerDataPoint -- | (x,y), n draw a marker on every n-th data point in a range, -- where x is the first data point in the range, and y is the last data -- point in the range DataPointEveryNRange :: (Int, Int) -> Int -> MarkerDataPoint -- | draw a marker at a specific point (x,y). Specify the coordinates as -- floating point values, where 0:0 is the bottom left corner of the -- chart, 0.5:0.5 is the center of the chart, and 1:1 is the top right -- corner of the chart DataPointXY :: (Float, Float) -> MarkerDataPoint -- | Shape Marker data ShapeMarker SM :: ShapeType -> Color -> Int -> MarkerDataPoint -> Int -> Int -> ShapeMarker -- | Shape type shapeType :: ShapeMarker -> ShapeType -- | Shape Marker color shapeColor :: ShapeMarker -> Color -- | Data Set Index shapeDataSetIdx :: ShapeMarker -> Int -- | Data point value shapeDataPoint :: ShapeMarker -> MarkerDataPoint -- | Size in pixels shapeSize :: ShapeMarker -> Int -- | Priority of drawing. Can be one of -1,0,1 shapePriority :: ShapeMarker -> Int -- | RangeMarker type data RangeMarkerType -- | horizontal range RangeMarkerHorizontal :: RangeMarkerType -- | vertical range RangeMarkerVertical :: RangeMarkerType -- | Range Marker data RangeMarker RM :: RangeMarkerType -> Color -> (Float, Float) -> RangeMarker -- | Range marker type rangeMarkerType :: RangeMarker -> RangeMarkerType -- | Range marker color rangeMarkerColor :: RangeMarker -> Color -- | (start,end) range. For horizontal range markers, the -- (start,end) value is a position on the y-axis, where 0.00 is the -- bottom of the chart, and 1.00 is the top of the chart. For vertical -- range markers, the (start,end) value is a position on the x-axis, -- where 0.00 is the left of the chart, and 1.00 is the right of the -- chart. rangeMarkerRange :: RangeMarker -> (Float, Float) -- | Financial Marker, for line charts and vertical bar charts data FinancialMarker FM :: Color -> Int -> MarkerDataPoint -> Int -> Int -> FinancialMarker -- | Finance Marker color financeColor :: FinancialMarker -> Color -- | Data Set Index financeDataSetIdx :: FinancialMarker -> Int -- | Data point value financeDataPoint :: FinancialMarker -> MarkerDataPoint -- | Size in pixels financeSize :: FinancialMarker -> Int -- | Priority of drawing. Can be one of -1,0,1 financePriority :: FinancialMarker -> Int defaultChart :: Chart defaultAxis :: Axis defaultGrid :: ChartGrid defaultSpacing :: BarGroupSpacing defaultShapeMarker :: ShapeMarker defaultRangeMarker :: RangeMarker defaultFinancialMarker :: FinancialMarker instance Show Chart instance Show BarGroupSpacing instance Show BarWidth instance Show ChartMargins instance Show ChartLabels instance Show FinancialMarker instance Show RangeMarker instance Show RangeMarkerType instance Show ShapeMarker instance Show MarkerDataPoint instance Show ShapeType instance Show ChartGrid instance Show Axis instance Show AxisStyle instance Eq AxisStyle instance Show DrawingControl instance Eq DrawingControl instance Show AxisStyleAlignment instance Eq AxisStyleAlignment instance Show AxisRange instance Eq AxisRange instance Show AxisType instance Show ChartLegend instance Show LegendPosition instance Show Fill instance Show FillType instance Show FillKind instance Show ChartColors instance Show ChartData instance Show ChartTitle instance Show ChartType instance Show ChartSize instance Show AnyChartMarker instance ChartMarker AnyChartMarker -- | Import this module to generate charts using the Google Chart API. -- -- For more examples, refer to Examples.hs in the source -- tarball, or download it directly from Github : -- http://github.com/deepakjois/hs-gchart/blob/master/examples/Examples.hs. -- -- For documentation regarding the full data model, refer to -- Graphics.GChart.Types. -- -- For more information about the Google Chart API, refer to -- http://code.google.com/apis/chart/ module Graphics.GChart -- | Set the chart size by passing the width and the height in pixels For -- e.g : setChartSize 320 200 setChartSize :: Int -> Int -> ChartM () -- | Set the chart type by passing a ChartType setChartType :: ChartType -> ChartM () -- | Use it with simple, text or extended to specify -- the encoding. For e.g -- --
--   setDataEncoding simple
--   
-- -- Make sure you pass in values of the right type, Int for simple and -- extended encoding, and Float for text encoding. setDataEncoding :: ChartData -> ChartM () -- | Set the chart title by passing a ChartTitle setChartTitle :: String -> ChartM () -- | Set the chart title with a color setChartTitleWithColor :: String -> Color -> ChartM () -- | Set the chart title with color and font size setChartTitleWithColorAndFontSize :: String -> Color -> FontSize -> ChartM () -- | Add data to chart. Make sure you have set the data encoding using -- setDataEncoding before calling this function, otherwise it may -- generate gibberish, or throw an error addChartData :: (ChartDataEncodable a) => [a] -> ChartM () -- | Works like addChartData, but for XY datasets for line XY chart -- etc addChartDataXY :: (ChartDataEncodable a) => [(a, a)] -> ChartM () -- | Pass a list of colors corresponding to the datasets in the chart setColors :: [Color] -> ChartM () -- | Add a color to the chart. This color will be added to the list -- ChartColors. -- -- Make sure you do not include a call to setColors at any time -- after a call to addColor, since this will lead to all previous -- values being erased. addColor :: Color -> ChartM () -- | Add a Fill to the chart addFill :: Fill -> ChartM () -- | Set a Legend for the chart setLegend :: ChartLegend -> ChartM () -- | Add an Axis to the chart addAxis :: Axis -> ChartM () -- | Set a ChartGrid for the chart setGrid :: ChartGrid -> ChartM () -- | Set labels for the chart setLabels :: [String] -> ChartM () -- | Set bar and width spacing setBarWidthSpacing :: BarChartWidthSpacing -> ChartM () -- | Shape Marker makeShapeMarker :: ShapeMarker -- | Range Marker makeRangeMarker :: RangeMarker -- | Financial Marker makeFinancialMarker :: FinancialMarker -- | Adds a shape marker. Use makeShapeMarker smart constructor when -- calling this function If value of data set index is not specified when -- using makeShapeMarker, it automatically adds a data index to -- refer to the latest data set addShapeMarker :: ShapeMarker -> ChartM () -- | Adds a range marker. You can use makeRangeMarker smart -- constructor when calling this function addRangeMarker :: RangeMarker -> ChartM () -- | Adds a financial marker. User makeFinancialMarker smart -- constructor when calling this function. If value of data set index is -- not specified when using makeFinancialMarker, it automatically -- adds a data index to refer to the latest data set addFinancialMarker :: FinancialMarker -> ChartM () -- | Extracts the data out of the monad and returns a value of type -- Chart getChartData :: ChartM () -> Chart -- | Extracts the data out of the monad and returns a URL string for the -- chart getChartUrl :: ChartM () -> String -- | Converts a value of type Chart to a URL convertToUrl :: Chart -> String solid :: Color -> FillType -> Fill -- | generates a Solid fill from a hex color value -- -- generates a ChartLegend from a list of labels legend :: [String] -> ChartLegend -- | generats a ChartLegend from a list of lables and a -- LegendPosition legendWithPosition :: [String] -> LegendPosition -> ChartLegend -- | returns a default axis. Use this to override the fields with your own -- values. For e.g : -- --
--   makeAxis { axisType = AxisTop,
--              axisLabels = ["0","50","100"] }
--   
makeAxis :: Axis -- | returns a default axis. Use this to override the fields with your own -- values. For e.g : -- --
--   makeGrid { xAxisStep = 10,
--              yAxisStep = 10,
--               xOffset = Just 5 }
--   
makeGrid :: ChartGrid -- | Use this to specify the Simple encoding for the -- setDataEncoding function. simple :: ChartData -- | Use this to specify the Text encoding for the -- setDataEncoding function. text :: ChartData -- | Use this to specify the Extended encoding for the -- setDataEncoding function. extended :: ChartData -- | Set automatic bar width for bar chart automatic :: BarChartWidthSpacing -- | Set automatic bar width for bar chart, with spacing values automaticWithSpacing :: Int -> Int -> BarChartWidthSpacing -- | Set bar width for chart barwidth :: Int -> BarChartWidthSpacing -- | Set bar width and spacing for chart barwidthspacing :: Int -> Int -> Int -> BarChartWidthSpacing -- | Set relative spacing relative :: Float -> Float -> BarChartWidthSpacing