Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-range-chart

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-range-chart

A slider chart component for React Native, enabling interactive range selection with a visually appealing chart interface

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
0
Weekly downloads
 
Created
Source

react-native-range-chart

Description

react-native-range-chart is a versatile and customizable range slider component for React Native, which includes a range slider with one or two handles and an integrated column chart. The column heights represent the frequency of occurrences, making it easy to visualize data distribution within a defined range.

App Screenshot App Screenshot App Screenshot

Installation

To install the package, run:

npm i react-native-range-chart

Usage

Here’s a basic example of how to use the RangeChart component:

import RangeChart from 'react-native-range-chart';

const YourComponent = () => {
  const dataArray = [
    { value: 10, count: 2 },
    { value: 15, count: 5 },
    { value: 20, count: 3 },
    // More data points
  ];

  const handleRangeChange = (newRange) => {
    console.log('Selected Range:', newRange);
  };

  return (
    <RangeChart
      dataArray={dataArray}
      minRange={0}
      maxRange={30}
      maxHeight={200}
      containerWidth={350}
      compareWith="value"
      initialValues=[30,70]
      onRangeChange={handleRangeChange}
    />
  );
};

For a single-handle slider, set initialValues as e.g. [5]. For a double-handle slider, set initialValues as [4,7].

Props

PropTypeDescription
dataArrayArrayArray of objects with data points, each containing a value to display on the chart and an occurrence count.
minRangeNumberMinimum value for the range slider.
maxRangeNumberMaximum value for the range slider.
maxHeightNumberMaximum height for the column chart, adjusting based on occurrence frequency.
containerWidthNumberWidth of the chart container.
compareWithStringKey in the data array to compare values with.
initialValuesArrayInitial values for the range slider; specify [5] for one handle, [5,10] for two handles.
onRangeChangeFunctionCallback function that returns the selected range.
activeChartColorStringColor used for active chart elements. default is #23527C
inactiveChartColorStringColor used for inactive chart elements. default is #BFBFBF
sliderHandleBackgroundColorStringBackground color of the slider handle. default is #22527C
sliderHandleTextColorStringText color on the slider handle. default is white
activeBarColorStringColor used for the active state of the bar. default is #22527C
inActiveBarColorStringColor used for the inactive state of the bar. default is #A7A7A7

License

This project is licensed under the MIT License.

Contact

For more information, please reach out to the developer at usman.khalid444@gmail.com

Keywords

FAQs

Package last updated on 01 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc