React Base Fiddle (JSX)
Starting point for creating JSFiddles with React.
by needlethread
HTML
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
CSS
body {
margin: 0;
}
#container {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
width: 800px;
height: 800px;
background-color: #fff;
}
Babel + JSX
const {ScatterChart, Scatter, XAxis, YAxis, CartesianGrid, Tooltip, Legend} = Recharts;
const data = [{x: 100, y: 200, z: 200}, {x: 120, y: 100, z: 260},
{x: 170, y: 300, z: 400}, {x: 140, y: 250, z: 280},
{x: 150, y: 400, z: 500}, {x: 110, y: 280, z: 200}]
const SimpleScatterChart = React.createClass({
render () {
const csr = {strokeDasharray: '3 3'};
return (
<ScatterChart width={400} height={400} >
<XAxis dataKey={'x'} type="number" name='stature' unit='cm'/>
<YAxis dataKey={'y'} type="number" name='weight' unit='kg'/>
<CartesianGrid />
<Scatter name='A school' data={data} fill='#8884d8'/>
</ScatterChart>
);
}
})
ReactDOM.render(
<SimpleScatterChart />,
document.getElementById('container')
);