react-light-heatmap
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -306,12 +306,13 @@ import React, { Component } from 'react'; | ||
var _props = this.props, | ||
xLabels = _props.xLabels, | ||
yLabels = _props.yLabels, | ||
background = _props.background, | ||
cellStyle = _props.cellStyle, | ||
data = _props.data, | ||
background = _props.background, | ||
getValue = _props.getValue, | ||
height = _props.height, | ||
xLabelWidth = _props.xLabelWidth, | ||
unit = _props.unit, | ||
onClick = _props.onClick, | ||
squares = _props.squares, | ||
cellStyle = _props.cellStyle; | ||
xLabels = _props.xLabels, | ||
yLabels = _props.yLabels, | ||
xLabelWidth = _props.xLabelWidth, | ||
unit = _props.unit; | ||
var _components = this.components, | ||
@@ -324,7 +325,7 @@ Cell = _components.Cell, | ||
var flatArray = data.reduce(function (i, o) { | ||
var values = data.reduce(function (i, o) { | ||
return [].concat(toConsumableArray(o), toConsumableArray(i)); | ||
}, []); | ||
var max = Math.max.apply(Math, toConsumableArray(flatArray)); | ||
var min = Math.min.apply(Math, toConsumableArray(flatArray)); | ||
}, []).map(getValue); | ||
var max = Math.max.apply(Math, toConsumableArray(values)); | ||
var min = Math.min.apply(Math, toConsumableArray(values)); | ||
return React.createElement( | ||
@@ -419,5 +420,7 @@ 'div', | ||
HeatMap.propTypes = { | ||
components: PropTypes.object, | ||
getValue: PropTypes.func, | ||
xLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])).isRequired, | ||
yLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])).isRequired, | ||
data: PropTypes.arrayOf(PropTypes.array).isRequired, | ||
data: PropTypes.array.isRequired, | ||
background: PropTypes.string, | ||
@@ -441,2 +444,5 @@ height: PropTypes.number, | ||
component: {}, | ||
getValue: function getValue(value) { | ||
return value; | ||
}, | ||
background: '#239a3b', | ||
@@ -443,0 +449,0 @@ height: 30, |
@@ -313,12 +313,13 @@ 'use strict'; | ||
var _props = this.props, | ||
xLabels = _props.xLabels, | ||
yLabels = _props.yLabels, | ||
background = _props.background, | ||
cellStyle = _props.cellStyle, | ||
data = _props.data, | ||
background = _props.background, | ||
getValue = _props.getValue, | ||
height = _props.height, | ||
xLabelWidth = _props.xLabelWidth, | ||
unit = _props.unit, | ||
onClick = _props.onClick, | ||
squares = _props.squares, | ||
cellStyle = _props.cellStyle; | ||
xLabels = _props.xLabels, | ||
yLabels = _props.yLabels, | ||
xLabelWidth = _props.xLabelWidth, | ||
unit = _props.unit; | ||
var _components = this.components, | ||
@@ -331,7 +332,7 @@ Cell = _components.Cell, | ||
var flatArray = data.reduce(function (i, o) { | ||
var values = data.reduce(function (i, o) { | ||
return [].concat(toConsumableArray(o), toConsumableArray(i)); | ||
}, []); | ||
var max = Math.max.apply(Math, toConsumableArray(flatArray)); | ||
var min = Math.min.apply(Math, toConsumableArray(flatArray)); | ||
}, []).map(getValue); | ||
var max = Math.max.apply(Math, toConsumableArray(values)); | ||
var min = Math.min.apply(Math, toConsumableArray(values)); | ||
return React__default.createElement( | ||
@@ -426,5 +427,7 @@ 'div', | ||
HeatMap.propTypes = { | ||
components: PropTypes.object, | ||
getValue: PropTypes.func, | ||
xLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])).isRequired, | ||
yLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])).isRequired, | ||
data: PropTypes.arrayOf(PropTypes.array).isRequired, | ||
data: PropTypes.array.isRequired, | ||
background: PropTypes.string, | ||
@@ -448,2 +451,5 @@ height: PropTypes.number, | ||
component: {}, | ||
getValue: function getValue(value) { | ||
return value; | ||
}, | ||
background: '#239a3b', | ||
@@ -450,0 +456,0 @@ height: 30, |
{ | ||
"name": "react-light-heatmap", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "React component for heatmap grid layout", | ||
@@ -35,3 +35,3 @@ "author": "elv1n", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.5", | ||
"babel-eslint": "^9.0.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
@@ -44,3 +44,3 @@ "babel-preset-env": "^1.7.0", | ||
"enzyme-adapter-react-16": "^1.7.0", | ||
"eslint": "^5.0.1", | ||
"eslint": "5.6.0", | ||
"eslint-config-standard": "^11.0.0", | ||
@@ -57,3 +57,3 @@ "eslint-config-standard-react": "^6.0.0", | ||
"react-dom": "^16.4.1", | ||
"react-scripts": "^1.1.4", | ||
"react-scripts": "^2.1.1", | ||
"rollup": "^0.64.1", | ||
@@ -60,0 +60,0 @@ "rollup-plugin-babel": "^3.0.7", |
# react-heat-map | ||
# react-light-heatmap | ||
[![NPM](https://img.shields.io/npm/v/react-light-heatmap.svg)](https://www.npmjs.com/package/react-light-heatmap) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
@@ -8,2 +7,4 @@ | ||
### [Demo](https://elv1n.github.io/react-light-heatmap/) | ||
![alt tag](https://github.com/elv1n/react-light-heatmap/raw/master/example/public/screenshot.png) | ||
@@ -27,7 +28,8 @@ | ||
**Mandatory fields** | ||
|Name |Type|Sample| | ||
|---|---|---| | ||
|`xLabels`|Array of string|`['1am', '2am', '3am']`| | ||
|`yLabels`|Array of string|`['Sun', 'Mon']`| | ||
|`data`|2D Array of numbers having `yLabels.length` rows and `xLabels.length` rows|`[[2,3,5][5,6,9]]`| | ||
|Name |Type|Sample| | ||
|---|---|---| | ||
|`xLabels`|Array of string|`['1am', '2am', '3am']`| | ||
|`yLabels`|Array of string|`['Sun', 'Mon']`| | ||
|`data`|2D Array of numbers having `yLabels.length` rows and `xLabels.length` rows|`[[2,3,5][5,6,9]]`| | ||
@@ -65,2 +67,3 @@ ```javascript | ||
|cellStyle|function|To set custom cell style. It is useful for using own colour scheme|| | ||
|getValue|function|To get value from provided data|value => value| | ||
@@ -67,0 +70,0 @@ [Example](https://github.com/elv1n/react-light-heatmap/tree/master/example/src/App.js) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64650
790
189