Convert Figma logo to code with AI

indiespirit logoreact-native-chart-kit

πŸ“ŠReact Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)

2,831
655
2,831
416

Top Related Projects

a react native charts wrapper (support android & iOS)

πŸ“ˆ One library to rule all charts for React Native πŸ“Š

victory components for react native

[NOT MAINTAINED] :bar_chart: Add line, area, pie, and bar charts to your React Native app

πŸ“ˆ Beautiful, high-performance Graphs and Charts for React Native built with Skia

Quick Overview

React Native Chart Kit is a library for creating beautiful and customizable charts in React Native applications. It provides a set of pre-built chart components that are easy to integrate and style, making it simple for developers to add data visualization to their mobile apps.

Pros

  • Easy to use with a simple API and pre-built chart components
  • Supports various chart types including line, bar, pie, and progress charts
  • Customizable appearance with options for colors, labels, and animations
  • Compatible with both iOS and Android platforms

Cons

  • Limited advanced chart types compared to some other charting libraries
  • Some users report performance issues with large datasets
  • Documentation could be more comprehensive and up-to-date
  • Occasional bugs and inconsistencies across different React Native versions

Code Examples

  1. Creating a simple line chart:
import { LineChart } from 'react-native-chart-kit';

const data = {
  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
  datasets: [
    {
      data: [20, 45, 28, 80, 99, 43],
    },
  ],
};

<LineChart
  data={data}
  width={350}
  height={220}
  chartConfig={{
    backgroundColor: '#e26a00',
    backgroundGradientFrom: '#fb8c00',
    backgroundGradientTo: '#ffa726',
    decimalPlaces: 2,
    color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
  }}
/>
  1. Creating a pie chart:
import { PieChart } from 'react-native-chart-kit';

const data = [
  {
    name: 'Seoul',
    population: 21500000,
    color: 'rgba(131, 167, 234, 1)',
    legendFontColor: '#7F7F7F',
    legendFontSize: 15,
  },
  {
    name: 'Toronto',
    population: 2800000,
    color: '#F00',
    legendFontColor: '#7F7F7F',
    legendFontSize: 15,
  },
];

