Show:

ia.BoxChart Class

Extends ia.ChartBase
Module: ia

Box Chart.

Constructor

ia.BoxChart

(
  • id
)

Parameters:

  • id String

    The id of the chart.

Methods

_addListeners

() private

Adds the listeners.

_calculateXAxisLabels

(
  • minValue
  • maxValue
  • noLabels
  • axisSize
  • labelPadding
)
String private

Calculates the x-axis labels. Keeps reducing the number of labels till they dont overlap.

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelPadding Number

    The label padding.

Returns:

String: The list of labels.

_calculateYAxisLabels

(
  • minValue
  • maxValue
  • noLabels
  • axisSize
  • labelSize
)
String private

Calculates the y-axis labels. Keeps reducing the number of labels till they dont overlap.

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelSize Number

    The pixel area reserved for each individual label.

Returns:

String: The list of labels.

_createCanvas

() HTML Canvas private

Creates a new canvas.

Returns:

HTML Canvas: The canvas.

_dropXLabels

(
  • labels
  • axisSize
  • labelPadding
)
String private

Removes labels from xAxisLabels if they overlap.

Parameters:

  • labels String

    The labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelPadding Number

    The label padding.

Returns:

String: The list of labels.

_dropYLabels

(
  • labels
  • axisSize
  • labelHeight
)
String private

Removes labels from yAxisLabels if they overlap.

Parameters:

  • labels String

    The labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelHeight Number

    The label height.

Returns:

String: The list of labels.

_getLabelHeight

(
  • text
  • labelPadding
  • lineHeight
  • availableSpace
  • The
)
private

Gets the label height for the given text.

Parameters:

  • text String

    The text.

  • labelPadding Number

    The label padding.

  • lineHeight Number

    The text line height.

  • availableSpace Number

    The available space for the label.

  • The Number

    height.

_getLabelWidth

(
  • text
  • labelPadding
  • The
)
private

Gets the label width for the given text.

Parameters:

  • text String

    The text.

  • labelPadding Number

    The label padding.

  • The Number

    width.

_getLooseLabels

(
  • minValue
  • maxValue
  • noLabels
)
String private

Gets loose labels. The min and max value may change

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

Returns:

String: The list of labels.

_getMaxLabelHeight

(
  • labels
  • labelPadding
  • The
)
private

Gets the maximum label height from a list of labels.

Parameters:

  • labels String

    The labels.

  • labelPadding Number

    The label padding.

  • The Number

    width.

_getMaxLabelWidth

(
  • labels
  • labelPadding
  • The
)
private

Gets the maximum label width from a list of labels.

Parameters:

  • labels String

    The labels.

  • labelPadding Number

    The label padding.

  • The Number

    width.

_getNoLines

(
  • text
  • lineWidth
  • The
)
private

Gets the number of lines a piece of text will take up given the line width.

Parameters:

  • text String

    The text.

  • lineWidth Number

    The line width.

  • The Number

    number of lines.

_getTightLabels

(
  • minValue
  • maxValue
  • noLabels
)
String private

Gets tight labels. The min and max value are maintained.

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

Returns:

String: The list of labels.

_getXAxisLabels

(
  • minValue
  • maxValue
  • noLabels
  • axisSize
  • labelPadding
)
String private

Gets the x-axis labels.

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelPadding Number

    The label padding.

Returns:

String: The list of labels.

_getYAxisLabels

(
  • minValue
  • maxValue
  • noLabels
  • axisSize
  • labelSize
)
String private

Gets the y-axis labels.

Parameters:

  • minValue Number

    The min value.

  • maxValue Number

    The max value.

  • noLabels Number

    The number of labels.

  • axisSize Number

    The pixel area reserved for all the labels.

  • labelSize Number

    The pixel area reserved for each individual label.

Returns:

String: The list of labels.

_mouseEventHandler

(
  • event
)
private

Responsible for handling mouse events and then dispatching the relevant map event.

Parameters:

  • event MouseEvent

    Dispatched by the mouse.

_touchEventHandler

(
  • event
)
private

Responsible for handling touch events and then dispatching the relevant map event.

Parameters:

  • event TouchEvent

    Dispatched by the mouse.

_wrapText

(
  • text
  • x
  • y
  • maxWidth
  • lineHeight
)
private

Wraps text given the space available.

Parameters:

  • text String

    The text.

  • x Number

    The x position of the text.

  • y Number

    The y position of the text

  • maxWidth Number

    The available width.

  • lineHeight Number

    The line height.

addEventListener

(
  • eventType
  • fnc
  • obj
)

Add an event listener.

Parameters:

  • eventType String

    The type of event to listen for.

  • fnc Function

    The function to call when the event occurs.

  • obj Object

    An optional parent object.

