Module implementing a heat map. A heat map displays a density of a variable in two dimensional space.
Requires: d3@v4du.Widget
HeatMap
du.widgets.heatmap.HeatMap(name[, parent])
The heat map widget class.
arg
type
description
name
string
Identifier of the widget.
parent
object
Parent element to append widget to. If not specified, widget is appended to body. optional
grid
du.widgets.heatmap.HeatMap.grid(size)
Sets the grid size to compute heat map on. Default is [40, 40].
arg
type
description
size
number[]
Array of numbers containing the horizontal and vertical size of the grid..
return
description
du.widgets.heatmap.HeatMap
Reference to the current HeatMap.
smooth
du.widgets.heatmap.HeatMap.smooth(on)
Enables smoothing (i.e., anti-aliasing) between cells. Default is false.
arg
type
description
on
boolean
Whether to turn on smoothing.
return
description
du.widgets.heatmap.HeatMap
Reference to the current HeatMap.
background
du.widgets.heatmap.HeatMap.background(options)
Adds an image to the background of the heat map. Note that the image is scaled up to fit the heat map. Default is empty.
arg
type
description
options
Object
Object containing the background options. The following properties are supported:
path: Path to the image file.
opacity: Background opacity. Default is 1.
return
description
du.widgets.heatmap.HeatMap
Reference to the current HeatMap.
opacity
du.widgets.heatmap.HeatMap.opacity(level)
Sets the opacity of the heat map. Useful when background image is used. Default is 1.
arg
type
description
level
number
Opacity level to set.
return
description
du.widgets.heatmap.HeatMap
Reference to the current HeatMap.
zScale
du.widgets.heatmap.HeatMap.zScale(scale)
Sets the scale for the density color map. Default is the identity function.
arg
type
description
scale
function
Scale function to apply for the color mapping. Must map the interval [0, 1] to [0, 1].
return
description
du.widgets.heatmap.HeatMap
Reference to the current HeatMap.
data
du.widgets.heatmap.HeatMap.data(data)
Binds data to the heat map. Expected data format: array of objects containing the x, y coordinates of the data points and a value denoting the weight of the data point. If value is missing, it is assumed to be 1.