1.5.2 • Published 4 days ago

canvas-heatmap v1.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

Canvas Heatmap

npm version

Interactive heatmap, capable of displaying 1,000,000+ data points using canvas and d3.

Image of Canvas Heatmap

Uses d3 for rendering the axis.

Check out the examples:

Quick start

import heatmap from 'canvas-heatmap';

then

heatmap(div, data, options={});

or

<script type="text/javascript" src="https://unpkg.com/canvas-heatmap"></script>

then

heatmap(div, data, options={});

API reference

div

The unique id of a div. The graph will be appended to this div.

data

Data can be an object {x: [], y:[], z:[[]]} or and array of objects {},{}.

ParameterDescription
x1D array of x coordinates
y1D array of y coordinates
z2D array of z values (z.shape === (y.shape, x.shape))

options

OptionDescriptionDefaultType
titleTitle for the graph (hidden for web display)String
xLabelLabel for the x axisString
yLabelLabel for the y axisString
zLabelLabel for the z axisString
xUnitUnit for the x axisString
yUnitUnit for the y axisString
zUnitUnit for the z axisString
xLogUse log scale for the x axisfalseBoolean
yLogUse log scale for the y axisfalseBoolean
tooltipShow a tooltip on hovertrueBoolean
zMinMinimum value for z color scaleData minNumber
zMaxMaximum value for z color scaleData maxNumber
fontSizeFont size of graph text12Number
contourDraw filled contoursfalseBoolean
yReverseReverse y axisfalseBoolean
xReverseReverse x axisfalseBoolean
marginTopTop margin in px10Number
marginLeftLeft margin in px46Number
marginBottomBottom margin in px46Number
marginRightRight margin in px70Number
legendRightPlot the legendtrueBoolean
thresholdStepNumber of thersholds for when plotting contours20Number
backgroundColorBackground color in htmltransparentString
autoDownsampleDownsample for contour plot500Number
setDownloadGraphAdd png download to functionfalseFunction
setDownloadGraphDivUnique div ID to apply onclick event for png downloadfalseString
hoverReturn the mouse values on hoverfalseFunction
clickReturn the mouse values on clickfalseFunction
widthWidth of the graphdiv widthNumber
heightHeight of the graphdiv heightNumber
colorsColor range for the plot (see below for example)Red -> BlueArray
languageSelect language for time axis. en, de, fr, esenString

Colors

Example of color range:

[
    { color: "#000000", point: 0.0 },
    { color: "#550088", point: 0.14285714285714285 },
    { color: "#0000ff", point: 0.2857142857142857 },
    { color: "#00ffff", point: 0.42857142857142855 },
    { color: "#00ff00", point: 0.5714285714285714 },
    { color: "#ffff00", point: 0.7142857142857143 },
    { color: "#ff8c00", point: 0.8571428571428571 },
    { color: "#ff0000", point: 1.0 },
];
1.5.2

4 days ago

1.5.1

4 days ago

1.4.6

12 days ago

1.5.0

12 days ago

1.4.9

12 days ago

1.4.8

12 days ago

1.4.7

12 days ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.28

2 years ago

1.2.29

2 years ago

1.2.23

2 years ago

1.2.24

2 years ago

1.2.27

2 years ago

1.2.25

2 years ago

1.2.26

2 years ago

1.2.22

3 years ago

1.2.21

3 years ago

1.2.18

3 years ago

1.2.19

3 years ago

1.2.20

3 years ago

1.2.16

3 years ago

1.2.17

3 years ago

1.2.14

3 years ago

1.2.15

3 years ago

1.2.12

3 years ago

1.2.13

3 years ago

1.2.11

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.9

3 years ago

1.2.10

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.1

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago