ia.TimeChart Class
Time Chart.
Constructor
ia.TimeChart
-
id
Parameters:
-
idStringThe 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:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelPaddingNumberThe 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:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelSizeNumberThe 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:
-
labelsStringThe labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelPaddingNumberThe label padding.
Returns:
_dropYLabels
-
labels -
axisSize -
labelHeight
Removes labels from yAxisLabels if they overlap.
Parameters:
-
labelsStringThe labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelHeightNumberThe label height.
Returns:
_getLabelHeight
-
text -
labelPadding -
lineHeight -
availableSpace -
The
Gets the label height for the given text.
Parameters:
-
textStringThe text.
-
labelPaddingNumberThe label padding.
-
lineHeightNumberThe text line height.
-
availableSpaceNumberThe available space for the label.
-
TheNumberheight.
_getLabelWidth
-
text -
labelPadding -
The
Gets the label width for the given text.
Parameters:
-
textStringThe text.
-
labelPaddingNumberThe label padding.
-
TheNumberwidth.
_getLooseLabels
-
minValue -
maxValue -
noLabels
Gets loose labels. The min and max value may change
Parameters:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
Returns:
_getMaxLabelHeight
-
labels -
labelPadding -
The
Gets the maximum label height from a list of labels.
Parameters:
-
labelsStringThe labels.
-
labelPaddingNumberThe label padding.
-
TheNumberwidth.
_getMaxLabelWidth
-
labels -
labelPadding -
The
Gets the maximum label width from a list of labels.
Parameters:
-
labelsStringThe labels.
-
labelPaddingNumberThe label padding.
-
TheNumberwidth.
_getNoLines
-
text -
lineWidth -
The
Gets the number of lines a piece of text will take up given the line width.
Parameters:
-
textStringThe text.
-
lineWidthNumberThe line width.
-
TheNumbernumber of lines.
_getTightLabels
-
minValue -
maxValue -
noLabels
Gets tight labels. The min and max value are maintained.
Parameters:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
Returns:
_getXAxisLabels
-
minValue -
maxValue -
noLabels -
axisSize -
labelPadding
Gets the x-axis labels.
Parameters:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelPaddingNumberThe label padding.
Returns:
_getYAxisLabels
-
minValue -
maxValue -
noLabels -
axisSize -
labelSize
Gets the y-axis labels.
Parameters:
-
minValueNumberThe min value.
-
maxValueNumberThe max value.
-
noLabelsNumberThe number of labels.
-
axisSizeNumberThe pixel area reserved for all the labels.
-
labelSizeNumberThe pixel area reserved for each individual label.
Returns:
_mouseEventHandler
-
event
Responsible for handling mouse events and then dispatching the relevant map event.
Parameters:
-
eventMouseEventDispatched by the mouse.
_touchEventHandler
-
event
Responsible for handling touch events and then dispatching the relevant map event.
Parameters:
-
eventTouchEventDispatched by the mouse.
_wrapText
-
text -
x -
y -
maxWidth -
lineHeight
Wraps text given the space available.
Parameters:
-
textStringThe text.
-
xNumberThe x position of the text.
-
yNumberThe y position of the text
-
maxWidthNumberThe available width.
-
lineHeightNumberThe line height.
addEventListener
-
eventType -
fnc -
obj
Add an event listener.
Parameters:
-
eventTypeStringThe type of event to listen for.
-
fncFunctionThe function to call when the event occurs.
-
objObjectAn optional parent object.
adjustBBox
-
bb
Adjusts the bounding box to fit the pixel space whilst maintaining its aspect ratio.
Parameters:
-
bbia.BoundingBoxThe bounding box.
adjustY
-
bb
Adjusts the y coords to fit the pixel space whilst maintaining x coords.
Parameters:
-
bbia.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:
-
eventObjectThe event object.
endDrag
()
Ends a map drag.
exportData
-
txt
Exports as an image in a new page.
Parameters:
-
txtStringAny text to go with image.
getAxisValues
-
minValue -
minValue -
noValues
Returns the given number of equally spaced values along an axis.
Parameters:
-
minValueNumberThe min value.
-
minValueNumberThe max value.
-
noValuesNumberThe number of values.
Returns:
getDataBBox
-
rect
Converts a rectangle (pixel units) to a bBox (data units).
Parameters:
-
rectia.RectangleA rectangle (pixel units).
Returns:
getDataHeight
-
dimension
Converts a height from pixel units to data units.
Parameters:
-
dimensionNumberA height (pixel units).
Returns:
getDataPoint
-
p
Converts a point from pixel units to data units.
Parameters:
-
pia.PointA point (pixel units).
Returns:
getDataWidth
-
dimension
Converts a width from pixel units to data units.
Parameters:
-
dimensionNumberA width (pixel units).
Returns:
getDataX
-
x
Converts an x-coord from pixel units to data units.
Parameters:
-
xNumberAn x-coord (pixel units).
Returns:
getDataY
-
y
Converts a y-coord from pixel units to data units.
Parameters:
-
yNumberA y-coord (pixel units).
Returns:
getLayer
-
id
Gets the map layer with the given id.
Parameters:
-
idStringThe layer id.
Returns:
getPixelHeight
-
y
Converts a height from data units to pixel units.
Parameters:
-
yNumberA height (data units).
Returns:
getPixelPoint
-
p
Converts a point from data units to pixel units.
Parameters:
-
pia.PointA point (data units).
Returns:
getPixelRect
-
bb
Converts a bounding box (data units) to a rectangle (pixel units).
Parameters:
-
bbia.BoundingBoxA bounding box (data units).
Returns:
getPixelWidth
-
x
Converts a width from data units to pixel units.
Parameters:
-
xNumberA width (data units).
Returns:
getPixelX
-
x
Converts an x-coord from data units to pixel units.
Parameters:
-
xNumberAn x-coord (data units).
Returns:
getPixelY
-
y
Converts a y-coord from data units to pixel units.
Parameters:
-
yNumberA 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:
-
objObjectThe object.
render
()
Clears and renders the chart.
renderAxes
-
xMin -
xMax -
yMin -
yMax
Renders the grid and adjusts the bounding box.
Parameters:
-
xMinNumberThe min value along the x axis.
-
xMaxNumberThe max value along the x axis.
-
yMinNumberThe min value along the y axis.
-
yMaxNumberThe 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.