<PieChart
  data={data}
  width={350}
  height={220}
  chartConfig={{
    backgroundColor: '#1cc910',
    backgroundGradientFrom: '#eff3ff',
    backgroundGradientTo: '#efefef',
    decimalPlaces: 2,
    color: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`,
  }}
  accessor="population"
  backgroundColor="transparent"
  paddingLeft="15"
/>
  1. Creating a progress chart:
import { ProgressChart } from 'react-native-chart-kit';

const data = {
  labels: ['Swim', 'Bike', 'Run'],
  data: [0.4, 0.6, 0.8],
};

<ProgressChart
  data={data}
  width={350}
  height={220}
  strokeWidth={16}
  radius={32}
  chartConfig={{
    backgroundColor: '#e26a00',
    backgroundGradientFrom: '#fb8c00',
    backgroundGradientTo: '#ffa726',
    decimalPlaces: 2,
    color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
  }}
  hideLegend={false}
/>

Getting Started

  1. Install the package:

    npm install react-native-chart-kit
    
  2. Import and use the desired chart component in your React Native app:

    import { LineChart } from 'react-native-chart-kit';
    
    // ... (component code)
    
    return (
      <LineChart
        data={yourData}
        width={350}
        height={220}
        chartConfig={yourChartConfig}
      />
    );
    
  3. Customize the chart by adjusting the `

Competitor Comparisons

a react native charts wrapper (support android & iOS)

Pros of react-native-charts-wrapper

  • More chart types and customization options
  • Better performance for large datasets
  • Native implementation for both iOS and Android

Cons of react-native-charts-wrapper

  • Steeper learning curve due to more complex API
  • Requires linking native modules, which can be challenging for some developers
  • Less frequent updates and maintenance compared to react-native-chart-kit

Code Comparison

react-native-charts-wrapper:

<LineChart
  data={{
    dataSets: [{
      values: [{y: 1}, {y: 2}, {y: 3}],
      label: 'Dataset 1',
    }],
  }}
  xAxis={{valueFormatter: ['Jan', 'Feb', 'Mar']}}
/>

react-native-chart-kit:

<LineChart
  data={{
    labels: ['Jan', 'Feb', 'Mar'],
    datasets: [{
      data: [1, 2, 3]
    }]
  }}
  width={300}
  height={200}
/>

The code comparison shows that react-native-charts-wrapper requires a more detailed data structure, while react-native-chart-kit has a simpler API. react-native-charts-wrapper provides more control over individual data points and axis formatting, but react-native-chart-kit offers a more straightforward approach for basic charts.

πŸ“ˆ One library to rule all charts for React Native πŸ“Š

Pros of react-native-svg-charts

  • More customizable and flexible, allowing for complex chart designs
  • Better performance due to the use of SVG rendering
  • Supports a wider range of chart types, including XY plots and custom shapes

Cons of react-native-svg-charts

  • Steeper learning curve, especially for developers new to SVG
  • Less out-of-the-box styling options, requiring more manual configuration
  • Smaller community and fewer resources compared to react-native-chart-kit

Code Comparison

react-native-svg-charts:

import { LineChart, Grid } from 'react-native-svg-charts'

<LineChart
    style={{ height: 200 }}
    data={[50, 10, 40, 95, 85]}
    svg={{ stroke: 'rgb(134, 65, 244)' }}
    contentInset={{ top: 20, bottom: 20 }}
>
    <Grid />
</LineChart>

react-native-chart-kit:

import { LineChart } from 'react-native-chart-kit'

<LineChart
    data={{
        labels: ['January', 'February', 'March', 'April', 'May', 'June'],
        datasets: [{
            data: [20, 45, 28, 80, 99, 43]
        }]
    }}
    width={Dimensions.get('window').width}
    height={220}
    chartConfig={{
        backgroundColor: '#e26a00',
        backgroundGradientFrom: '#fb8c00',
        backgroundGradientTo: '#ffa726',
        decimalPlaces: 2,
        color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
        style: {
            borderRadius: 16
        }
    }}
/>

victory components for react native

Pros of victory-native

  • More customizable and flexible, allowing for complex and interactive charts
  • Supports a wider range of chart types, including area charts and candlestick charts
  • Better performance for large datasets and animations

Cons of victory-native

  • Steeper learning curve due to its extensive API and configuration options
  • Larger package size, which may impact app bundle size and load times
  • Less straightforward implementation for simple charts compared to react-native-chart-kit

Code Comparison

victory-native:

import { VictoryBar, VictoryChart, VictoryAxis } from "victory-native";

<VictoryChart>
  <VictoryAxis tickValues={[1, 2, 3, 4]} />
  <VictoryAxis dependentAxis />
  <VictoryBar data={data} x="quarter" y="earnings" />
</VictoryChart>

react-native-chart-kit:

import { BarChart } from "react-native-chart-kit";

<BarChart
  data={data}
  width={screenWidth}
  height={220}
  yAxisLabel="$"
  chartConfig={chartConfig}
/>

victory-native offers more granular control over chart elements, while react-native-chart-kit provides a simpler, more concise implementation for basic charts. The choice between the two depends on the complexity of the charts required and the developer's familiarity with each library's API.

[NOT MAINTAINED] :bar_chart: Add line, area, pie, and bar charts to your React Native app

Pros of react-native-chart

  • More customizable and flexible, allowing for greater control over chart appearance and behavior
  • Supports a wider range of chart types, including radar charts and scatter plots
  • Better performance for large datasets and complex visualizations

Cons of react-native-chart

  • Less actively maintained, with fewer recent updates and contributions
  • Steeper learning curve due to increased complexity and customization options
  • May require more code to implement basic charts compared to react-native-chart-kit

Code Comparison

react-native-chart:

<Chart
  style={styles.chart}
  data={data}
  verticalGridStep={5}
  type="line"
  showDataPoint={true}
  color={['#e74c3c', '#2980b9']}
/>

react-native-chart-kit:

<LineChart
  data={data}
  width={screenWidth}
  height={220}
  chartConfig={{
    backgroundColor: '#e26a00',
    backgroundGradientFrom: '#fb8c00',
    backgroundGradientTo: '#ffa726',
    decimalPlaces: 2,
    color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
  }}
/>

The code comparison shows that react-native-chart offers more concise implementation for basic charts, while react-native-chart-kit provides more built-in styling options out of the box. react-native-chart requires separate styling through a styles object, whereas react-native-chart-kit includes styling within the component props.

πŸ“ˆ Beautiful, high-performance Graphs and Charts for React Native built with Skia

Pros of react-native-graph

  • Highly performant with smooth animations, even for large datasets
  • Customizable appearance with various styling options
  • Supports gestures like pinch-to-zoom and pan

Cons of react-native-graph

  • Limited chart types (primarily line charts)
  • Less comprehensive documentation compared to react-native-chart-kit
  • Newer library with potentially fewer community contributions

Code Comparison

react-native-graph:

<LineGraph
  points={data}
  animated={true}
  color="#ff0000"
  style={{ height: 200, width: '100%' }}
/>

react-native-chart-kit:

<LineChart
  data={data}
  width={Dimensions.get('window').width}
  height={220}
  chartConfig={{
    backgroundColor: '#ffffff',
    backgroundGradientFrom: '#ffffff',
    backgroundGradientTo: '#ffffff',
    color: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`,
  }}
/>

react-native-graph focuses on simplicity and performance for line charts, while react-native-chart-kit offers a wider range of chart types with more configuration options. react-native-graph may be better suited for applications requiring smooth, interactive line charts, while react-native-chart-kit provides a more comprehensive charting solution for various data visualization needs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

If you're looking to build a website or a cross-platform mobile app Ҁ“ we will be happy to help you! Send a note to clients@ui1.io and we will be in touch with you shortly.

Chart Kit

Γ°ΒŸΒ“Β²See example app

To try the examples in Expo, please change main to ./node_modules/expo/AppEntry.js in package.json before starting things with expo run. You'll need to have expo-cli installed via npm install -g expo-cli.

React Native Chart Kit Documentation

Import components

  1. yarn add react-native-chart-kit
  2. yarn add react-native-svg install peer dependencies
  3. Use with ES6 syntax to import components
import {
  LineChart,
  BarChart,
  PieChart,
  ProgressChart,
  ContributionGraph,
  StackedBarChart
} from "react-native-chart-kit";

Quick Example

<View>
  <Text>Bezier Line Chart</Text>
  <LineChart
    data={{
      labels: ["January", "February", "March", "April", "May", "June"],
      datasets: [
        {
          data: [
            Math.random() * 100,
            Math.random() * 100,
            Math.random() * 100,
            Math.random() * 100,
            Math.random() * 100,
            Math.random() * 100
          ]
        }
      ]
    }}
    width={Dimensions.get("window").width} // from react-native
    height={220}
    yAxisLabel="$"
    yAxisSuffix="k"
    yAxisInterval={1} // optional, defaults to 1
    chartConfig={{
      backgroundColor: "#e26a00",
      backgroundGradientFrom: "#fb8c00",
      backgroundGradientTo: "#ffa726",
      decimalPlaces: 2, // optional, defaults to 2dp
      color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
      labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
      style: {
        borderRadius: 16
      },
      propsForDots: {
        r: "6",
        strokeWidth: "2",
        stroke: "#ffa726"
      }
    }}
    bezier
    style={{
      marginVertical: 8,
      borderRadius: 16
    }}
  />
</View>

Chart style object

Define a chart style object with following properies as such:

const chartConfig = {
  backgroundGradientFrom: "#1E2923",
  backgroundGradientFromOpacity: 0,
  backgroundGradientTo: "#08130D",
  backgroundGradientToOpacity: 0.5,
  color: (opacity = 1) => `rgba(26, 255, 146, ${opacity})`,
  strokeWidth: 2, // optional, default 3
  barPercentage: 0.5,
  useShadowColorFromDataset: false // optional
};
PropertyTypeDescription
backgroundGradientFromstringDefines the first color in the linear gradient of a chart's background
backgroundGradientFromOpacityNumberDefines the first color opacity in the linear gradient of a chart's background
backgroundGradientTostringDefines the second color in the linear gradient of a chart's background
backgroundGradientToOpacityNumberDefines the second color opacity in the linear gradient of a chart's background
fillShadowGradientFromstringDefines the first color in the linear gradient of the area under data (can also be specified as fillShadowGradient)
fillShadowGradientFromOpacityNumberDefines the first color opacity in the linear gradient of the area under data (can also be specified as fillShadowGradientOpacity)
fillShadowGradientFromOffsetNumberDefines the first color offset (0-1) in the linear gradient of the area under data
fillShadowGradientTostringDefines the second color in the linear gradient of the area under data
fillShadowGradientToOpacityNumberDefines the second color opacity in the linear gradient of the area under data
fillShadowGradientToOffsetNumberDefines the second color offset (0-1) in the linear gradient of the area under data
useShadowColorFromDatasetBooleanDefines the option to use color from dataset to each chart data. Default is false
colorfunction => stringDefines the base color function that is used to calculate colors of labels and sectors used in a chart
strokeWidthNumberDefines the base stroke width in a chart
barPercentageNumberDefines the percent (0-1) of the available width each bar width in a chart
barRadiusNumberDefines the radius of each bar
propsForBackgroundLinespropsOverride styles of the background lines, refer to react-native-svg's Line documentation
propsForLabelspropsOverride styles of the labels, refer to react-native-svg's Text documentation
propsForVerticalLabelspropsOverride styles of vertical labels, refer to react-native-svg's Text documentation
propsForHorizontalLabelspropsOverride styles of horizontal labels, refer to react-native-svg's Text documentation

Responsive charts

To render a responsive chart, use Dimensions react-native library to get the width of the screen of your device like such

import { Dimensions } from "react-native";
const screenWidth = Dimensions.get("window").width;

Line Chart

Line Chart

const data = {
  labels: ["January", "February", "March", "April", "May", "June"],
  datasets: [
    {
      data: [20, 45, 28, 80, 99, 43],
      color: (opacity = 1) => `rgba(134, 65, 244, ${opacity})`, // optional
      strokeWidth: 2 // optional
    }
  ],
  legend: ["Rainy Days"] // optional
};
<LineChart
  data={data}
  width={screenWidth}
  height={220}
  chartConfig={chartConfig}
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
withDotsbooleanShow dots on the line - default: True
withShadowbooleanShow shadow for line - default: True
withInnerLinesbooleanShow inner dashed lines - default: True
withOuterLinesbooleanShow outer dashed lines - default: True
withVerticalLinesbooleanShow vertical lines - default: True
withHorizontalLinesbooleanShow horizontal lines - default: True
withVerticalLabelsbooleanShow vertical labels - default: True
withHorizontalLabelsbooleanShow horizontal labels - default: True
fromZerobooleanRender charts from 0 not from the minimum value. - default: False
yAxisLabelstringPrepend text to horizontal labels -- default: ''
yAxisSuffixstringAppend text to horizontal labels -- default: ''
xAxisLabelstringPrepend text to vertical labels -- default: ''
yAxisIntervalstringDisplay y axis line every {x} input. -- default: 1
chartConfigObjectConfiguration object for the chart, see example config object above
decoratorFunctionThis function takes a whole bunch of stuff and can render extra elements, such as data point info or additional markup.
onDataPointClickFunctionCallback that takes {value, dataset, getColor}
horizontalLabelRotationnumber (degree)Rotation angle of the horizontal labels - default 0
verticalLabelRotationnumber (degree)Rotation angle of the vertical labels - default 0
getDotColorfunction => stringDefines the dot color function that is used to calculate colors of dots in a line chart and takes (dataPoint, dataPointIndex)
renderDotContentFunctionRender additional content for the dot. Takes ({x, y, index, indexData}) as arguments.
yLabelsOffsetnumberOffset for Y axis labels
xLabelsOffsetnumberOffset for X axis labels
hidePointsAtIndexnumber[]Indices of the data points you don't want to display
formatYLabelFunctionThis function change the format of the display value of the Y label. Takes the Y value as argument and should return the desirable string.
formatXLabelFunctionThis function change the format of the display value of the X label. Takes the X value as argument and should return the desirable string.
getDotProps(value, index) => propsThis is an alternative to chartConfig's propsForDots
segmentsnumberThe amount of horizontal lines - default 4

Bezier Line Chart

Line Chart

<LineChart
  data={data}
  width={screenWidth}
  height={256}
  verticalLabelRotation={30}
  chartConfig={chartConfig}
  bezier
/>
PropertyTypeDescription
bezierbooleanAdd this prop to make the line chart smooth and curvy

Progress Ring

Progress Chart

// each value represents a goal ring in Progress chart
const data = {
  labels: ["Swim", "Bike", "Run"], // optional
  data: [0.4, 0.6, 0.8]
};
<ProgressChart
  data={data}
  width={screenWidth}
  height={220}
  strokeWidth={16}
  radius={32}
  chartConfig={chartConfig}
  hideLegend={false}
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
strokeWidthNumberWidth of the stroke of the chart - default: 16
radiusNumberInner radius of the chart - default: 32
chartConfigObjectConfiguration object for the chart, see example config in the beginning of this file
hideLegendBooleanSwitch to hide chart legend (defaults to false)

Bar chart

Bat Chart

const data = {
  labels: ["January", "February", "March", "April", "May", "June"],
  datasets: [
    {
      data: [20, 45, 28, 80, 99, 43]
    }
  ]
};
<BarChart
  style={graphStyle}
  data={data}
  width={screenWidth}
  height={220}
  yAxisLabel="$"
  chartConfig={chartConfig}
  verticalLabelRotation={30}
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
withVerticalLabelsbooleanShow vertical labels - default: True
withHorizontalLabelsbooleanShow horizontal labels - default: True
fromZerobooleanRender charts from 0 not from the minimum value. - default: False
withInnerLinesbooleanShow inner dashed lines - default: True
yAxisLabelstringPrepend text to horizontal labels -- default: ''
yAxisSuffixstringAppend text to horizontal labels -- default: ''
chartConfigObjectConfiguration object for the chart, see example config in the beginning of this file
horizontalLabelRotationnumber (degree)Rotation angle of the horizontal labels - default 0
verticalLabelRotationnumber (degree)Rotation angle of the vertical labels - default 0
showBarTopsbooleanShow bar tops
showValuesOnTopOfBarsbooleanShow value above bars

StackedBar chart

StackedBar_Chart

const data = {
  labels: ["Test1", "Test2"],
  legend: ["L1", "L2", "L3"],
  data: [
    [60, 60, 60],
    [30, 30, 60]
  ],
  barColors: ["#dfe4ea", "#ced6e0", "#a4b0be"]
};
<StackedBarChart
  style={graphStyle}
  data={data}
  width={screenWidth}
  height={220}
  chartConfig={chartConfig}
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
withVerticalLabelsbooleanShow vertical labels - default: True
withHorizontalLabelsbooleanShow horizontal labels - default: True
chartConfigObjectConfiguration object for the chart, see example config in the beginning of this file
barPercentageNumberDefines the percent (0-1) of the available width each bar width in a chart
showLegendbooleanShow legend - default: True

Pie chart

Pie Chart

Modified Pie Chart Screenshot

Pie Chart_modified

const data = [
  {
    name: "Seoul",
    population: 21500000,
    color: "rgba(131, 167, 234, 1)",
    legendFontColor: "#7F7F7F",
    legendFontSize: 15
  },
  {
    name: "Toronto",
    population: 2800000,
    color: "#F00",
    legendFontColor: "#7F7F7F",
    legendFontSize: 15
  },
  {
    name: "Beijing",
    population: 527612,
    color: "red",
    legendFontColor: "#7F7F7F",
    legendFontSize: 15
  },
  {
    name: "New York",
    population: 8538000,
    color: "#ffffff",
    legendFontColor: "#7F7F7F",
    legendFontSize: 15
  },
  {
    name: "Moscow",
    population: 11920000,
    color: "rgb(0, 0, 255)",
    legendFontColor: "#7F7F7F",
    legendFontSize: 15
  }
];
<PieChart
  data={data}
  width={screenWidth}
  height={220}
  chartConfig={chartConfig}
  accessor={"population"}
  backgroundColor={"transparent"}
  paddingLeft={"15"}
  center={[10, 50]}
  absolute
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
chartConfigObjectConfiguration object for the chart, see example config in the beginning of this file
accessorstringProperty in the data object from which the number values are taken
bgColorstringbackground color - if you want to set transparent, input transparent or none.
paddingLeftstringleft padding of the pie chart
centerarrayoffset x and y coordinates to position the chart
absolutebooleanshows the values as absolute numbers
hasLegendbooleanDefaults to true, set it to false to remove the legend
avoidFalseZerobooleanDefaults to false, set it to true to display a "<1%" instead of a rounded value equal to "0%"

Contribution graph (heatmap)

Contribution Graph

This type of graph is often use to display a developer contribution activity. However, there many other use cases this graph is used when you need to visualize a frequency of a certain event over time.

const commitsData = [
  { date: "2017-01-02", count: 1 },
  { date: "2017-01-03", count: 2 },
  { date: "2017-01-04", count: 3 },
  { date: "2017-01-05", count: 4 },
  { date: "2017-01-06", count: 5 },
  { date: "2017-01-30", count: 2 },
  { date: "2017-01-31", count: 3 },
  { date: "2017-03-01", count: 2 },
  { date: "2017-04-02", count: 4 },
  { date: "2017-03-05", count: 2 },
  { date: "2017-02-30", count: 4 }
];
<ContributionGraph
  values={commitsData}
  endDate={new Date("2017-04-01")}
  numDays={105}
  width={screenWidth}
  height={220}
  chartConfig={chartConfig}
/>
PropertyTypeDescription
dataObjectData for the chart - see example above
widthNumberWidth of the chart, use 'Dimensions' library to get the width of your screen for responsive
heightNumberHeight of the chart
gutterSizeNumberSize of the gutters between the squares in the chart
squareSizeNumberSize of the squares in the chart
horizontalbooleanShould graph be laid out horizontally? Defaults to true
showMonthLabelsbooleanShould graph include labels for the months? Defaults to true
showOutOfRangeDaysbooleanShould graph be filled with squares, including days outside the range? Defaults to false
chartConfigObjectConfiguration object for the chart, see example config in the beginning of this file
accessorstringProperty in the data object from which the number values are taken; defaults to count
getMonthLabelfunctionFunction which returns the label for each month, taking month index (0 - 11) as argument
onDayPressfunctionCallback invoked when the user clicks a day square on the chart; takes a value-item object

More styling

Every charts also accepts style props, which will be applied to parent svg or View component of each chart.

Abstract Chart

src/abstract-chart.js is an extendable class which can be used to create your own charts!

The following methods are available:

renderHorizontalLines(config)

Renders background horizontal lines like in the Line Chart and Bar Chart. Takes a config object with following properties:

{
  // width of your chart
  width: Number,
  // height of your chart
  height: Number,
  // how many lines to render
  count: Number,
  // top padding from the chart top edge
  paddingTop: Number
}

renderVerticalLabels(config)

Render background vertical lines. Takes a config object with following properties:

{
  // data needed to calculate the number of lines to render
  data: Array,
  // width of your chart
  width: Number,
  // height of your chart
  height: Number,
  paddingTop: Number,
  paddingRight: Number
}

renderDefs(config)

Render definitions of background and shadow gradients

{
  // width of your chart
  width: Number,
  // height of your chart
  height: Number,
  // first color of background gradient
  backgroundGradientFrom: String,
  // first color opacity of background gradient (0 - 1.0)
  backgroundGradientFromOpacity: Number,
  // second color of background gradient
  backgroundGradientTo: String,
  // second color opacity of background gradient (0 - 1.0)
  backgroundGradientToOpacity: Number,
}

Compilation

For production use, the package is automatically compiled after installation, so that you can just install it with npm and use it out-of-the-box.

To transpile TypeScript into JavaScript for development purposes, you can use either run npm run build to compile once, or npm run dev to start compilation in watch mode, which will recompile the files on change.

More information

This library is built on top of the following open-source projects:

Contribute

See the contribution guide and join the contributors!

NPM DownloadsLast 30 Days