ia.CanvasBase Class
ia.CanvasBase defines the basic layout behavior of chart or map.
Constructor
ia.CanvasBase
-
id
Parameters:
-
idStringThe id.
Item Index
Methods
- _addListeners
- _createCanvas
- _mouseEventHandler
- _touchEventHandler
- addEventListener
- addLayer
- adjustBBox
- adjustY
- clear
- clear
- commitChanges
- dispatchEvent
- endDrag
- exportData
- getBBox
- getDataBBox
- getDataHeight
- getDataPoint
- getDataWidth
- getDataX
- getDataY
- getLayer
- getLayers
- getPixelHeight
- getPixelPoint
- getPixelRect
- getPixelWidth
- getPixelX
- getPixelY
- hide
- mouseCoords
- removeLayers
- removeListener
- render
- setBBox
- show
- startDrag
- toggle
Methods
_addListeners
()
private
Adds the listeners.
_createCanvas
()
HTML Canvas
private
Creates a new canvas.
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.
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.
clear
()
Clears the foreground 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.
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 map.
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.
canvas
HTML Canvas
The foreground canvas for drawing elements on top of the map/chart.
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
container
JQUERY Element
The container that holds the object.
context
HTML Canvas Context
The canvas context.
context
HTML Canvas Context
The foreground context for drawing elements on top of the map/chart.
embeddedInGoogleMaps
Boolean
Indicates if embedded in google maps.
Default: false
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