Git Product home page Git Product logo

react-highcharts's Introduction

react-highcharts

Build Status

Highcharts component for react.

Demo

You can find the full code for the examples here

To run the demo:

  1. Clone the repo
  2. run:
    npm install
    npm run demo
    
  3. Point your browser at http://localhost:8080

Installation

If you are using [email protected] just do this:

npm install react-highcharts --save

For [email protected] use:

npm install react-highcharts@^3.0.0 --save

Usage

Basic Usage

Check out this recipe to see how to install Highcharts with npm.

var React = require('react');
var ReactHighcharts = require('react-highcharts'); // Expects that Highcharts was loaded in the code. 

var config = {
  /* HighchartsConfig */
};
React.render(<ReactHighcharts config = {config}></ReactHighcharts>, document.body);

Bundled Usage (includes Highcharts)

var React = require('react');
var ReactHighcharts = require('react-highcharts/bundle/highcharts'); // Highcharts is bundled 

var config = {
  /* HighchartsConfig */
};
React.render(<ReactHighcharts config = {config}></ReactHighcharts>, document.body);

Accessing Highcharts API After Render

For access to methods & properties from the Highcharts library you can use ReactHighcharts.Highcharts. For example, the Highcharts options are available via ReactHighcharts.Highcharts.getOptions().

Highcharts provides an API for manipulating a chart after the initial render. See the Methods and Properties in the documentation. Here's how you access it:

class MyComponent extends React.Component {
  componentDidMount() {
    let chart = this.refs.chart.getChart();
    chart.series[0].addPoint({x: 10, y: 12});
  }

  render() {
    return <ReactHighcharts config={config} ref="chart"></ReactHighcharts>;
  }
}

Limiting Highchart Rerenders

Rerendering a highcharts graph is expensive. You can pass in a isPureConfig option to the ReactHighcharts component, which will keep the highcharts graph from being updated so long as the provided config is referentially equal to its previous value.

Rendering on the server with node

See this recipe

Using highmaps

Require Highmaps first, and then require('react-highcharts/highmaps'); Or use bundled version: require('react-highcharts/bundle/highmaps');

Using highstock

Require Highstock first, and then require('react-highcharts/highstock'); Or use bundled version: require('react-highcharts/bundle/highstock');

Using highcharts modules/add-ons like exporting, data, etc.

Everything related to modules was moved out of react-highcharts. Now every highcharts module is published as a separate npm package. You can find the full list list here

For Contributors

Update Highcharts Version

  1. Install new highcharts version.

    npm unistall highcharts-release --save-dev
    npm install highcharts-release --save-dev
    
  2. Increment the react-highcharts version such that a patch, minor release, or major release of Higcharts is reflected in a corresponding version increase for react-highcharts.

Running tests

Run npm tests

react-highcharts's People

Contributors

aldendaniels avatar johnlindahltech avatar joshhornby avatar kirjs avatar michaeljones avatar nmustaki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.