1.0.14 • Published 2 years ago

rn-svg-graph v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

RN-SVG-Graph

npm version npm downloads

A customizable and easy-to-use line chart component for React Native using SVG.

Installation

You can install rn-svg-graph using npm:

npm install rn-svg-graph

or using yarn:

yarn add rn-svg-graph

install react-native-svg

npm install react-native-svg

or using yarn:

yarn add react-native-svg

Usage

Here's a simple example of how to use the LineChart component:

import React from 'react';
import { View } from 'react-native';
import LineChart from 'rn-svg-graph';

const data = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
const color = 'blue';

export default function App() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <LineChart
        data={data}
        width={300}
        height={200}
        color={color}
      />
    </View>
  );
}

Props

Here are the props that you can pass to the LineChart component:

PropTypeDefaultDescription
dataArray of numbersrequiredThe data to be plotted on the chart
widthNumberrequiredThe width of the chart
heightNumberrequiredThe height of the chart
colorString"#000000"The color of the chart
xAxisLabelString""The label for the x-axis
yAxisLabelString""The label for the y-axis
titleString""The title of the chart
onPressFunctionnullA function that is called when a data point is pressed
numTicksNumber10The number of ticks to show on the x and y axes
dataPointSizeNumber10The size of the data points on the chart
chartLineWidthNumber2The width of the chart line
xAxisLabelOffsetNumber20The offset of the x-axis label from the chart
yAxisLabelOffsetNumber20The offset of the y-axis label from the chart
titleOffsetNumber10The offset of the title from the chart
gridLineOpacityNumber0.1The opacity of the grid lines
gridLineWidthNumber1The width of the grid lines
1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago