@haniffalab/cherita-react 1.4.1 → 1.4.2-dev.2025-10-29.e8bbb191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/components/controls/Controls.js +38 -30
- package/dist/cjs/components/dotplot/Dotplot.js +67 -69
- package/dist/cjs/components/dotplot/DotplotControls.js +103 -83
- package/dist/cjs/components/full-page/FullPage.js +100 -74
- package/dist/cjs/components/full-page/PlotAlert.js +45 -0
- package/dist/cjs/components/full-page/PlotTypeSelector.js +89 -44
- package/dist/cjs/components/heatmap/Heatmap.js +65 -65
- package/dist/cjs/components/heatmap/HeatmapControls.js +6 -3
- package/dist/cjs/components/icons/DotPlotIcon.js +64 -0
- package/dist/cjs/components/icons/HeatmapIcon.js +45 -0
- package/dist/cjs/components/icons/MatrixPlotIcon.1.js +57 -0
- package/dist/cjs/components/icons/MatrixPlotIcon.js +59 -0
- package/dist/cjs/components/icons/ScatterplotIcon.1.js +164 -0
- package/dist/cjs/components/icons/ScatterplotIcon.js +144 -0
- package/dist/cjs/components/icons/ViolinPlotIcon.js +42 -0
- package/dist/cjs/components/matrixplot/Matrixplot.js +65 -66
- package/dist/cjs/components/matrixplot/MatrixplotControls.js +8 -5
- package/dist/cjs/components/obs-list/ObsItem.js +258 -210
- package/dist/cjs/components/obs-list/ObsList.js +161 -133
- package/dist/cjs/components/obs-list/ObsToolbar.js +2 -3
- package/dist/cjs/components/obsm-list/ObsmList.js +53 -38
- package/dist/cjs/components/offcanvas/index.js +61 -31
- package/dist/cjs/components/pseudospatial/Pseudospatial.js +132 -76
- package/dist/cjs/components/pseudospatial/PseudospatialToolbar.js +122 -74
- package/dist/cjs/components/scatterplot/Scatterplot.js +127 -99
- package/dist/cjs/components/scatterplot/ScatterplotControls.js +45 -31
- package/dist/cjs/components/scatterplot/SpatialControls.js +140 -113
- package/dist/cjs/components/scatterplot/Toolbox.js +41 -30
- package/dist/cjs/components/search-bar/SearchBar.js +168 -121
- package/dist/cjs/components/search-bar/SearchInfo.js +76 -50
- package/dist/cjs/components/search-bar/SearchResults.js +93 -71
- package/dist/cjs/components/toolbar/Toolbar.js +46 -37
- package/dist/cjs/components/var-list/VarItem.js +115 -88
- package/dist/cjs/components/var-list/VarList.js +85 -69
- package/dist/cjs/components/var-list/VarListToolbar.js +59 -54
- package/dist/cjs/components/var-list/VarSet.js +126 -108
- package/dist/cjs/components/violin/Violin.js +109 -107
- package/dist/cjs/components/violin/ViolinControls.js +8 -5
- package/dist/cjs/constants/colorscales.js +19 -19
- package/dist/cjs/constants/constants.js +47 -47
- package/dist/cjs/context/DatasetContext.js +24 -16
- package/dist/cjs/context/FilterContext.js +11 -9
- package/dist/cjs/context/SettingsContext.js +255 -89
- package/dist/cjs/context/ZarrDataContext.js +6 -5
- package/dist/cjs/helpers/color-helper.js +2 -2
- package/dist/cjs/helpers/zarr-helper.js +3 -3
- package/dist/cjs/utils/Filter.js +16 -11
- package/dist/cjs/utils/Histogram.js +35 -33
- package/dist/cjs/utils/ImageViewer.js +11 -8
- package/dist/cjs/utils/Legend.js +37 -30
- package/dist/cjs/utils/LoadingIndicators.js +15 -13
- package/dist/cjs/utils/Resolver.js +213 -0
- package/dist/cjs/utils/Skeleton.js +10 -10
- package/dist/cjs/utils/StyledTooltip.js +44 -0
- package/dist/cjs/utils/VirtualizedList.js +34 -27
- package/dist/cjs/utils/errors.js +15 -15
- package/dist/cjs/utils/requests.js +21 -9
- package/dist/cjs/utils/search.js +4 -4
- package/dist/cjs/utils/string.js +6 -6
- package/dist/cjs/utils/zarrData.js +20 -21
- package/dist/css/cherita.css +64 -42
- package/dist/css/cherita.css.map +1 -1
- package/dist/esm/components/controls/Controls.js +43 -35
- package/dist/esm/components/dotplot/Dotplot.js +77 -78
- package/dist/esm/components/dotplot/DotplotControls.js +106 -85
- package/dist/esm/components/full-page/FullPage.js +120 -93
- package/dist/esm/components/full-page/PlotAlert.js +39 -0
- package/dist/esm/components/full-page/PlotTypeSelector.js +90 -45
- package/dist/esm/components/heatmap/Heatmap.js +75 -74
- package/dist/esm/components/heatmap/HeatmapControls.js +8 -4
- package/dist/esm/components/icons/DotPlotIcon.js +58 -0
- package/dist/esm/components/icons/HeatmapIcon.js +39 -0
- package/dist/esm/components/icons/MatrixPlotIcon.1.js +51 -0
- package/dist/esm/components/icons/MatrixPlotIcon.js +53 -0
- package/dist/esm/components/icons/ScatterplotIcon.1.js +158 -0
- package/dist/esm/components/icons/ScatterplotIcon.js +138 -0
- package/dist/esm/components/icons/ViolinPlotIcon.js +36 -0
- package/dist/esm/components/matrixplot/Matrixplot.js +75 -75
- package/dist/esm/components/matrixplot/MatrixplotControls.js +10 -6
- package/dist/esm/components/obs-list/ObsItem.js +273 -222
- package/dist/esm/components/obs-list/ObsList.js +176 -147
- package/dist/esm/components/obs-list/ObsToolbar.js +3 -3
- package/dist/esm/components/obsm-list/ObsmList.js +60 -44
- package/dist/esm/components/offcanvas/index.js +67 -37
- package/dist/esm/components/pseudospatial/Pseudospatial.js +145 -88
- package/dist/esm/components/pseudospatial/PseudospatialToolbar.js +127 -78
- package/dist/esm/components/scatterplot/Scatterplot.js +148 -119
- package/dist/esm/components/scatterplot/ScatterplotControls.js +50 -35
- package/dist/esm/components/scatterplot/SpatialControls.js +153 -125
- package/dist/esm/components/scatterplot/Toolbox.js +44 -32
- package/dist/esm/components/search-bar/SearchBar.js +180 -132
- package/dist/esm/components/search-bar/SearchInfo.js +86 -59
- package/dist/esm/components/search-bar/SearchResults.js +100 -77
- package/dist/esm/components/toolbar/Toolbar.js +49 -39
- package/dist/esm/components/var-list/VarItem.js +126 -98
- package/dist/esm/components/var-list/VarList.js +99 -82
- package/dist/esm/components/var-list/VarListToolbar.js +64 -58
- package/dist/esm/components/var-list/VarSet.js +134 -115
- package/dist/esm/components/violin/Violin.js +121 -118
- package/dist/esm/components/violin/ViolinControls.js +10 -6
- package/dist/esm/constants/colorscales.js +19 -19
- package/dist/esm/constants/constants.js +47 -47
- package/dist/esm/context/DatasetContext.js +31 -22
- package/dist/esm/context/FilterContext.js +11 -8
- package/dist/esm/context/SettingsContext.js +257 -90
- package/dist/esm/context/ZarrDataContext.js +8 -6
- package/dist/esm/helpers/color-helper.js +5 -5
- package/dist/esm/helpers/map-helper.js +2 -2
- package/dist/esm/helpers/zarr-helper.js +6 -6
- package/dist/esm/index.js +22 -22
- package/dist/esm/utils/Filter.js +22 -17
- package/dist/esm/utils/Histogram.js +39 -37
- package/dist/esm/utils/ImageViewer.js +12 -8
- package/dist/esm/utils/Legend.js +44 -36
- package/dist/esm/utils/LoadingIndicators.js +16 -13
- package/dist/esm/utils/Resolver.js +201 -0
- package/dist/esm/utils/Skeleton.js +11 -10
- package/dist/esm/utils/StyledTooltip.js +38 -0
- package/dist/esm/utils/VirtualizedList.js +35 -27
- package/dist/esm/utils/errors.js +15 -15
- package/dist/esm/utils/requests.js +24 -12
- package/dist/esm/utils/search.js +7 -7
- package/dist/esm/utils/string.js +7 -7
- package/dist/esm/utils/zarrData.js +27 -28
- package/package.json +21 -9
- package/scss/cherita-bootstrap.scss +2 -2
- package/scss/cherita.scss +43 -17
- package/scss/components/accordions.scss +4 -1
- package/scss/components/layouts.scss +15 -33
- package/scss/components/lists.scss +8 -4
- package/scss/components/plotly.scss +38 -26
- package/scss/components/plots.scss +14 -1
- package/dist/assets/images/plots/dotplot.svg +0 -152
- package/dist/assets/images/plots/heatmap.svg +0 -193
- package/dist/assets/images/plots/matrixplot.svg +0 -275
- package/dist/assets/images/plots/scatterplot.svg +0 -198
- package/dist/assets/images/plots/violin.svg +0 -50
|
@@ -3,23 +3,24 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import
|
|
7
|
-
import { Tooltip } from
|
|
8
|
-
import { Gauge, SparkLineChart } from
|
|
9
|
-
import _ from
|
|
10
|
-
import { Badge, Form, ListGroup } from
|
|
11
|
-
import { ObsToolbar } from
|
|
12
|
-
import { COLOR_ENCODINGS, OBS_TYPES } from
|
|
13
|
-
import { useDataset } from
|
|
14
|
-
import { useFilteredData } from
|
|
15
|
-
import { useSettings } from
|
|
16
|
-
import { useColor } from
|
|
17
|
-
import { Histogram } from
|
|
18
|
-
import { LoadingLinear } from
|
|
19
|
-
import { useFetch } from
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { Tooltip } from '@mui/material';
|
|
8
|
+
import { Gauge, SparkLineChart } from '@mui/x-charts';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import { Badge, Form, ListGroup } from 'react-bootstrap';
|
|
11
|
+
import { ObsToolbar } from './ObsToolbar';
|
|
12
|
+
import { COLOR_ENCODINGS, OBS_TYPES } from '../../constants/constants';
|
|
13
|
+
import { useDataset } from '../../context/DatasetContext';
|
|
14
|
+
import { useFilteredData } from '../../context/FilterContext';
|
|
15
|
+
import { useSettings } from '../../context/SettingsContext';
|
|
16
|
+
import { useColor } from '../../helpers/color-helper';
|
|
17
|
+
import { Histogram } from '../../utils/Histogram';
|
|
18
|
+
import { LoadingLinear } from '../../utils/LoadingIndicators';
|
|
19
|
+
import { useFetch } from '../../utils/requests';
|
|
20
|
+
import { useSelectedVar } from '../../utils/Resolver';
|
|
21
|
+
import { formatNumerical, FORMATS } from '../../utils/string';
|
|
22
|
+
import { VirtualizedList } from '../../utils/VirtualizedList';
|
|
23
|
+
import { useObsData } from '../../utils/zarrData';
|
|
23
24
|
|
|
24
25
|
// const N_BINS = 5;
|
|
25
26
|
|
|
@@ -40,47 +41,46 @@ import { useObsData } from "../../utils/zarrData";
|
|
|
40
41
|
// };
|
|
41
42
|
// return { ...data, bins: bins };
|
|
42
43
|
// }
|
|
43
|
-
|
|
44
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
45
|
function getContinuousLabel(code, binEdges) {
|
|
45
|
-
return "[ ".concat(formatNumerical(binEdges[code][0]), ", ").concat(formatNumerical(binEdges[code][1], FORMATS.EXPONENTIAL)).concat(code === binEdges.length - 1 ?
|
|
46
|
+
return "[ ".concat(formatNumerical(binEdges[code][0]), ", ").concat(formatNumerical(binEdges[code][1], FORMATS.EXPONENTIAL)).concat(code === binEdges.length - 1 ? ' ]' : ' )');
|
|
46
47
|
}
|
|
47
48
|
const useObsHistogram = (obs, _ref) => {
|
|
48
|
-
var _settings$selectedVar, _settings$selectedVar2, _settings$selectedVar3, _settings$selectedVar4, _settings$selectedVar9, _settings$selectedVar0, _settings$selectedVar1, _settings$selectedVar10;
|
|
49
49
|
let {
|
|
50
50
|
enabled = true
|
|
51
51
|
} = _ref;
|
|
52
|
-
const ENDPOINT =
|
|
52
|
+
const ENDPOINT = 'obs/histograms';
|
|
53
53
|
const dataset = useDataset();
|
|
54
54
|
const settings = useSettings();
|
|
55
55
|
const {
|
|
56
56
|
obsIndices,
|
|
57
57
|
isSliced
|
|
58
58
|
} = useFilteredData();
|
|
59
|
+
const selectedVar = useSelectedVar();
|
|
59
60
|
const [params, setParams] = useState({
|
|
60
61
|
url: dataset.url,
|
|
61
|
-
obsCol: _.omit(obs,
|
|
62
|
+
obsCol: _.omit(obs, 'omit'),
|
|
62
63
|
// avoid re-rendering when toggling unselected obs
|
|
63
|
-
varKey:
|
|
64
|
-
name:
|
|
65
|
-
indices:
|
|
66
|
-
} :
|
|
64
|
+
varKey: selectedVar !== null && selectedVar !== void 0 && selectedVar.isSet ? {
|
|
65
|
+
name: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.name,
|
|
66
|
+
indices: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.vars.map(v => v.index)
|
|
67
|
+
} : selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.index,
|
|
67
68
|
obsIndices: isSliced ? [...(obsIndices || [])] : null
|
|
68
69
|
});
|
|
69
70
|
useEffect(() => {
|
|
70
71
|
setParams(p => {
|
|
71
|
-
var _settings$selectedVar5, _settings$selectedVar6, _settings$selectedVar7, _settings$selectedVar8;
|
|
72
72
|
return _objectSpread(_objectSpread({}, p), {}, {
|
|
73
|
-
obsCol: _.omit(obs,
|
|
74
|
-
varKey:
|
|
75
|
-
name:
|
|
76
|
-
indices:
|
|
77
|
-
} :
|
|
73
|
+
obsCol: _.omit(obs, 'omit'),
|
|
74
|
+
varKey: selectedVar !== null && selectedVar !== void 0 && selectedVar.isSet ? {
|
|
75
|
+
name: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.name,
|
|
76
|
+
indices: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.vars.map(v => v.index)
|
|
77
|
+
} : selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.index,
|
|
78
78
|
obsIndices: isSliced ? [...(obsIndices || [])] : null
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
-
}, [
|
|
81
|
+
}, [selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.index, selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.isSet, selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.name, selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.vars, obsIndices, isSliced, obs]);
|
|
82
82
|
return useFetch(ENDPOINT, params, {
|
|
83
|
-
enabled: enabled && !!
|
|
83
|
+
enabled: enabled && !!selectedVar && settings.colorEncoding === COLOR_ENCODINGS.VAR,
|
|
84
84
|
refetchOnMount: false
|
|
85
85
|
});
|
|
86
86
|
};
|
|
@@ -159,100 +159,118 @@ function CategoricalItem(_ref2) {
|
|
|
159
159
|
const {
|
|
160
160
|
getColor
|
|
161
161
|
} = useColor();
|
|
162
|
-
return /*#__PURE__*/
|
|
163
|
-
className: "virtualized-list-wrapper"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
162
|
+
return /*#__PURE__*/_jsx("div", {
|
|
163
|
+
className: "virtualized-list-wrapper",
|
|
164
|
+
children: /*#__PURE__*/_jsx(ListGroup.Item, {
|
|
165
|
+
className: "obs-item",
|
|
166
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
167
|
+
className: "d-flex align-items-center flex-wrap",
|
|
168
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
169
|
+
className: "flex-grow-1 me-auto mw-100",
|
|
170
|
+
children: /*#__PURE__*/_jsx(Form.Check, {
|
|
171
|
+
className: "obs-value-list-check",
|
|
172
|
+
type: "switch",
|
|
173
|
+
title: label,
|
|
174
|
+
label: label,
|
|
175
|
+
checked: !isOmitted,
|
|
176
|
+
onChange: () => onChange(value)
|
|
177
|
+
})
|
|
178
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
179
|
+
className: "d-flex align-items-center ms-auto",
|
|
180
|
+
children: [(!!histogramData.data || histogramData.isPending) && /*#__PURE__*/_jsx("div", {
|
|
181
|
+
className: "pl-1 m-0",
|
|
182
|
+
children: /*#__PURE__*/_jsx(Histogram, {
|
|
183
|
+
data: histogramData.data,
|
|
184
|
+
isPending: histogramData.isPending,
|
|
185
|
+
altColor: histogramData.altColor
|
|
186
|
+
})
|
|
187
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
188
|
+
className: "pl-1 m-0",
|
|
189
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
190
|
+
title: isSliced ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
191
|
+
children: ["Filtered:", ' ', formatNumerical(filteredStats.pct, FORMATS.EXPONENTIAL), "%", /*#__PURE__*/_jsx("br", {}), "Total: ", formatNumerical(stats.pct, FORMATS.EXPONENTIAL), "%"]
|
|
192
|
+
}) : "".concat(formatNumerical(stats.pct, FORMATS.EXPONENTIAL), "%"),
|
|
193
|
+
placement: "left",
|
|
194
|
+
arrow: true,
|
|
195
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
196
|
+
className: "d-flex align-items-center",
|
|
197
|
+
children: [/*#__PURE__*/_jsxs(Badge, {
|
|
198
|
+
className: "value-count-badge",
|
|
199
|
+
children: [' ', isSliced && parseInt(filteredStats.value_counts) !== parseInt(stats.value_counts) && /*#__PURE__*/_jsxs(_Fragment, {
|
|
200
|
+
children: [formatNumerical(parseInt(filteredStats.value_counts)), ' ', "out of", ' ']
|
|
201
|
+
}), formatNumerical(parseInt(stats.value_counts), FORMATS.EXPONENTIAL)]
|
|
202
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
203
|
+
className: "value-pct-gauge-container",
|
|
204
|
+
children: isSliced ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [/*#__PURE__*/_jsx(Gauge, {
|
|
206
|
+
className: "pct-gauge filtered-pct-gauge",
|
|
207
|
+
value: filteredStats.pct,
|
|
208
|
+
text: null,
|
|
209
|
+
innerRadius: '50%',
|
|
210
|
+
outerRadius: '75%',
|
|
211
|
+
margin: {
|
|
212
|
+
top: 0,
|
|
213
|
+
right: 0,
|
|
214
|
+
bottom: 0,
|
|
215
|
+
left: 0
|
|
216
|
+
}
|
|
217
|
+
}), /*#__PURE__*/_jsx(Gauge, {
|
|
218
|
+
className: "pct-gauge",
|
|
219
|
+
value: stats.pct,
|
|
220
|
+
text: null,
|
|
221
|
+
innerRadius: '75%',
|
|
222
|
+
margin: {
|
|
223
|
+
top: 0,
|
|
224
|
+
right: 0,
|
|
225
|
+
bottom: 0,
|
|
226
|
+
left: 0
|
|
227
|
+
}
|
|
228
|
+
})]
|
|
229
|
+
}) : /*#__PURE__*/_jsx(Gauge, {
|
|
230
|
+
value: stats.pct,
|
|
231
|
+
text: null,
|
|
232
|
+
innerRadius: '50%',
|
|
233
|
+
margin: {
|
|
234
|
+
top: 0,
|
|
235
|
+
right: 0,
|
|
236
|
+
bottom: 0,
|
|
237
|
+
left: 0
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
})]
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
}), showColor ? /*#__PURE__*/_jsx("div", {
|
|
244
|
+
className: "pl-1",
|
|
245
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
246
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
247
|
+
width: 24,
|
|
248
|
+
height: 24,
|
|
249
|
+
fill: "currentColor",
|
|
250
|
+
viewBox: "0 0 10 10",
|
|
251
|
+
children: /*#__PURE__*/_jsx("rect", {
|
|
252
|
+
x: "0",
|
|
253
|
+
y: "0",
|
|
254
|
+
width: "10",
|
|
255
|
+
height: "10",
|
|
256
|
+
fill: "rgb(".concat(getColor(_objectSpread({
|
|
257
|
+
value: (code - min) / (max - min),
|
|
258
|
+
categorical: true,
|
|
259
|
+
grayOut: isOmitted,
|
|
260
|
+
grayParams: {
|
|
261
|
+
alpha: 1
|
|
262
|
+
},
|
|
263
|
+
colorEncoding: 'obs'
|
|
264
|
+
}, useUnsColors ? {
|
|
265
|
+
colorscale: colors
|
|
266
|
+
} : {})), ")")
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
}) : null]
|
|
270
|
+
})]
|
|
271
|
+
})
|
|
272
|
+
}, value)
|
|
273
|
+
});
|
|
256
274
|
}
|
|
257
275
|
export function CategoricalObs(_ref3) {
|
|
258
276
|
let {
|
|
@@ -283,7 +301,7 @@ export function CategoricalObs(_ref3) {
|
|
|
283
301
|
value_counts: obs.value_counts[obs.values[index]],
|
|
284
302
|
pct: obs.value_counts[obs.values[index]] / totalCounts * 100
|
|
285
303
|
},
|
|
286
|
-
isOmitted: _.includes(obs.omit, obs.
|
|
304
|
+
isOmitted: _.includes(obs.omit, obs.values[index]),
|
|
287
305
|
label: obs.values[index],
|
|
288
306
|
histogramData: enabledHistograms ? {
|
|
289
307
|
data: (_obsHistograms$fetche = obsHistograms.fetchedData) === null || _obsHistograms$fetche === void 0 ? void 0 : _obsHistograms$fetche[obs.values[index]],
|
|
@@ -302,35 +320,37 @@ export function CategoricalObs(_ref3) {
|
|
|
302
320
|
};
|
|
303
321
|
}, [obs.values, obs.codes, obs.value_counts, obs.omit, obs.colors, totalCounts, enabledHistograms, obsHistograms.fetchedData, obsHistograms.isPending, isSliced, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct]);
|
|
304
322
|
showColor &= settings.colorEncoding === COLOR_ENCODINGS.OBS;
|
|
305
|
-
return /*#__PURE__*/
|
|
323
|
+
return /*#__PURE__*/_jsxs(ListGroup, {
|
|
306
324
|
variant: "flush",
|
|
307
|
-
className: "cherita-list"
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
className: "cherita-list",
|
|
326
|
+
children: [/*#__PURE__*/_jsx(ListGroup.Item, {
|
|
327
|
+
className: "unstyled",
|
|
328
|
+
children: /*#__PURE__*/_jsx(ObsToolbar, {
|
|
329
|
+
item: obs,
|
|
330
|
+
onToggleAllObs: toggleAll
|
|
331
|
+
})
|
|
332
|
+
}), /*#__PURE__*/_jsx(VirtualizedList, {
|
|
333
|
+
getDataAtIndex: getDataAtIndex,
|
|
334
|
+
count: obs.values.length,
|
|
335
|
+
ItemComponent: CategoricalItem,
|
|
336
|
+
totalCounts: totalCounts,
|
|
337
|
+
min: min,
|
|
338
|
+
max: max,
|
|
339
|
+
onChange: toggleObs,
|
|
340
|
+
showColor: showColor,
|
|
341
|
+
estimateSize: i =>
|
|
342
|
+
// rough attempt to determine size based on label length
|
|
343
|
+
// estimate size of 68 pixels if label is long (>=25 chars if enabledHistograms, >=30 if showColor, >=35 otherwise), else 42
|
|
344
|
+
// TODO: consider isSliced as count badge will be longer ?
|
|
345
|
+
obs.values[i].length >= (enabledHistograms ? 25 : showColor ? 30 : 35) ? 68 : 42
|
|
346
|
+
})]
|
|
347
|
+
});
|
|
328
348
|
}
|
|
329
349
|
function ObsContinuousStats(_ref4) {
|
|
330
350
|
let {
|
|
331
351
|
obs
|
|
332
352
|
} = _ref4;
|
|
333
|
-
const ENDPOINT =
|
|
353
|
+
const ENDPOINT = 'obs/distribution';
|
|
334
354
|
const dataset = useDataset();
|
|
335
355
|
const params = {
|
|
336
356
|
url: dataset.url,
|
|
@@ -343,49 +363,76 @@ function ObsContinuousStats(_ref4) {
|
|
|
343
363
|
} = useFetch(ENDPOINT, params);
|
|
344
364
|
|
|
345
365
|
// @TODO: fix width issue when min/max/etc values are too large
|
|
346
|
-
return /*#__PURE__*/
|
|
347
|
-
className: "obs-statistics"
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
366
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
367
|
+
className: "obs-statistics",
|
|
368
|
+
children: [/*#__PURE__*/_jsx("h5", {
|
|
369
|
+
className: "mb-2",
|
|
370
|
+
children: "Statistics"
|
|
371
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
372
|
+
className: "row",
|
|
373
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
374
|
+
className: "col-md-7",
|
|
375
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
376
|
+
className: "mb-1 small",
|
|
377
|
+
children: "Distribution of continuous values"
|
|
378
|
+
}), isPending && /*#__PURE__*/_jsx(LoadingLinear, {}), !isPending && !serverError && /*#__PURE__*/_jsx("div", {
|
|
379
|
+
className: "obs-distribution",
|
|
380
|
+
children: /*#__PURE__*/_jsx(SparkLineChart, {
|
|
381
|
+
data: fetchedData.kde_values[1],
|
|
382
|
+
showHighlight: true,
|
|
383
|
+
showTooltip: true,
|
|
384
|
+
margin: {
|
|
385
|
+
top: 10,
|
|
386
|
+
right: 20,
|
|
387
|
+
bottom: 10,
|
|
388
|
+
left: 20
|
|
389
|
+
},
|
|
390
|
+
xAxis: {
|
|
391
|
+
data: fetchedData.kde_values[0],
|
|
392
|
+
valueFormatter: v => "".concat(formatNumerical(v, FORMATS.EXPONENTIAL))
|
|
393
|
+
},
|
|
394
|
+
valueFormatter: v => "".concat(formatNumerical(v, FORMATS.EXPONENTIAL)),
|
|
395
|
+
slotProps: {
|
|
396
|
+
popper: {
|
|
397
|
+
className: 'feature-histogram-tooltip'
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
})]
|
|
402
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
403
|
+
className: "col-md-5 d-flex flex-column text-end",
|
|
404
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
405
|
+
className: "d-flex justify-content-between",
|
|
406
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
407
|
+
children: "Min"
|
|
408
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
409
|
+
children: formatNumerical(obs.min, FORMATS.EXPONENTIAL)
|
|
410
|
+
})]
|
|
411
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
412
|
+
className: "d-flex justify-content-between",
|
|
413
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
414
|
+
children: "Max"
|
|
415
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
416
|
+
children: formatNumerical(obs.max, FORMATS.EXPONENTIAL)
|
|
417
|
+
})]
|
|
418
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
419
|
+
className: "d-flex justify-content-between",
|
|
420
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
421
|
+
children: "Mean"
|
|
422
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
423
|
+
children: formatNumerical(obs.mean, FORMATS.EXPONENTIAL)
|
|
424
|
+
})]
|
|
425
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
426
|
+
className: "d-flex justify-content-between",
|
|
427
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
428
|
+
children: "Median"
|
|
429
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
430
|
+
children: formatNumerical(obs.median, FORMATS.EXPONENTIAL)
|
|
431
|
+
})]
|
|
432
|
+
})]
|
|
433
|
+
})]
|
|
434
|
+
})]
|
|
435
|
+
});
|
|
389
436
|
}
|
|
390
437
|
|
|
391
438
|
// @TODO: add bin controls
|
|
@@ -409,7 +456,7 @@ export function ContinuousObs(_ref5) {
|
|
|
409
456
|
const filteredObsData = useFilteredObsData(obs);
|
|
410
457
|
const enabledHistograms = useMemo(() => showHistograms && settings.colorEncoding === COLOR_ENCODINGS.VAR, [settings.colorEncoding, showHistograms]);
|
|
411
458
|
const getLabel = useCallback(index => {
|
|
412
|
-
return isNaN(obs.values[index]) ?
|
|
459
|
+
return isNaN(obs.values[index]) ? 'NaN' : getContinuousLabel(obs.codes[obs.values[index]], obs.bins.binEdges);
|
|
413
460
|
}, [obs.bins.binEdges, obs.codes, obs.values]);
|
|
414
461
|
const getDataAtIndex = useCallback(index => {
|
|
415
462
|
var _obsHistograms$fetche2;
|
|
@@ -420,7 +467,7 @@ export function ContinuousObs(_ref5) {
|
|
|
420
467
|
value_counts: obs.value_counts[obs.values[index]],
|
|
421
468
|
pct: obs.value_counts[obs.values[index]] / totalCounts * 100
|
|
422
469
|
},
|
|
423
|
-
isOmitted: _.includes(obs.omit, obs.
|
|
470
|
+
isOmitted: _.includes(obs.omit, obs.values[index]),
|
|
424
471
|
label: getLabel(index),
|
|
425
472
|
histogramData: enabledHistograms ? {
|
|
426
473
|
data: (_obsHistograms$fetche2 = obsHistograms.fetchedData) === null || _obsHistograms$fetche2 === void 0 ? void 0 : _obsHistograms$fetche2[obs.values[index]],
|
|
@@ -437,29 +484,33 @@ export function ContinuousObs(_ref5) {
|
|
|
437
484
|
isSliced: isSliced
|
|
438
485
|
};
|
|
439
486
|
}, [enabledHistograms, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, getLabel, isSliced, obs.codes, obs.omit, obs.value_counts, obs.values, obsHistograms.fetchedData, obsHistograms.isPending, totalCounts]);
|
|
440
|
-
return /*#__PURE__*/
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
487
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
488
|
+
children: [/*#__PURE__*/_jsxs(ListGroup, {
|
|
489
|
+
variant: "flush",
|
|
490
|
+
className: "cherita-list",
|
|
491
|
+
children: [/*#__PURE__*/_jsx(ListGroup.Item, {
|
|
492
|
+
className: "unstyled",
|
|
493
|
+
children: /*#__PURE__*/_jsx(ObsToolbar, {
|
|
494
|
+
item: obs,
|
|
495
|
+
onToggleAllObs: toggleAll
|
|
496
|
+
})
|
|
497
|
+
}), /*#__PURE__*/_jsx(VirtualizedList, {
|
|
498
|
+
getDataAtIndex: getDataAtIndex,
|
|
499
|
+
count: obs.values.length,
|
|
500
|
+
ItemComponent: CategoricalItem,
|
|
501
|
+
totalCounts: totalCounts,
|
|
502
|
+
min: min,
|
|
503
|
+
max: max,
|
|
504
|
+
onChange: toggleObs,
|
|
505
|
+
showColor: false,
|
|
506
|
+
estimateSize: i =>
|
|
507
|
+
// rough attempt to determine size based on label length
|
|
508
|
+
// estimate size of 68 pixels if label is long (>=20 chars if enabledHistograms, >=30 otherwise), else 42
|
|
509
|
+
// TODO: consider isSliced as count badge will be longer ?
|
|
510
|
+
getLabel(i).length >= (enabledHistograms ? 20 : 30) ? 68 : 42
|
|
511
|
+
})]
|
|
512
|
+
}), /*#__PURE__*/_jsx(ObsContinuousStats, {
|
|
513
|
+
obs: obs
|
|
514
|
+
})]
|
|
515
|
+
});
|
|
465
516
|
}
|