Skip to content

Commit 4e9721a

Browse files
authored
Merge pull request #733 from joko3ono/feat/histogram-graph
Feat: histogram graph
2 parents 4abd19d + a2579b9 commit 4e9721a

13 files changed

Lines changed: 150 additions & 36 deletions

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ module.exports = {
4242
'hit_buttons': '<rootDir>/public/js/null_plugins/hit_buttons.js',
4343
'search_header_plugin': '<rootDir>/public/js/null_plugins/search_header_plugin.js',
4444
'circos$': '<rootDir>/public/js/tests/mocks/circos.js',
45+
'grapher': '<rootDir>/public/js/grapher.js',
46+
'histogram': '<rootDir>/public/js/null_plugins/grapher/histogram.js',
4547
},
4648
watchPlugins: [
4749
'jest-watch-typeahead/filename',
4850
'jest-watch-typeahead/testname'
4951
],
5052
resetMocks: true
51-
};
53+
};

package-lock.json

Lines changed: 75 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/circos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import d3 from 'd3';
22
import Circos from '../packages/circosJS@1.7.0';
33
import _ from 'underscore';
44

5-
import Grapher from './grapher';
5+
import Grapher from 'grapher';
66
import * as Helpers from './visualisation_helpers';
77
import Utils from './utils';
88

public/js/grapher.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ export default function Grapher(Graph) {
2929
}
3030

3131
render() {
32-
var cssClasses = Graph.className() + ' grapher';
33-
return (
34-
<div ref="grapher" className={cssClasses}>
35-
{this.header()}
36-
{this.svgContainerJSX()}
37-
</div>
38-
);
32+
// Do not render when Graph.name() is null
33+
if (Graph.name() === null) {
34+
return null;
35+
} else {
36+
var cssClasses = Graph.className() + ' grapher';
37+
return (
38+
<div ref="grapher" className={cssClasses}>
39+
{this.header()}
40+
{this.svgContainerJSX()}
41+
</div>
42+
);
43+
}
3944
}
4045

4146
header() {
@@ -123,4 +128,4 @@ $(window).resize(
123128
grapher.draw();
124129
});
125130
}, 125)
126-
);
131+
);

public/js/hits_overview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import d3 from 'd3';
22
import _ from 'underscore';
3-
import Grapher from './grapher';
3+
import Grapher from 'grapher';
44
import * as Helpers from './visualisation_helpers';
55
import Utils from './utils';
66

public/js/kablammo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import d3 from 'd3';
22
import _ from 'underscore';
3-
import Grapher from './grapher';
3+
import Grapher from 'grapher';
44
import * as Helpers from './visualisation_helpers';
55

66
/**

public/js/length_distribution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import d3 from 'd3';
22
import _ from 'underscore';
3-
import Grapher from './grapher';
3+
import Grapher from 'grapher';
44
import * as Helpers from './visualisation_helpers';
55

66
/**
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Grapher from 'grapher';
2+
3+
class Graph {
4+
static canCollapse() {
5+
return false;
6+
}
7+
8+
static name() {
9+
return null;
10+
}
11+
12+
static className() {
13+
return null;
14+
}
15+
16+
static dataName(_props) {
17+
return null;
18+
}
19+
20+
static graphId() {
21+
return null;
22+
}
23+
}
24+
25+
export default Grapher(Graph);

public/js/null_plugins/report_plugins.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Histogram from 'histogram';
12

23
class ReportPlugins {
34
constructor(parent) {
@@ -13,6 +14,10 @@ class ReportPlugins {
1314
queryResults(_query) {
1415
return [];
1516
}
17+
18+
generateStats() {
19+
return (<Histogram />);
20+
}
1621
}
1722

18-
export default ReportPlugins;
23+
export default ReportPlugins;

public/js/report.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ class Report extends Component {
300300
<div className="col-md-9">
301301
{this.overviewJSX()}
302302
{this.circosJSX()}
303+
{this.plugins.generateStats()}
303304
{this.state.results}
304305
</div>
305306
</div>

0 commit comments

Comments
 (0)