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

highcharts-react-official

Package Overview
Dependencies
Maintainers
5
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highcharts-react-official

Official minimal [Highcharts](https://www.highcharts.com/) wrapper for React.

  • 3.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created

What is highcharts-react-official?

The highcharts-react-official package is a React wrapper for Highcharts, a popular JavaScript charting library. It allows you to create interactive and responsive charts in your React applications with ease.

What are highcharts-react-official's main functionalities?

Basic Chart

This code demonstrates how to create a basic chart using the highcharts-react-official package. It sets up a simple line chart with a title and a series of data points.

import React from 'react';
import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';

const options = {
  title: {
    text: 'My chart'
  },
  series: [{
    data: [1, 2, 3, 4, 5]
  }]
};

const BasicChart = () => (
  <HighchartsReact
    highcharts={Highcharts}
    options={options}
  />
);

export default BasicChart;

Updating Chart Data

This example shows how to update the chart data dynamically. The chart data is stored in a state variable, and a button is provided to update the data, which in turn updates the chart.

import React, { useState } from 'react';
import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';

const DynamicChart = () => {
  const [data, setData] = useState([1, 2, 3, 4, 5]);

  const options = {
    title: {
      text: 'Dynamic Data Chart'
    },
    series: [{
      data: data
    }]
  };

  const updateData = () => {
    setData(data.map(d => d + 1));
  };

  return (
    <div>
      <HighchartsReact
        highcharts={Highcharts}
        options={options}
      />
      <button onClick={updateData}>Update Data</button>
    </div>
  );
};

export default DynamicChart;

Custom Chart Types

This code demonstrates how to create a custom chart type, specifically a bubble chart, using the highcharts-react-official package. It includes the HighchartsMore module to enable additional chart types.

import React from 'react';
import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';
import HighchartsMore from 'highcharts/highcharts-more';

HighchartsMore(Highcharts);

const options = {
  chart: {
    type: 'bubble'
  },
  title: {
    text: 'Bubble Chart'
  },
  series: [{
    data: [
      [9, 81, 63],
      [98, 5, 89],
      [51, 50, 73],
      [41, 22, 14],
      [58, 24, 20],
      [78, 37, 34],
      [55, 56, 53],
      [18, 45, 70],
      [42, 44, 28],
      [3, 52, 59],
      [31, 18, 97],
      [79, 91, 63],
      [93, 23, 23],
      [44, 83, 22]
    ]
  }]
};

const BubbleChart = () => (
  <HighchartsReact
    highcharts={Highcharts}
    options={options}
  />
);

export default BubbleChart;

Other packages similar to highcharts-react-official

Keywords

FAQs

Package last updated on 04 Sep 2023

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