# highcharts-react-native **Repository Path**: mirrors_HubSpot/highcharts-react-native ## Basic Information - **Project Name**: highcharts-react-native - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-24 - **Last Updated**: 2026-03-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Deprecation disclaimer *This project is no longer actively maintained* As of 01.01.2021, The React Native wrapper is no longer maintained by Highsoft. The repository will remain available, but we can not guarantee that it will work as intended with future releases of both React Native itself, or Highcharts. # Highcharts React Native Official minimal [Highcharts](https://www.highcharts.com/) wrapper for React Native. ## Table of Contents 1. [Getting started](#getting-started) 1. [General prerequisites](#general-prerequisites) 2. [Installing](#installing) 3. [Updating Highcharts package](#updating-highcharts=package) 4. [Usage](#usage) 1. [Basic usage example](#basic-usage-example) 2. [Highcharts chart](#highchart-chart) 3. [Highcharts live data update](#highcharts-live-data-update) 4. [Highcharts advanced series](#highcharts-advanced-series) 5. [Optimal way to update](#optimal-way-to-update) 2. [Options details](#options-details) 1. [options](#options) 2. [styles](#styles) 3. [modules](#modules) 4. [callback](#callback) 5. [useSSL](#useSSL) 6. [useCDN](#useCDN) 7. [data](#data) 8. [onMessage](#onMessage) 9. [loader](#loader) 10. [webviewStyles](#webviewStyles) 11. [setOptions](#setOptions) 12. [devPort](#devPort) 3. [Get repository](#get-repository) 4. [FAQ](#faq) 1. [Where to look for help?](#where-to-look-for-help) 2. [Files are not loaded](#files-are-not-loaded) 3. [Error loading page](#error-loading-page) 5. [Changelog](#changelog) ## Getting Started ### General prerequisites Make sure you have **Node.JS**, **NPM** and **React** up to date. Tested and required versions: * node 11.2+ * npm 6.7.0+ or similar package manager Packages which should be installed within your project: * React `>=16.4+` * React Native `>=0.63.2` * React Native Webview `>=10.6.0` ***If you're using this package with Expo Tools, please make sure your `Expo SDK` version is higher than or equal to `v38.0.0`, otherwise use the `v2.2.3` version of this package, which should work from `v33.0.0`.*** ***In bare React Native application you need to also install the `react-native-unimodules` package, and configure the content of `ios` and `android` build directiories like it's described [here](https://docs.expo.io/bare/installing-unimodules/#installation).*** ### Installing Get package from NPM in your React app: ```bash npm install @highcharts/highcharts-react-native ``` You can either install this wrapper within app based on [Expo tools](https://expo.io/learn), or bare [React Native](https://facebook.github.io/react-native/docs/getting-started) app. It is required to add the `.hcscript` into the asset extensions section of `metro.config.js` file, or create that file within your project, and configure it like below: ```js const {getDefaultConfig} = require('metro-config'); module.exports = (async () => { const { resolver: { sourceExts, assetExts } } = await getDefaultConfig() return { transformer: { getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, inlineRequires: false } }) }, resolver: { sourceExts, assetExts: [...assetExts, 'hcscript'] } } })() ``` ### Updating Highcharts package Since this package has been deprecated, we decided to meet our users' needs and created the `update-highcharts` script, which will get the latest Highcharts release and replace source files used by this wrapper, and let the community keep developing the `highcharts-react-native` package. In order to run the update process, please run the following commands in this package directory: ```bash npm i ``` and then ```bash npm run update-highcharts ``` ### Usage #### Basic usage example Import this package into your React Native project and render the chart: #### Highcharts chart ```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import HighchartsReactNative from '@highcharts/highcharts-react-native' export default class App extends React.Component { constructor(props) { super(props); this.state = { chartOptions: { series: [{ data: [1, 2, 3] }] } }; } render() { return ( ); } } const styles = StyleSheet.create({ container: { backgroundColor: '#fff', justifyContent: 'center', flex: 1 } }); ``` ### Highcharts live data update ```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import HighchartsReactNative from '@highcharts/highcharts-react-native' export default class App extends React.Component { constructor(props) { super(props); this.state = { chartOptions: { chart: { events: { load: function () { // set up the updating of the chart each second var series = this.series[0]; setInterval(function () { var y = Math.random(); series.addPoint(y, true, true); }, 1000); } } }, series: [{ data: [1, 2, 3] }] } }; } render() { return ( ); } } const styles = StyleSheet.create({ container: { backgroundColor: '#fff', justifyContent: 'center', flex: 1 } }); ``` ### Using Highcharts modules e.g solid-gauge, drilldown, or exporting ```jsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import HighchartsReactNative from '@highcharts/highcharts-react-native' const modules = [ 'solid-gauge' ]; export default class App extends React.Component { constructor(props) { super(props); this.state = { chartOptions: { chart: { type: 'solidgauge' }, series: [{ data: [1] }] } }; } render() { return ( ); } } const styles = StyleSheet.create({ container: { backgroundColor: '#fff', justifyContent: 'center', flex: 1 } }); ``` ### Optimal way to update A good practice is to keep all chart options in the state. When `setState` is called, the options are overwritten and only the new ones are passed to the `chart.update` method. ```jsx import React from 'react'; import { StyleSheet, View, Button } from 'react-native'; import HighchartsReactNative from '@highcharts/highcharts-react-native' export default class App extends React.Component { constructor(props) { super(props); this.state = { chartOptions: { title: { text: 'Default title' }, tooltip: { formatter: function () { return 'Point Y: ' + this.y; } }, series: [{ data: [1, 3, 2] }] } }; } chartUpdate() { this.setState({ chartOptions: { title: { text: 'Updated chart' }, tooltip: { formatter: function () { return 'Point value: ' + this.y; } } } }); } render() { return (