Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
samussiah committed Aug 22, 2021
1 parent 11b8d56 commit 15307ce
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 19 deletions.
13 changes: 11 additions & 2 deletions build/webcodebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -2324,6 +2324,8 @@
}

function onInit$2() {
var _this = this;

var context = this;
var config = this.initialSettings;
var measure = config.measure;
Expand Down Expand Up @@ -2352,7 +2354,10 @@
if (!this.group) {
this.initialSettings.unfilteredData = this.raw_data;
this.raw_data = this.initialSettings.unfilteredData.filter(function(d) {
return !isNaN(+d[measure]) && !/^\s*$/.test(d[measure]);
return (
_this.config.codebookConfig.missingValues.indexOf(d[measure]) ===
-1 && !/^\s*$/.test(d[measure])
);
});
}

Expand Down Expand Up @@ -2485,7 +2490,8 @@
margin: this_.margin,
nBins: d.bins,
chartType: d.chartType,
commonScale: d.commonScale == undefined ? true : d.commonScale
commonScale: d.commonScale == undefined ? true : d.commonScale,
codebookConfig: d.codebookConfig
};
var chartData = [];

Expand Down Expand Up @@ -4232,6 +4238,9 @@
else g.statistics = summarize.continuous(g.values, sub);
});
}

// Give charts access to codebook object.
varObj.codebookConfig = config;
return varObj;
});

Expand Down
23 changes: 14 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/charts/createHistogramBoxPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export function createHistogramBoxPlot(this_, d) {
margin: this_.margin,
nBins: d.bins,
chartType: d.chartType,
commonScale: d.commonScale == undefined ? true : d.commonScale
commonScale: d.commonScale == undefined ? true : d.commonScale,
codebookConfig: d.codebookConfig
};
let chartData = [];

Expand Down
4 changes: 3 additions & 1 deletion src/charts/histogramBoxPlot/onInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export default function onInit() {
if (!this.group) {
this.initialSettings.unfilteredData = this.raw_data;
this.raw_data = this.initialSettings.unfilteredData.filter(
d => !isNaN(+d[measure]) && !/^\s*$/.test(d[measure])
d =>
this.config.codebookConfig.missingValues.indexOf(d[measure]) === -1 &&
!/^\s*$/.test(d[measure])
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/codebook/data/makeSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ export function makeSummary(codebook) {
else g.statistics = summarize.continuous(g.values, sub);
});
}

// Give charts access to codebook object.
varObj.codebookConfig = config;
return varObj;
});

Expand Down
1 change: 0 additions & 1 deletion test-page/default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<body>
<div id = 'title'>Web Codebook</div>
<div id = 'subtitle'>Test Page</div>
<div id = 'container'></div>
</body>

Expand Down
6 changes: 1 addition & 5 deletions test-page/default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ fetch(
.join(' ')
).replace(/\.csv/i, '');
});
console.log('Data file metadata:');
console.log(json);
//const fileObj = json[Math.floor(Math.random() * json.length)];
const fileObj = json[8];
console.log('Select data file metadata:');
console.log(fileObj);
d3.csv(
fileObj.github_url,
function(d) {
function(d, i) {
return d;
},
function(error, data) {
Expand Down

0 comments on commit 15307ce

Please sign in to comment.