hs-gchart-0.4: Haskell wrapper for the Google Chart API

Graphics.GChart.Types

Contents

Description

Synopsis

Typeclasses

Typeclasses for abstraction

type ChartM a = State Chart aSource

Chart monad which wraps a State monad in turn to keep track of the chart state and make it convenient to update it

class ChartItem c whereSource

Typeclass abstracting all the fields in a chart

Methods

set :: c -> ChartM ()Source

sets the item in a chart

encode :: c -> [(String, String)]Source

encode the field into a list string params that can then be converted into a query string URL

class Num a => ChartDataEncodable a whereSource

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

Methods

addEncodedChartData :: [a] -> ChartData -> ChartDataSource

Adds the array of numeric data to the existing chart data. Throws a error if the data passed in doesnt match with the current data encoding format.

Chart

Data type to represent the chart

Chart Parameters

Some of these parameters behave differently depending on the chart type;

More details : http://code.google.com/apis/chart/docs/chart_params.html

Bar Width and Spacing

data BarWidth Source

Bar Width

Constructors

Automatic

Automatic resizing

BarWidth Int

Bar width in pixels

Instances

data BarGroupSpacing Source

Bar and Group Spacing

Constructors

Fixed (Int, Int)

Fixed spacing values in pixels

Relative (Float, Float)

Relative values as percentages

Series Colors

data ChartColors Source

Chart colors specified as a list of Color values for each data point.

Constructors

ChartColors [Color] 

type Color = StringSource

Color data specified as a hex string

Chart Data

data ChartData Source

Chart data along with encoding. XY data for is encoded a pair of | consecutive data sets

Constructors

Simple [[Int]]

lets you specify integer values from 0-61, inclusive

Text [[Float]]

supports floating point numbers from 0-100, inclusive

Extended [[Int]]

lets you specify integer values from 0-4095, inclusive

Chart Legend Text and Style

data LegendPosition Source

Position of legend on chart. Applies to ChartLegend

Constructors

LegendBottom

Bottom of chart, horizontally

LegendTop

Top of chart, horizontally

LegendVBottom

Bottom of chart, vertically

LegendVTop

Bottom of chart, vertically

LegendRight

Left of chart

LegendLeft

Right of chart

Instances

Solid, Gradient and Striped Fills

type ChartFills = [Fill]Source

Chart fills, as a list of Fills

data Fill Source

Constructor for a chart fill

Constructors

Fill FillKind FillType 

Instances

data FillKind Source

Specifies the kind of fill

Constructors

Solid Color

Solid Fill

LinearGradient Angle [(Color, Offset)]

Linear Gradient

LinearStripes Angle [(Color, Width)]

Linear Stripes

Instances

data FillType Source

Specifies the type of fill

Constructors

Background

Background fill

Area

Chart area fill

Transparent

Apply transparency to whole chart (applicable to Solid fill only)

Instances

type Offset = FloatSource

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 Width = FloatSource

Width of the stripe. must be between 0 and 1, where 1 is the full width of the chart

type Angle = FloatSource

Angle of the gradient between 0 (horizontal) and 90 (vertical). Applicable to LinearGradient and LinearStripes

Grid Lines

data ChartGrid Source

Grid Lines for Chart

Constructors

ChartGrid 

Fields

xAxisStep :: Float

x-axis step size (0-100)

yAxisStep :: Float

y-axis step size (0-100)

lineSegmentLength :: Maybe Float

length of line segment

blankSegmentLength :: Maybe Float

length of blank segment

xOffset :: Maybe Float

x axis offset

yOffset :: Maybe Float

y axis offset

Pie chart labels, Google-o-meter label (TODO: QR code data, Formula TeX data)

data ChartLabels Source

Labels for Pie Chart and Google-o-meter. Specify a list with a single label for Google-o-meter

Constructors

ChartLabels [String] 

Chart Label Data

data ChartLabelData Source

Chart Label Data. Applies to QRCode

Constructors

QRLabelData ErrorCorrectionLevel Int

Error Correction Level and Margin (as no. of rows)

data ErrorCorrectionLevel Source

Error Correction Level for QR Code

Constructors

L'

recovery of up to 7% data loss

M'

recovery of up to 15% data loss

Q'

recovery of up to 25% data loss

H'

recovery of up to 30% data loss

Line Styles

data LineStyle Source

Line Style. Applicable for line charts

Constructors

LS 

Fields

lineStyleThickness :: Float

Thickness

lineStyleLineSegment :: Float

Length of Line Segment

lineStyleBlankSegment :: Float

Length of Blank Segment

Instances

Shape, Range and Financial Markers

data AnyChartMarker Source

Data type to abstract over all kinds of ChartMarker

Constructors

forall w . ChartMarker w => AnyChartMarker w 

class Show a => ChartMarker a whereSource

Typeclass to abstract over different chart markers

data ShapeType Source

Shape type of ShapeMarker

Constructors

ShapeArrow

Arrow

ShapeCross

Cross

ShapeRectangle

Rectangle

ShapeDiamond

Diamond

ShapeErrorBarMarker

Error Bar Marker

HorizontalLine

Horizontal line across the chart at specified height

HorizontalLineFull

Horizontal line through the specified data marker

ShapeCircle

Circle

ShapeSquare

Square

VerticalLine

Vertical line from x-axis to data point

VerticalLineFull

Vertical line across the chart

ShapeX

X shape

Instances

data MarkerDataPoint Source

Data point value of ShapeMarker

Constructors

DataPoint Float

A specific data point in the dataset. Use a decimal value to interpolate between two points

DataPointEvery

Draw a marker on each data point

DataPointEveryN Int

Draw a marker on every n-th data point

DataPointEveryNRange (Int, Int) Int

(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

DataPointXY (Float, Float)

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

data ShapeMarker Source

Shape Marker

Constructors

SM 

Fields

shapeType :: ShapeType

Shape type

shapeColor :: Color

Shape Marker color

shapeDataSetIdx :: Int

Data Set Index

shapeDataPoints :: MarkerDataPoint

Data point value

shapeSize :: Int

Size in pixels

shapeWidth :: Maybe Int

Optional width used for certain shapes

shapeZorder :: Float

The layer on which to draw the marker. This is a floating point number from -1.0 to 1.0, inclusive, where -1.0 is the bottom and 1.0 is the top

data RangeMarkerType Source

Constructors

RangeMarkerHorizontal

horizontal range

RangeMarkerVertical

vertical range

data RangeMarker Source

Range Marker

Constructors

RM 

Fields

rangeMarkerType :: RangeMarkerType

Range marker type

rangeMarkerColor :: Color

Range marker color

rangeMarkerRange :: (Float, Float)

(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.

data FinancialMarker Source

Financial Marker, for line charts and vertical bar charts

Constructors

FM 

Fields

financeColor :: Color

Finance Marker color

financeDataSetIdx :: Int

Data Set Index

financeDataPoint :: MarkerDataPoint

Data point value

financeSize :: Int

Size in pixels

financePriority :: Int

Priority of drawing. Can be one of -1,0,1

Chart Margins

data ChartMargins Source

Chart Margins. All margin values specified are the minimum margins around the plot area, in pixels.

Constructors

ChartMargins 

Fields

leftMargin :: Int

Left margin around plot area

rightMargin :: Int

Right margin around plot area

topMargin :: Int

Top margin around plot area

bottomMargin :: Int

Bottom margin around plot area

legendMargins :: Maybe (Int, Int)

Minimum width and height of legend

QR code output encoding

data QREncoding Source

QR Code Output Encoding

Constructors

UTF8 
Shift_JIS 
ISO8859_1 

Pie Chart Orientation

data PieChartOrientation Source

Pie Chart Orientation. Applicable only to Pie Charts,

Constructors

PCO Float 

Chart Size

data ChartSize Source

Size of the chart. width and height specified in pixels

Constructors

Size Int Int 

Chart Type

data ChartType Source

Chart type

Constructors

Line

Line Chart

Sparklines

Sparklines

LineXY

Line Chart w/ XY co-ordinates

BarHorizontalStacked

Horizontal bar chart w/ stacked bars

BarVerticalStacked

Vertical bar chart w/ stacked bars

BarHorizontalGrouped

Horizontal bar chart w/ grouped bars

BarVerticalGrouped

Vertical bar chart w/ grouped bars

Pie

Two dimensional pie chart

Pie3D

Three dimensional pie chart

PieConcentric

Concentric pie chart

Venn

Venn Diagram

ScatterPlot

Scatter Plot

Radar

Radar Chart

RadarCurvedLines

Radar Chart, connects points with curved lines

GoogleOMeter

Google-o-meter

Formula

Formula Chart

QRCode

QR Codes

Chart Title and Style

data ChartTitle Source

Title of the chart

Constructors

ChartTitle 

Fields

titleStr :: String

Title

titleColor :: Maybe Color

Title Color

titleFontSize :: Maybe FontSize

Title Font Size

Visible Axis Axis styles and labels

type ChartAxes = [Axis]Source

List of Axis for chart

data AxisType Source

Type of Axis

Constructors

AxisBottom

Bottom x-axis

AxisTop

Top x-axis

AxisLeft

Left y-axis

AxisRight

Right y-axis

Instances

type AxisLabel = StringSource

Axis Labels.

type AxisPosition = FloatSource

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 FontSize = IntSource

Font size in pixels. Applicable to AxisStyle and ChartTitle

data AxisRange Source

Axis Range

The range is specifies with a tuple containing the start and end values. An optional interval value can be specified.

Constructors

Range (Float, Float) (Maybe Float) 

data DrawingControl Source

Control drawing of Axis. Applicable to AxisStyle

Constructors

DrawLines

Draw axis lines only

DrawTicks

Draw tick marks only

DrawLinesTicks

Draw axis lines and tick marks

data AxisStyleAlignment Source

Alignment of Axis labels. Applies to AxisStyle

Constructors

AxisStyleLeft

Left aligned labels

AxisStyleCenter

Centered labels

AxisStyleRight

Right aligned labels

Default Values

These functions return default values for complex parameters, which can be used as starting points to construct parameters when creating charts.