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

react-plotly.js

Package Overview
Dependencies
Maintainers
11
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-plotly.js

A plotly.js react component from Plotly

  • 2.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
11
Created

What is react-plotly.js?

The react-plotly.js package is a React wrapper for Plotly.js, a popular graphing library. It allows you to create a wide variety of interactive charts and visualizations in a React application.

What are react-plotly.js's main functionalities?

Basic Line Chart

This code demonstrates how to create a basic line chart using react-plotly.js. The chart includes both lines and markers, and it is customized with a title and specific dimensions.

import React from 'react';
import Plot from 'react-plotly.js';

const LineChart = () => (
  <Plot
    data={[
      {
        x: [1, 2, 3, 4],
        y: [10, 15, 13, 17],
        type: 'scatter',
        mode: 'lines+markers',
        marker: {color: 'red'},
      },
    ]}
    layout={{width: 320, height: 240, title: 'A Fancy Plot'}}
  />
);

export default LineChart;

Bar Chart

This code demonstrates how to create a bar chart using react-plotly.js. The chart displays the number of different animals and is customized with a title and specific dimensions.

import React from 'react';
import Plot from 'react-plotly.js';

const BarChart = () => (
  <Plot
    data={[
      {
        x: ['giraffes', 'orangutans', 'monkeys'],
        y: [20, 14, 23],
        type: 'bar',
      },
    ]}
    layout={{width: 320, height: 240, title: 'Bar Chart'}}
  />
);

export default BarChart;

Pie Chart

This code demonstrates how to create a pie chart using react-plotly.js. The chart displays the distribution of different categories and is customized with a title and specific dimensions.

import React from 'react';
import Plot from 'react-plotly.js';

const PieChart = () => (
  <Plot
    data={[
      {
        values: [19, 26, 55],
        labels: ['Residential', 'Non-Residential', 'Utility'],
        type: 'pie',
      },
    ]}
    layout={{width: 320, height: 240, title: 'Pie Chart'}}
  />
);

export default PieChart;

Other packages similar to react-plotly.js

Keywords

FAQs

Package last updated on 07 Sep 2022

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