<script src="https://fb.me/react-15.0.1.min.js"></script>
<script src="https://fb.me/react-dom-15.0.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/funnel.js"></script>
<script src="https://www.highcharts.com/samples/data/usdeur.js"></script>
<!-- In usage with Node.js the script tags above needs to be replaced with "require" -->
<!--
var React = require('react'),
ReactDOM = require('react-dom'),
Highcharts = require('highcharts'),
addFunnel = require('highcharts/modules/funnel'),
usdeur = require('path-to-data');
-->
<!-- Read more about loading highcharts in Node.js here: http://www.highcharts.com/docs/getting-started/install-from-npm -->
<div id="react-app"></div>
JavaScript
var Chart = React.createClass({
// When the DOM is ready, create the chart.
componentDidMount: function() {
// Extend Highcharts with modules
if (this.props.modules) {
this.props.modules.forEach(function(module) {
module(Highcharts);
});
}
// Set container which the chart should render to.
this.chart = new Highcharts[this.props.type || "Chart"](
this.props.container,
this.props.options
);
},
//Destroy chart before unmount.
componentWillUnmount: function() {
this.chart.destroy();
},
//Create the div which the chart will be rendered to.
render: function() {
return React.createElement('div', {
id: this.props.container
});
}
}),
element;
// Create and render element
element = React.createElement(Chart, {
container: 'chart',
options: {
chart: {
type: 'funnel'
},
series: [{
name: 'Unique users',
data: [
['Website visits', 15654],
['Downloads', 4064],
['Requested price list', 1987],
['Invoice sent', 976],
['Finalized', 846]
]
}]
}
});
ReactDOM.render(element, document.getElementById('react-app'));
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.