Skip to content

Commit

Permalink
Merge pull request #52 from RhoInc/v2.0.2-dev
Browse files Browse the repository at this point in the history
v2.0.2 - dev branch
  • Loading branch information
jwildfire authored Oct 13, 2017
2 parents e96155e + 4739736 commit 5cb6b66
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
22 changes: 16 additions & 6 deletions build/safetyOutlierExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,22 @@ var safetyOutlierExplorer = function (webcharts, d3$1) {
return d.value_col;
});

if (settings.filters) settings.filters.forEach(function (d, i) {
var thisFilter = { type: 'subsetter',
value_col: d.value_col ? d.value_col : d,
label: d.label ? d.label : d.value_col ? d.value_col : d };
controlInputs.push(thisFilter);
});
if (settings.filters) {
settings.filters.forEach(function (d, i) {
var thisFilter = {
type: 'subsetter',
value_col: d.value_col ? d.value_col : d,
label: d.label ? d.label : d.value_col ? d.value_col : d
};
//add the filter to the control inputs (as long as it isn't already there)
var current_value_cols = controlInputs.filter(function (f) {
return f.type == "subsetter";
}).map(function (m) {
return m.value_col;
});
if (current_value_cols.indexOf(thisFilter.value_col) == -1) controlInputs.push(thisFilter);
});
}

return controlInputs;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "safety-outlier-explorer",
"version": "2.0.1",
"version": "2.0.2",
"description": "Chart showing participant trajectories of lab measures, vital signs and other related measures in clinical trials.",
"main": "./build/safetyOutlierExplorer.js",
"scripts": {
"scripts": {
"build": "rollup -c ./scripts/rollup.wrapper.config.js | babel > ./build/safetyOutlierExplorer.js"
},
"author": "Rho, Inc.",
Expand Down
31 changes: 18 additions & 13 deletions src/defaultSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const defaultSettings = {
per: null, //set in syncSettings()
type: 'line',
attributes: {
'stroke-width': .5,
'stroke-width': .5,
'stroke-opacity': .5 ,
'stroke': '#999'
},
Expand All @@ -68,7 +68,7 @@ const defaultSettings = {
type: 'circle',
radius: 2,
attributes: {
'stroke-width': .5,
'stroke-width': .5,
'stroke-opacity': .5,
'fill-opacity': 1
},
Expand Down Expand Up @@ -97,7 +97,7 @@ export function syncSettings(settings) {
settings.marks[0].tooltip = `[${settings.id_col}]`;

settings.marks[1].per = [
settings.id_col,
settings.id_col,
settings.measure_col,
time_col.value_col,
settings.value_col
Expand All @@ -124,7 +124,7 @@ export function syncSettings(settings) {
}

// Default Control objects
export const controlInputs = [
export const controlInputs = [
{label: 'Measure', type: 'subsetter', start: null},
{type: 'dropdown', label: 'X-axis', option: 'x.column', require: true}
];
Expand All @@ -139,15 +139,20 @@ export function syncControlInputs(controlInputs, settings){
.filter(d => d.label === 'X-axis')[0];
xAxisControl.values = settings.time_cols.map(d => d.value_col);

if (settings.filters)
settings.filters
.forEach((d,i) => {
const thisFilter =
{type: 'subsetter'
,value_col: d.value_col ? d.value_col : d
,label: d.label ? d.label : d.value_col ? d.value_col : d};
controlInputs.push(thisFilter);
});
if (settings.filters){
settings.filters.forEach(function(d,i){
const thisFilter ={
type: 'subsetter',
value_col: d.value_col ? d.value_col : d,
label: d.label ? d.label : d.value_col ? d.value_col : d
};
//add the filter to the control inputs (as long as it isn't already there)
var current_value_cols = controlInputs.filter(f=>f.type=="subsetter").map(m=>m.value_col)
if(current_value_cols.indexOf(thisFilter.value_col)==-1)
controlInputs.push(thisFilter);
});
}


return controlInputs
}
Expand Down

0 comments on commit 5cb6b66

Please sign in to comment.