Skip to content

Commit 1b5d81d

Browse files
committed
Add Sankey and StreamGraph support
1 parent 4a13ef0 commit 1b5d81d

File tree

7 files changed

+80
-0
lines changed

7 files changed

+80
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import Series from '../Series';
4+
5+
class SankeySeries extends Component {
6+
static propTypes = {
7+
id: PropTypes.string.isRequired
8+
};
9+
10+
render () {
11+
return (
12+
<Series {...this.props} type="sankey" />
13+
);
14+
}
15+
}
16+
17+
export default SankeySeries;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import SankeySeries from './SankeySeries';
2+
export default SankeySeries;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import Series from '../Series';
4+
5+
class StreamGraphSeries extends Component {
6+
static propTypes = {
7+
id: PropTypes.string.isRequired
8+
};
9+
10+
render () {
11+
return (
12+
<Series {...this.props} type="streamgraph" />
13+
);
14+
}
15+
}
16+
17+
export default StreamGraphSeries;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import StreamGraphSeries from './StreamGraphSeries';
2+
export default StreamGraphSeries;

packages/react-jsx-highcharts/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ export LineSeries from './components/LineSeries';
3333
export PieSeries from './components/PieSeries';
3434
export PolygonSeries from './components/PolygonSeries';
3535
export PyramidSeries from './components/PyramidSeries';
36+
export SankeySeries from './components/SankeySeries';
3637
export ScatterSeries from './components/ScatterSeries';
3738
export SplineSeries from './components/SplineSeries';
39+
export StreamGraphSeries from './components/StreamGraphSeries';
3840
export TreemapSeries from './components/TreemapSeries';
3941
export WaterfallSeries from './components/WaterfallSeries';
4042

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import SankeySeries from '../../../src/components/SankeySeries/SankeySeries';
3+
import Series from '../../../src/components/Series';
4+
5+
describe('<SankeySeries />', function () {
6+
it('renders a <Series />', function () {
7+
const wrapper = shallow(<SankeySeries id="mySeries" />);
8+
expect(wrapper).to.have.type(Series);
9+
});
10+
11+
it('renders a <Series type="sankey" />', function () {
12+
const wrapper = shallow(<SankeySeries id="mySeries" />);
13+
expect(wrapper).to.have.prop('type').equal('sankey');
14+
});
15+
16+
it('passes other props through to <Series />', function () {
17+
const wrapper = shallow(<SankeySeries id="myOtherSeries" data={[1, 2, 3, 4]} />);
18+
expect(wrapper).to.have.prop('data').eql([1, 2, 3, 4]);
19+
});
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import StreamGraphSeries from '../../../src/components/StreamGraphSeries/StreamGraphSeries';
3+
import Series from '../../../src/components/Series';
4+
5+
describe('<StreamGraphSeries />', function () {
6+
it('renders a <Series />', function () {
7+
const wrapper = shallow(<StreamGraphSeries id="mySeries" />);
8+
expect(wrapper).to.have.type(Series);
9+
});
10+
11+
it('renders a <Series type="streamgraph" />', function () {
12+
const wrapper = shallow(<StreamGraphSeries id="mySeries" />);
13+
expect(wrapper).to.have.prop('type').equal('streamgraph');
14+
});
15+
16+
it('passes other props through to <Series />', function () {
17+
const wrapper = shallow(<StreamGraphSeries id="myOtherSeries" data={[1, 2, 3, 4]} />);
18+
expect(wrapper).to.have.prop('data').eql([1, 2, 3, 4]);
19+
});
20+
});

0 commit comments

Comments
 (0)