Skip to main content

heatmap

Heatmap

Reusable Heatmap API module that renders a simple and configurable heatmap chart.

Requires: module:d3-array,
Example

let heatmap = heatmap();

heatmap
.width(500);

d3Selection.select('.css-selector')
.datum(dataset)
.call(heatmap);

exports(_selection, _data) ⏏

This function creates the graph using the selection as container

Kind: Exported function

ParamTypeDescription
_selectionD3SelectionA d3 selection that represents the container(s) where the chart(s) will be rendered
_dataHeatmapDataThe data to attach and generate the chart

exports.animationDuration(_x) ⇒ duration | module

Gets or Sets the duration of the animation

Kind: static method of exports
Returns: duration | module - Current animation duration or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xNumber1200Desired animation duration for the graph

exports.boxSize(_x) ⇒ Number | module

Gets or Sets the boxSize of the chart

Kind: static method of exports
Returns: Number | module - Current boxSize or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xNumber30Desired boxSize for the heatmap boxes

exports.colorSchema(_x) ⇒ Array.<String> | module

Gets or Sets the colorSchema of the chart

Kind: static method of exports
Returns: Array.<String> | module - Current colorSchema or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xArray.<String>britecharts-redDesired colorSchema for the heatma boxes

exports.exportChart(filename, title)

Chart exported to png and a download action is fired

Kind: static method of exports
Access: public

ParamTypeDescription
filenameStringFile title for the resulting picture
titleStringTitle to add at the top of the exported picture

exports.height(_x) ⇒ Number | module

Gets or Sets the height of the chart

Kind: static method of exports
Returns: Number | module - Current height or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xNumber270Desired height for the chart

exports.isAnimated(_x) ⇒ Boolean | module

Gets or Sets the isAnimated value of the chart

Kind: static method of exports
Returns: Boolean | module - Current isAnimated value or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xBooleanfalseDecide whether to show chart animation

exports.margin(_x) ⇒ margin | module

Gets or Sets the margin of the chart

Kind: static method of exports
Returns: margin | module - Current margin or Chart module to chain calls
Access: public

ParamTypeDescription
_xObjectMargin object to get/set

exports.on() ⇒ module

Exposes an 'on' method that acts as a bridge with the event dispatcher We are going to expose this events: customMouseOver, customMouseMove, customMouseOut, and customClick

Kind: static method of exports
Returns: module - Bar Chart
Access: public

exports.yAxisLabels(_x) ⇒ yAxisLabels | module

Gets or Sets the y-axis labels of the chart

Kind: static method of exports
Returns: yAxisLabels | module - Current yAxisLabels array or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xArray.<String>['Mo','Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] An array of string labels across the y-axis

exports.width(_x) ⇒ Number | module

Gets or Sets the width of the chart

Kind: static method of exports
Returns: Number | module - Current width or Chart module to chain calls
Access: public

ParamTypeDefaultDescription
_xNumber780Desired width for the chart

exports~HeatmapData : Array.<Array>

Kind: inner typedef of exports
Properties

NameType
weekNumber
dayNumber
valueNumber

Example

[
{
day: 0,
hour: 0,
value: 7
},
{
day: 0,
hour: 1,
value: 10
}
]