Socket
Socket
Sign inDemoInstall

canvas-heatmap

Package Overview
Dependencies
37
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    canvas-heatmap

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


Version published
Weekly downloads
22
decreased by-8.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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 valuesfalseFunction
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 },
];

Keywords

FAQs

Last updated on 26 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc