1.7.5 • Published 6 months ago

@baykan/react-native-linechart-native v1.7.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

React Native Line Chart

🚀 Features

⚡ Performance-Oriented(Fast Line Chart for React Native)

  • High-speed rendering: Charts are rendered natively with immediate response.
  • High FPS animations: Smooth animations running at 60 FPS and above.
  • Low CPU/GPU usage: Rendering is offloaded to native modules optimized for performance.
  • Compatible with React Native Fabric: Uses the new architecture for low-latency communication between JS and native layers.
  • Fully native chart code: All chart logic and rendering are compiled natively (Android/iOS), not JavaScript.

🟡 User Experience & Interaction(React Native Chart Component)

  • 🟡 Smooth gesture support: Fast, fluid interactions like pan and tap with no lag.
  • 🟡 Seamless transition effects: Animated transitions deliver a polished, professional feel.
  • 🟡 Modern API design: Simple and flexible for developers to use.
  • 🟡 Scalable performance: Handles large datasets without stuttering.

Requirements Only react-native supports the new architecture

Install Below is the command to install the package

yarn add @baykan/react-native-linechart-native

Only for Ios:

 pod install

Example Screenshots

iOS ExampleAndroid Example

Example Usage

import { SafeAreaView, StyleSheet, View } from 'react-native';
import { LineChartNativeComponent } from '@baykan/react-native-linechart-native';

function App(): JSX.Element {
  const count = 25;
  const range = 60;

  const values = Array.from({ length: count }, (_, i) => {
    const val = Math.floor(Math.random() * range) + 3;
    return { x: i, y: val };
  });

  const lineData = {
    dataSets: [
      {
        values: values,
        drawVerticalHighlightIndicatorEnabled: true,
        drawValuesEnabled: false,
        mode: 'linear',
        drawHorizontalHighlightIndicatorEnabled: false,
        gradientColorsData: { from: '#ffffff', to: '#080707' },
        label: 'Chart1',
        limitLineEntity: {
          lineWidth: 3.0,
          lineColor: '#d6371e',
          lineDashLengths: [5, 2],
          labelPosition: 'leftTop',
          labelValueColor: '#d6371e',
          fontSize: 15,
          limit: 12,
        },
      },
    ],
  };

  return (
    <SafeAreaView style={styles.container}>
      <View
        style={{
          flex: 1,
          height: 550,
          justifyContent: 'center',
          alignItems: 'center',
        }}
      >
        <LineChartNativeComponent
          data={lineData}
          markerEntity={{
            color: '#161617',
            fontSize: 17,
            bgColor: '#ffffff',
            circleEntity: { size: 13, color: '#1e498f' },
            position: { left: 8, top: 0, bottom: 0, right: 8 },
          }}
          xAxisEntity={{
            drawLabelsEnabled: true,
            labelPosition: 'bottom',
            labelFont: { size: 15, weight: 'bold' },
            labelTextColor: '#080707',
            yOffset: 10,
            xOffset: 0,
          }}
          yAxisEntity={{
            drawLabelsEnabled: true,
            labelPosition: 'outside',
            labelFont: { size: 15, weight: 'bold' },
            labelTextColor: '#080707',
            xOffset: 0,
            yOffset: 0,
            axisMin: 0,
            axisMax: 120,
          }}
          animationEntity={{
            xAxisDuration: 0.8,
            xAxisEasing: 'linear',
            yAxisDuration: 1,
            yAxisEasing: 'linear',
          }}
          highlightPerDragEnabled={true}
          highlightPerTapEnabled={true}
          drawGridLinesEnabled={true}
          dragEnabled={true}
          style={{ width: '100%', height: 500, margin: 16 }}
        />
      </View>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f4f6f8',
  },
});
export default App;

Props

PropertyTypeDescription
dataLineDataThe name of the props variable that will show the data of the chart.
dragEnabledbooleanActivates/passivates the movement of the highlights gradient of a chart's background.
bgColorstringDefines the background color of the chart. use hex code !
animationEntityAnimationEntityProvides effective loading of the chart with animation.
drawGridLinesEnabledbooleanProvides visibility of lines on the x-axis of the chart.
markerEntityMarkerEntityShows the y-point values of the chart moving above the highlighter.
xAxisEntityXAxisEntityDefines x-axis label properties and formatting.
yAxisEntityYAxisEntityDefines y-axis label properties and formatting.
highlightPerTapEnabledbooleanIf set to true, when the user touches a data point, it will be highlighted.
highlightPerDragEnabledbooleanAllows dragging to highlight data points.
circleEntityCircleEntityTogether with the highlighter, it makes the round circle appear.
dataSetsobject[]Each index in dataSets represents a line, which can be customized with these properties.
limitLineEntityobjectDefines limit line properties, including width, color, and label settings.

Type Definitions

AnimationEntity

{
  xAxisDuration: number;
  yAxisDuration: number;
  xAxisEasing: string;
  yAxisEasing: string;
}

MarkerEntity

{
  bgColor: string;
  color: string;( use hex code string type)
  fontSize: number;
  position: {
    left: number;
    top: number;
    bottom: number;
    right: number;
  };
  circleEntity?: CircleEntity;
}

XAxisEntity

{
  drawLabelsEnabled: boolean;
  labelPosition: string;
  labelFont?: LabelFont;
  labelTextColor?: string;
  yOffset?: number;
  xOffset?: number;
  axisMin?: number;
  axisMax?: number;
}

YAxisEntity

{
  drawLabelsEnabled: boolean;
  labelPosition: string;
  labelFont?: LabelFont;
  labelTextColor?: string;( use hex code)
  xOffset?: number;
  yOffset?: number;
  axisMin?: number;
  axisMax?: number;
}

CircleEntity

{
  size: number;
  color: string;( use hex code)
}

dataSets

{
  values: DataSetEntry[];
  limitLineEntity: LimitLineEntity;
  label: string;
  gradientColorsData: { from: string; to: string };
  drawVerticalHighlightIndicatorEnabled: boolean;
  drawHorizontalHighlightIndicatorEnabled: boolean;
  drawValuesEnabled: boolean;
  mode: Mode;
}

LimitLineEntity

{
  lineWidth: number;
  lineColor: string;
  lineDashLengths: number[];
  labelPosition: string;
  fontSize: number;
  limit?: number;
  label?: string;
  labelValueColor?: string;
}

Line Chart Type (Mode prop)

mode: 'cubicBezier' | 'stepped' | 'linear' | 'horizontalBezier';

Line Chart Type xAxisEasing,yAxisEasing

ChartEasingOptionProps: {
  Linear = 'linear',
  EaseInQuad = 'easeInQuad',
  EaseOutQuad = 'easeOutQuad',
  EaseInOutQuad = 'easeInOutQuad',
  EaseInCubic = 'easeInCubic',
  EaseOutCubic = 'easeOutCubic',
  EaseInOutCubic = 'easeInOutCubic',
  EaseInQuart = 'easeInQuart',
  EaseOutQuart = 'easeOutQuart',
  EaseInOutQuart = 'easeInOutQuart',
  EaseInQuint = 'easeInQuint',
  EaseOutQuint = 'easeOutQuint',
  EaseInOutQuint = 'easeInOutQuint',
  EaseInSine = 'easeInSine',
  EaseOutSine = 'easeOutSine',
  EaseInOutSine = 'easeInOutSine',
  EaseInExpo = 'easeInExpo',
  EaseOutExpo = 'easeOutExpo',
  EaseInOutExpo = 'easeInOutExpo',
  EaseInCirc = 'easeInCirc',
  EaseOutCirc = 'easeOutCirc',
  EaseInOutCirc = 'easeInOutCirc',
  EaseInElastic = 'easeInElastic',
  EaseOutElastic = 'easeOutElastic',
  EaseInOutElastic = 'easeInOutElastic',
  EaseInBack = 'easeInBack',
  EaseOutBack = 'easeOutBack',
  EaseInOutBack = 'easeInOutBack',
  EaseInBounce = 'easeInBounce',
  EaseOutBounce = 'easeOutBounce',
  EaseInOutBounce = 'easeInOutBounce',
}

CoupleLineChart

1.7.5

6 months ago

1.7.4

6 months ago

1.7.3

6 months ago

1.7.2

6 months ago

1.7.1

6 months ago

1.7.0

6 months ago

1.6.8

6 months ago

1.6.7

6 months ago

1.6.6

6 months ago

1.6.5

6 months ago

1.6.4

6 months ago

1.6.3

6 months ago

1.6.2

6 months ago

1.6.1

6 months ago

1.6.0

6 months ago

1.5.9

6 months ago

1.5.8

6 months ago

1.5.7

6 months ago

1.5.6

6 months ago

1.5.5

6 months ago

1.5.4

6 months ago

1.5.3

6 months ago

1.5.2

6 months ago

1.5.1

6 months ago

1.5.0

6 months ago

1.4.9

6 months ago

1.4.8

6 months ago

1.4.7

6 months ago

1.4.6

6 months ago

1.4.5

6 months ago

1.4.4

6 months ago

1.4.3

6 months ago

1.4.2

6 months ago

1.4.1

6 months ago

1.4.0

6 months ago

1.3.9

6 months ago

1.3.8

6 months ago

1.3.7

6 months ago

1.3.6

6 months ago

1.3.5

6 months ago

1.3.4

6 months ago

1.3.3

6 months ago

1.3.2

6 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.9

6 months ago

1.2.8

6 months ago

1.2.7

7 months ago

1.2.6

7 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago