ia.PieChart Class
Pie Chart.
Constructor
ia.PieChart
-
id
Parameters:
-
id
StringThe id of the chart.
Item Index
Methods
- _addListeners
- _calculateXAxisLabels
- _calculateYAxisLabels
- _createCanvas
- _dropXLabels
- _dropYLabels
- _getLabelHeight
- _getLabelWidth
- _getLooseLabels
- _getMaxLabelHeight
- _getMaxLabelWidth
- _getNoLines
- _getTightLabels
- _getXAxisLabels
- _getYAxisLabels
- _mouseEventHandler
- _touchEventHandler
- _wrapText
- addEventListener
- addLayer
- adjustBBox
- adjustY
- clear
- commitChanges
- dispatchEvent
- endDrag
- exportData
- getAxisValues
- getBBox
- getDataBBox
- getDataHeight
- getDataPoint
- getDataWidth
- getDataX
- getDataY
- getLayer
- getLayers
- getPixelHeight
- getPixelPoint
- getPixelRect
- getPixelWidth
- getPixelX
- getPixelY
- hide
- mouseCoords
- removeLayers
- removeListener
- render
- renderAxes
- setBBox
- show
- startDrag
- toggle
Properties
- animationMode
- backgroundContainer
- canvas
- canvasHeight
- canvasWidth
- canvasX
- canvasY
- centerXAxisLabels
- centerYAxisLabels
- container
- context
- datatip
- embeddedInGoogleMaps
- fixedMaxValue
- fixedMinValue
- foregroundContainer
- formatter
- id
- isDraggable
- isVisible
- layerContainer
- maintainAspectRatio
- mapContainer
- maxZoom
- minZoom
- mouseX
- mouseY
- orientation
- showBottomBorder
- showBox
- showLeftBorder
- showRightBorder
- showTopBorder
- showXAxisGrid
- showXAxisLabels
- showXAxisTickMarks
- showYAxisGrid
- showYAxisLabels
- showYAxisTickMarks
- useTightLabels
- wrapXAxisLabels
- xAxisLabels
- xAxisTitle
- yAxisLabels
- yAxisTitle
Methods
_addListeners
()
private
Adds the listeners.
_calculateXAxisLabels
-
minValue
-
maxValue
-
noLabels
-
axisSize
-
labelPadding
Calculates the x-axis labels. Keeps reducing the number of labels till they dont overlap.
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelPadding
NumberThe label padding.
Returns:
_calculateYAxisLabels
-
minValue
-
maxValue
-
noLabels
-
axisSize
-
labelSize
Calculates the y-axis labels. Keeps reducing the number of labels till they dont overlap.
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelSize
NumberThe pixel area reserved for each individual label.
Returns:
_createCanvas
()
HTML Canvas
private
Creates a new canvas.
Returns:
_dropXLabels
-
labels
-
axisSize
-
labelPadding
Removes labels from xAxisLabels if they overlap.
Parameters:
-
labels
StringThe labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelPadding
NumberThe label padding.
Returns:
_dropYLabels
-
labels
-
axisSize
-
labelHeight
Removes labels from yAxisLabels if they overlap.
Parameters:
-
labels
StringThe labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelHeight
NumberThe label height.
Returns:
_getLabelHeight
-
text
-
labelPadding
-
lineHeight
-
availableSpace
-
The
Gets the label height for the given text.
Parameters:
-
text
StringThe text.
-
labelPadding
NumberThe label padding.
-
lineHeight
NumberThe text line height.
-
availableSpace
NumberThe available space for the label.
-
The
Numberheight.
_getLabelWidth
-
text
-
labelPadding
-
The
Gets the label width for the given text.
Parameters:
-
text
StringThe text.
-
labelPadding
NumberThe label padding.
-
The
Numberwidth.
_getLooseLabels
-
minValue
-
maxValue
-
noLabels
Gets loose labels. The min and max value may change
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
Returns:
_getMaxLabelHeight
-
labels
-
labelPadding
-
The
Gets the maximum label height from a list of labels.
Parameters:
-
labels
StringThe labels.
-
labelPadding
NumberThe label padding.
-
The
Numberwidth.
_getMaxLabelWidth
-
labels
-
labelPadding
-
The
Gets the maximum label width from a list of labels.
Parameters:
-
labels
StringThe labels.
-
labelPadding
NumberThe label padding.
-
The
Numberwidth.
_getNoLines
-
text
-
lineWidth
-
The
Gets the number of lines a piece of text will take up given the line width.
Parameters:
-
text
StringThe text.
-
lineWidth
NumberThe line width.
-
The
Numbernumber of lines.
_getTightLabels
-
minValue
-
maxValue
-
noLabels
Gets tight labels. The min and max value are maintained.
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
Returns:
_getXAxisLabels
-
minValue
-
maxValue
-
noLabels
-
axisSize
-
labelPadding
Gets the x-axis labels.
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelPadding
NumberThe label padding.
Returns:
_getYAxisLabels
-
minValue
-
maxValue
-
noLabels
-
axisSize
-
labelSize
Gets the y-axis labels.
Parameters:
-
minValue
NumberThe min value.
-
maxValue
NumberThe max value.
-
noLabels
NumberThe number of labels.
-
axisSize
NumberThe pixel area reserved for all the labels.
-
labelSize
NumberThe pixel area reserved for each individual label.
Returns:
_mouseEventHandler
-
event
Responsible for handling mouse events and then dispatching the relevant map event.
Parameters:
-
event
MouseEventDispatched by the mouse.
_touchEventHandler
-
event
Responsible for handling touch events and then dispatching the relevant map event.
Parameters:
-
event
TouchEventDispatched by the mouse.
_wrapText
-
text
-
x
-
y
-
maxWidth
-
lineHeight
Wraps text given the space available.
Parameters:
-
text
StringThe text.
-
x
NumberThe x position of the text.
-
y
NumberThe y position of the text
-
maxWidth
NumberThe available width.
-
lineHeight
NumberThe line height.
addEventListener
-
eventType
-
fnc
-
obj
Add an event listener.
Parameters:
-
eventType
StringThe type of event to listen for.
-
fnc
FunctionThe function to call when the event occurs.
-
obj
ObjectAn optional parent object.
adjustBBox
-
bb
Adjusts the bounding box to fit the pixel space whilst maintaining its aspect ratio.
Parameters:
-
bb
ia.BoundingBoxThe bounding box.
adjustY
-
bb
Adjusts the y coords to fit the pixel space whilst maintaining x coords.
Parameters:
-
bb
ia.BoundingBoxThe bounding box.
clear
()
Clears the canvas.
commitChanges
()
A call to commitChanges
commits any changes made to
canvasWidth, canvasHeight or bBox.
This function exists to allow properties to be changed without continuous updates to the object.
dispatchEvent
-
event
Dispatch an event to the listeners.
Parameters:
-
event
ObjectThe event object.
endDrag
()
Ends a map drag.
exportData
-
txt
Exports as an image in a new page.
Parameters:
-
txt
StringAny text to go with image.
getAxisValues
-
minValue
-
minValue
-
noValues
Returns the given number of equally spaced values along an axis.
Parameters:
-
minValue
NumberThe min value.
-
minValue
NumberThe max value.
-
noValues
NumberThe number of values.
Returns:
getDataBBox
-
rect
Converts a rectangle (pixel units) to a bBox (data units).
Parameters:
-
rect
ia.RectangleA rectangle (pixel units).
Returns:
getDataHeight
-
dimension
Converts a height from pixel units to data units.
Parameters:
-
dimension
NumberA height (pixel units).
Returns:
getDataPoint
-
p
Converts a point from pixel units to data units.
Parameters:
-
p
ia.PointA point (pixel units).
Returns:
getDataWidth
-
dimension
Converts a width from pixel units to data units.
Parameters:
-
dimension
NumberA width (pixel units).
Returns:
getDataX
-
x
Converts an x-coord from pixel units to data units.
Parameters:
-
x
NumberAn x-coord (pixel units).
Returns:
getDataY
-
y
Converts a y-coord from pixel units to data units.
Parameters:
-
y
NumberA y-coord (pixel units).
Returns:
getLayer
-
id
Gets the map layer with the given id.
Parameters:
-
id
StringThe layer id.
Returns:
getPixelHeight
-
y
Converts a height from data units to pixel units.
Parameters:
-
y
NumberA height (data units).
Returns:
getPixelPoint
-
p
Converts a point from data units to pixel units.
Parameters:
-
p
ia.PointA point (data units).
Returns:
getPixelRect
-
bb
Converts a bounding box (data units) to a rectangle (pixel units).
Parameters:
-
bb
ia.BoundingBoxA bounding box (data units).
Returns:
getPixelWidth
-
x
Converts a width from data units to pixel units.
Parameters:
-
x
NumberA width (data units).
Returns:
getPixelX
-
x
Converts an x-coord from data units to pixel units.
Parameters:
-
x
NumberAn x-coord (data units).
Returns:
getPixelY
-
y
Converts a y-coord from data units to pixel units.
Parameters:
-
y
NumberA y-coord (data units).
Returns:
hide
()
Hides the chart.
mouseCoords
()
ia.Point
Returns the cursor position in data units.
Returns:
removeLayers
()
Removes all layers from the map.
removeListener
-
obj
Removes all event listeners for the given object.
Parameters:
-
obj
ObjectThe object.
render
()
Clears and renders the map.
renderAxes
-
xMin
-
xMax
-
yMin
-
yMax
Renders the grid and adjusts the bounding box.
Parameters:
-
xMin
NumberThe min value along the x axis.
-
xMax
NumberThe max value along the x axis.
-
yMin
NumberThe min value along the y axis.
-
yMax
NumberThe max value along the y axis.
show
()
Shows the chart.
startDrag
()
Starts a map drag.
toggle
()
Toggles the chart visibility.
Properties
animationMode
Boolean
Animation mode.
Default: false
backgroundContainer
JQUERY Element
Containers the map canvas.
canvas
HTML Canvas
The canvas.
canvasHeight
Number
The pixel height.
Default: 0
canvasWidth
Number
The pixel width.
Default: 0
canvasX
Number
The pixel x-position.
Default: 0
canvasY
Number
The pixel y-position.
Default: 0
centerXAxisLabels
Boolean
Center the x axis labels.
Default: false
centerYAxisLabels
Boolean
Center the y axis labels.
Default: false
container
JQUERY Element
The container that holds the object.
context
HTML Canvas Context
The canvas context.
embeddedInGoogleMaps
Boolean
Indicates if embedded in google maps.
Default: false
fixedMaxValue
Number
The max value.
fixedMinValue
Number
The min value.
foregroundContainer
JQUERY Element
Containers selection / highlight canvas.
id
String
The id.
isDraggable
Boolean
Indicates if its draggable ie Its a map - used by touch events.
Default: false
isVisible
Boolean
The chart visibility.
Default: true
layerContainer
JQUERY Element
The container that holds the layers.
maintainAspectRatio
Boolean
The data space will often be a different shape to the pixel space it has to fill.
If set to true
the data space is
adjusted to maintain the aspect ratio.
If set to false
the data space stretches
to fit the pixel space. This will generally result
in the aspect ratio changing (a stretching effect).
Default: false
mapContainer
JQUERY Element
The container that holds all the divs.
maxZoom
Number
The maximum extent.
Default: -1
minZoom
Number
The minimum extent.
Default: -1
mouseX
Number
The x coordinate of the mouse (pixel units) relative to the map origin.
Default: 0
mouseY
Number
The y coordinate of the mouse (pixel units) relative to the map origin.
Default: 0
orientation
String
The chart orientation.
Default: "vertical"
showBottomBorder
Boolean
Show the bottom border.
Default: false
showBox
Boolean
Show a box around the chart.
Default: false
showLeftBorder
Boolean
Show the left border.
Default: false
showRightBorder
Boolean
Show the right border.
Default: false
showTopBorder
Boolean
Show the top border.
Default: false
showXAxisGrid
Boolean
Show the x axis grid.
Default: true
showXAxisLabels
Boolean
Show the x axis labels.
Default: true
showXAxisTickMarks
Boolean
Show x axis tick marks.
Default: false
showYAxisGrid
Boolean
Show the y axis grid.
Default: true
showYAxisLabels
Boolean
Show the y axis labels.
Default: true
showYAxisTickMarks
Boolean
Show y axis tick marks.
Default: false
useTightLabels
Boolean
Should the chart use tight labels.
Default: false
wrapXAxisLabels
Boolean
Wrap the x axis labels.
Default: false
xAxisLabels
String
X axis labels.
xAxisTitle
String
The x axis title.
yAxisLabels
String
Y axis labels.
yAxisTitle
String
The y axis title.