Improved summary counts of annotation values (#478)

* convert annotation summary to a Map

* add 2d annotation count summary

* add memoization on 2D annotation counting

* add tests for annotation summarization

* fix import/exports

* rename WorldOps to WorldUtil

* rename WorldOps to WorldUtil

* add comment
This commit is contained in:
Bruce Martin
2018-12-03 09:15:03 -08:00
committed by GitHub
parent 1e66ec2b89
commit 296ed752fa
8 changed files with 401 additions and 91 deletions
+11 -9
View File
@@ -11,20 +11,20 @@ import _ from "lodash";
}))
class CategoryValue extends React.Component {
toggleOff() {
const { dispatch, metadataField, optionIndex } = this.props;
const { dispatch, metadataField, categoryIndex } = this.props;
dispatch({
type: "categorical metadata filter deselect",
metadataField,
optionIndex
categoryIndex
});
}
toggleOn() {
const { dispatch, metadataField, optionIndex } = this.props;
const { dispatch, metadataField, categoryIndex } = this.props;
dispatch({
type: "categorical metadata filter select",
metadataField,
optionIndex
categoryIndex
});
}
@@ -32,7 +32,7 @@ class CategoryValue extends React.Component {
const {
categoricalSelectionState,
metadataField,
optionIndex,
categoryIndex,
colorAccessor,
colorScale,
i,
@@ -42,10 +42,12 @@ class CategoryValue extends React.Component {
if (!categoricalSelectionState) return null;
const category = categoricalSelectionState[metadataField];
const selected = category.optionSelected[optionIndex];
const count = category.optionCount[optionIndex];
const value = category.optionValue[optionIndex];
const displayString = String(category.optionValue[optionIndex]).valueOf();
const selected = category.categorySelected[categoryIndex];
const count = category.categoryCounts[categoryIndex];
const value = category.categoryValues[categoryIndex];
const displayString = String(
category.categoryValues[categoryIndex]
).valueOf();
/* this is the color scale, so add swatches below */
const c = metadataField === colorAccessor;