Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions forestplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
.y(function(d) {
return d.y;
})
.interpolate('linear-closed')
.interpolate('linear-closed');

diffPoints
.append('svg:path')
Expand Down Expand Up @@ -532,10 +532,20 @@
.call(testAxis);
}

function range(start, end) {
return Array(end - start + 1)
.fill()
.map(function(_, idx) {
return start + idx;
});
}

function draw() {
var chart = this;

chart.anly.forEach(function(testData, i) {
console.log('maya');
console.log(chart.config);
testData.wrap = chart.wrap
.append('div')
.attr('class', 'tableWrap')
Expand All @@ -553,14 +563,42 @@
paging: false,
order: [[2, 'desc']],
columnDefs: [
{ width: '120px', targets: 2 + chart.config.groups.length },
{
width: '120px',
targets: 2 + chart.config.groups.length
},
{
width: '300px',
targets: 2 + chart.config.groups.length + 1 + chart.config.pairs.length
},
{
targets: range(
2 + chart.config.groups.length + 1,
2 + chart.config.groups.length + 1 + chart.config.pairs.length - 1
),
render: function render(data, type, row) {
if (type === 'sort') {
var sortValue = data;
switch (data) {
case NaN:
sortValue = -999997;
break;
case 'NaN':
sortValue = -999998;
break;
case '-':
sortValue = -999999;
break;
}
return sortValue;
} else {
return data;
}
}
}
]
})
.columns.adjust()
//.columns.adjust()
.draw();
});
}
Expand Down Expand Up @@ -810,16 +848,17 @@
// let incidence_flag =
// (incidence_max >= chart.config.incidenceFilter[0]) &
// (incidence_max <= chart.config.incidenceFilter[1]);

// let comp_vals = data.filter(function(d, i) {
// // 2 + 3 + 1 = 6?
// let first_comp = 2 + config.groups.length + 1;
// // 5 + 3 = 8 ?
// let last_comp = first_comp + config.pairs.length;
// console.log((i >= first_comp) & (i < last_comp));
// return (i >= first_comp) & (i < last_comp);
// });
// let comp_max = d3.max(comp_vals, d => (d == '-' ? 0 : +d));
// let comp_flag =
// (comp_max >= chart.config.compFilter[0]) & (comp_max <= chart.config.compFilter[1]);

// return comp_flag & incidence_flag;
// });
}
Expand Down
39 changes: 37 additions & 2 deletions src/draw/draw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import makeBody from './makeBody';
import makeHeader from './makeHeader';

function range(start, end) {
return Array(end - start + 1)
.fill()
.map((_, idx) => start + idx);
}

export function draw() {
let chart = this;

Expand All @@ -20,14 +26,43 @@ export function draw() {
paging: false,
order: [[2, 'desc']],
columnDefs: [
{ width: '120px', targets: 2 + chart.config.groups.length },
{
width: '120px',
targets: 2 + chart.config.groups.length
},
{
width: '300px',
targets: 2 + chart.config.groups.length + 1 + chart.config.pairs.length
},
{
targets: range(
2 + chart.config.groups.length + 1,
2 + chart.config.groups.length + 1 + chart.config.pairs.length - 1
),
render: function(data, type, row) {
if (type === 'sort') {
var sortValue = data;
switch (data) {
case NaN:
sortValue = -999997;
break;
case 'NaN':
sortValue = -999998;
break;
case '-':
sortValue = -999999;
break;
default:
}
return sortValue;
} else {
return data;
}
}
}
]
})
.columns.adjust()
//.columns.adjust()
.draw();
});
}
5 changes: 3 additions & 2 deletions src/draw/makeFilterControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ export default function makeFilterControls(testData) {
// let incidence_flag =
// (incidence_max >= chart.config.incidenceFilter[0]) &
// (incidence_max <= chart.config.incidenceFilter[1]);

// let comp_vals = data.filter(function(d, i) {
// // 2 + 3 + 1 = 6?
// let first_comp = 2 + config.groups.length + 1;
// // 5 + 3 = 8 ?
// let last_comp = first_comp + config.pairs.length;
// console.log((i >= first_comp) & (i < last_comp));
// return (i >= first_comp) & (i < last_comp);
// });
// let comp_max = d3.max(comp_vals, d => (d == '-' ? 0 : +d));
// let comp_flag =
// (comp_max >= chart.config.compFilter[0]) & (comp_max <= chart.config.compFilter[1]);

// return comp_flag & incidence_flag;
// });
}