项目作者: Windows87

项目描述 :
Heatmap Chart Component NPM Module to React Native.
高级语言: Java
项目地址: git://github.com/Windows87/react-native-heatmap-chart.git
创建时间: 2020-09-30T17:41:05Z
项目社区:https://github.com/Windows87/react-native-heatmap-chart

开源协议:Apache License 2.0

下载


react-native-heatmap-chart


npm version
npm version

Getting started

$ npm install react-native-heatmap-chart --save

Example

  1. cd example
  2. npm install
  3. react-native run-android

Click Here

Basic Usage

  1. import React from 'react';
  2. import { View, ScrollView } from 'react-native';
  3. import HeatMap from 'react-native-heatmap-chart';
  4. const App = () => {
  5. const click = item => {
  6. console.log(`Value: ${item.value}`);
  7. console.log(`Index: ${item.index}`);
  8. };
  9. return (
  10. <ScrollView>
  11. <HeatMap values={[0, 4, 6, 1, 7, 3, 0, 8, 6, 2, 0, 10, 20, 12, 0, 0, 10, 0, 17, 8, 0, 6, 0, 6, 10, 23]} onBlockPress={click} ></HeatMap>
  12. </ScrollView>
  13. );
  14. };
  15. export default App;

Properties

Prop Default Type Description
numberOfLines 7 number Number of Horizontal Lines.
values [] array Your number values.
maximumValue "relative" string The maximum value of the heatmap. You can select a number (float or integer) or the string “relative” (default). The relative maximum value will use your own values array to find the maximum value.
colors ['#ebedf0', '#9be9a8', '#30a14e', '#216e39'] array Colors of HeatMap.
colorsPercentage [0, 0.000001, 41, 60, 80] array Example: When your value is 60% of maximum, the color will be the index 3 of colors array, 40% will be 2 index, etc. The length of array need to be the same of colors array.
blocksSize 30 number Size of heatmap blocks (width and height).
indexStart 0 number Start of values index.
onBlockPress () => {} func On block press. Return an object with properties { value, index }
blocksStyles {} object Style of blocks.

Contribution

@Windows87 - Main author