Skip to content

Commit

Permalink
resolve #122
Browse files Browse the repository at this point in the history
  • Loading branch information
pburnsdata committed Apr 2, 2019
1 parent 5077f54 commit f2f41ed
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
16 changes: 13 additions & 3 deletions build/crfHeatMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,19 @@

//Define summarized values, either rates or counts.
context.initial_config.value_cols.forEach(function(value_col) {
var count = d3.sum(d, function(di) {
return di[value_col.col];
});
var count;
if (typeof value_col.denominator === 'undefined') {
count = d3.sum(d, function(di) {
return di[value_col.col];
});
} else {
var subset = d.filter(function(row) {
return row[value_col.denominator] === '1';
});
count = d3.sum(subset, function(di) {
return di[value_col.col];
});
}
summary[value_col.col] =
crfsNoDenominator
.map(function(m) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "crf-heat-map",
"description": "Heat Map showing database form status at different levels",
"version": "1.2.1",
"version": "1.2.3",
"author": "Rho, Inc.",
"license": "MIT",
"homepage": "https://github.com/rhoinc/crf-heat-map#readme",
Expand Down
4 changes: 2 additions & 2 deletions scripts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ The most straightforward way to customize the CRF Heat Map is by using a configu
In addition to the standard Webcharts settings several custom settings not available in the base Webcharts library have been added to the CRF Heat Map to facilitate data mapping and other custom functionality. These custom settings are described in detail below and are set in the [rendererSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/rendererSettings.js). All defaults can be overwritten by the passed configuration object.

# Renderer-specific settings
The sections below describe each crf-heat-map setting as of version 1.2.0.
The sections below describe each crf-heat-map setting as of version 1.2.3.

## settings.site_col
`string`
Expand Down Expand Up @@ -202,7 +202,7 @@ If the number of rows to be drawn exceeds this number when the user checks 'Expa
**default:** `10000`

# Webcharts settings
The object below contains each Webcharts setting as of version 1.2.0.
The object below contains each Webcharts setting as of version 1.2.3.

```
{ return { cols: null, headers: null, // set in rendererSettings applyCSS: true, searchable: false, sortable: false, pagination: false, exportable: true, exports: ['csv', 'xlsx'], dynamicPositioning: false };}}
Expand Down
2 changes: 1 addition & 1 deletion settings-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "settings",
"description": "JSON schema for the configuration of the CRF Heat Map",
"overview": "The most straightforward way to customize the CRF Heat Map is by using a configuration object whose properties describe the behavior and appearance of the table. Since the CRF Heat Map is a Webcharts `table` object, many default Webcharts settings are set in the [webchartsSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/webchartsSettings.js) as [described below](#webcharts-settings). Refer to the [Webcharts documentation](https://github.com/RhoInc/Webcharts/wiki/Chart-Configuration) for more details on these settings.\nIn addition to the standard Webcharts settings several custom settings not available in the base Webcharts library have been added to the CRF Heat Map to facilitate data mapping and other custom functionality. These custom settings are described in detail below and are set in the [rendererSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/rendererSettings.js). All defaults can be overwritten by the passed configuration object.",
"version": "1.2.0",
"version": "1.2.3",
"type": "object",
"properties": {
"site_col" : {
Expand Down
8 changes: 7 additions & 1 deletion src/onInit/summarizeData/calculateStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ export default function calculateStatistics(onInit = true) {

//Define summarized values, either rates or counts.
context.initial_config.value_cols.forEach(value_col => {
const count = d3.sum(d, di => di[value_col.col]);
var count;
if (typeof value_col.denominator === 'undefined') {
count = d3.sum(d, di => di[value_col.col]);
} else {
var subset = d.filter(row => row[value_col.denominator] === '1');
count = d3.sum(subset, di => di[value_col.col]);
}
summary[value_col.col] =
crfsNoDenominator.map(m => m.col).indexOf(value_col.col) > -1
? summary.nForms
Expand Down

0 comments on commit f2f41ed

Please # to comment.