addLayer

(
  • layer
)

Adds a layer to the map.

Parameters:

adjustBBox

(
  • bb
)

Adjusts the bounding box to fit the pixel space whilst maintaining its aspect ratio.

Parameters:

adjustY

(
  • bb
)

Adjusts the y coords to fit the pixel space whilst maintaining x coords.

Parameters:

clear

()

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:590

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 Object

    The event object.

endDrag

()

Ends a map drag.

exportData

(
  • txt
)

Exports as an image in a new page.

Parameters:

  • txt String

    Any text to go with image.

getAxisValues

(
  • minValue
  • minValue
  • noValues
)
Number

Returns the given number of equally spaced values along an axis.

Parameters:

  • minValue Number

    The min value.

  • minValue Number

    The max value.

  • noValues Number

    The number of values.

Returns:

Number: A list of values.

getBBox

() ia.BoundingBox

Gets the bounding box.

Returns:

ia.BoundingBox: The bounding box.

getDataBBox

(
  • rect
)
ia.BoundingBox

Converts a rectangle (pixel units) to a bBox (data units).

Parameters:

Returns:

ia.BoundingBox: A bBox (data units).

getDataHeight

(
  • dimension
)
Number

Converts a height from pixel units to data units.

Parameters:

  • dimension Number

    A height (pixel units).

Returns:

Number: A height (data units).

getDataPoint

(
  • p
)
ia.Point

Converts a point from pixel units to data units.

Parameters:

Returns:

ia.Point: A point (data units).

getDataWidth

(
  • dimension
)
Number

Converts a width from pixel units to data units.

Parameters:

  • dimension Number

    A width (pixel units).

Returns:

Number: A width (data units).

getDataX

(
  • x
)
Number

Converts an x-coord from pixel units to data units.

Parameters:

  • x Number

    An x-coord (pixel units).

Returns:

Number: An x-coord (data units).

getDataY

(
  • y
)
Number

Converts a y-coord from pixel units to data units.

Parameters:

  • y Number

    A y-coord (pixel units).

Returns:

Number: A y-coord (data units).

getLayer

(
  • id
)
ia.LayerBase

Gets the map layer with the given id.

Parameters:

  • id String

    The layer id.

Returns:

ia.LayerBase: The layer, or undefined.

getLayers

() ia.LayerBase[]

Gets the map layers.

Returns:

ia.LayerBase[]: The layers in the map.

getPixelHeight

(
  • y
)
Number

Converts a height from data units to pixel units.

Parameters:

  • y Number

    A height (data units).

Returns:

Number: A height (pixel units).

getPixelPoint

(
  • p
)
ia.Point

Converts a point from data units to pixel units.

Parameters:

Returns:

ia.Point: A point (pixel units).

getPixelRect

(
  • bb
)
ia.Rectangle

Converts a bounding box (data units) to a rectangle (pixel units).

Parameters:

Returns:

ia.Rectangle: A rectangle (pixel units).

getPixelWidth

(
  • x
)
Number

Converts a width from data units to pixel units.

Parameters:

  • x Number

    A width (data units).

Returns:

Number: A width (pixel units).

getPixelX

(
  • x
)
Number

Converts an x-coord from data units to pixel units.

Parameters:

  • x Number

    An x-coord (data units).

Returns:

Number: An x-coord (pixel units).

getPixelY

(
  • y
)
Number

Converts a y-coord from data units to pixel units.

Parameters:

  • y Number

    A y-coord (data units).

Returns:

Number: A y-coord (pixel units).

hide

()

Hides the chart.

mouseCoords

() ia.Point

Returns the cursor position in data units.

Returns:

ia.Point: The cursor position (data units).

removeLayers

()

Removes all layers from the map.

removeListener

(
  • obj
)

Removes all event listeners for the given object.

Parameters:

  • obj Object

    The object.

render

()

Inherited from ia.CanvasBase but overwritten in ia\charts\BoxChart.js:16

Clears and renders the chart.

renderAxes

(
  • xMin
  • xMax
  • yMin
  • yMax
)

Renders the grid and adjusts the bounding box.

Parameters:

  • xMin Number

    The min value along the x axis.

  • xMax Number

    The max value along the x axis.

  • yMin Number

    The min value along the y axis.

  • yMax Number

    The max value along the y axis.

setBBox

(
  • bBox
)

Sets the bounding box.

Parameters:

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

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:122

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

Inherited from ia.CanvasBase but overwritten in ia\charts\CanvasBase.js:130

The canvas context.

datatip

ia.ChartTip

The data tip.

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.

formatter

ia.Formatter

The formatter.

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.