@haniffalab/cherita-react 1.3.0-dev.2025-06-04.d986a94b → 1.3.0-dev.2025-06-04.bee6fd81
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.
|
@@ -378,21 +378,23 @@ function ObsContinuousStats(_ref3) {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
// @TODO: add bin controls
|
|
381
|
-
// @TODO: add histogram
|
|
382
381
|
function ContinuousObs(_ref4) {
|
|
383
382
|
let {
|
|
384
383
|
obs,
|
|
385
384
|
toggleAll,
|
|
386
385
|
toggleObs
|
|
387
386
|
} = _ref4;
|
|
387
|
+
const settings = (0, _SettingsContext.useSettings)();
|
|
388
388
|
const {
|
|
389
389
|
isSliced
|
|
390
390
|
} = (0, _FilterContext.useFilteredData)();
|
|
391
391
|
const totalCounts = _lodash.default.sum(_lodash.default.values(obs.value_counts));
|
|
392
392
|
const min = _lodash.default.min(_lodash.default.values(obs.codes));
|
|
393
393
|
const max = _lodash.default.max(_lodash.default.values(obs.codes));
|
|
394
|
+
const obsHistograms = useObsHistogram(obs);
|
|
394
395
|
const filteredObsData = useFilteredObsData(obs);
|
|
395
|
-
const getDataAtIndex = index => {
|
|
396
|
+
const getDataAtIndex = (0, _react.useCallback)(index => {
|
|
397
|
+
var _obsHistograms$fetche2;
|
|
396
398
|
return {
|
|
397
399
|
value: obs.values[index],
|
|
398
400
|
code: obs.codes[obs.values[index]],
|
|
@@ -402,13 +404,21 @@ function ContinuousObs(_ref4) {
|
|
|
402
404
|
},
|
|
403
405
|
isOmitted: _lodash.default.includes(obs.omit, obs.codes[obs.values[index]]),
|
|
404
406
|
label: isNaN(obs.values[index]) ? "NaN" : getContinuousLabel(obs.codes[obs.values[index]], obs.bins.binEdges),
|
|
407
|
+
histogramData: settings.colorEncoding === _constants.COLOR_ENCODINGS.VAR ? {
|
|
408
|
+
data: (_obsHistograms$fetche2 = obsHistograms.fetchedData) === null || _obsHistograms$fetche2 === void 0 ? void 0 : _obsHistograms$fetche2[obs.values[index]],
|
|
409
|
+
isPending: obsHistograms.isPending,
|
|
410
|
+
altColor: isSliced
|
|
411
|
+
} : {
|
|
412
|
+
data: null,
|
|
413
|
+
isPending: false
|
|
414
|
+
},
|
|
405
415
|
filteredStats: {
|
|
406
416
|
value_counts: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts[obs.values[index]]) || 0,
|
|
407
417
|
pct: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct[obs.values[index]]) || 0
|
|
408
418
|
},
|
|
409
419
|
isSliced: isSliced
|
|
410
420
|
};
|
|
411
|
-
};
|
|
421
|
+
}, [filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, isSliced, obs.bins.binEdges, obs.codes, obs.omit, obs.value_counts, obs.values, obsHistograms.fetchedData, obsHistograms.isPending, settings.colorEncoding, totalCounts]);
|
|
412
422
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.ListGroup, {
|
|
413
423
|
variant: "flush",
|
|
414
424
|
className: "cherita-list"
|
|
@@ -425,7 +435,8 @@ function ContinuousObs(_ref4) {
|
|
|
425
435
|
min: min,
|
|
426
436
|
max: max,
|
|
427
437
|
onChange: toggleObs,
|
|
428
|
-
showColor: false
|
|
438
|
+
showColor: false,
|
|
439
|
+
estimateSize: 42
|
|
429
440
|
})), /*#__PURE__*/_react.default.createElement(ObsContinuousStats, {
|
|
430
441
|
obs: obs
|
|
431
442
|
}));
|
|
@@ -370,21 +370,23 @@ function ObsContinuousStats(_ref3) {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
// @TODO: add bin controls
|
|
373
|
-
// @TODO: add histogram
|
|
374
373
|
export function ContinuousObs(_ref4) {
|
|
375
374
|
let {
|
|
376
375
|
obs,
|
|
377
376
|
toggleAll,
|
|
378
377
|
toggleObs
|
|
379
378
|
} = _ref4;
|
|
379
|
+
const settings = useSettings();
|
|
380
380
|
const {
|
|
381
381
|
isSliced
|
|
382
382
|
} = useFilteredData();
|
|
383
383
|
const totalCounts = _.sum(_.values(obs.value_counts));
|
|
384
384
|
const min = _.min(_.values(obs.codes));
|
|
385
385
|
const max = _.max(_.values(obs.codes));
|
|
386
|
+
const obsHistograms = useObsHistogram(obs);
|
|
386
387
|
const filteredObsData = useFilteredObsData(obs);
|
|
387
|
-
const getDataAtIndex = index => {
|
|
388
|
+
const getDataAtIndex = useCallback(index => {
|
|
389
|
+
var _obsHistograms$fetche2;
|
|
388
390
|
return {
|
|
389
391
|
value: obs.values[index],
|
|
390
392
|
code: obs.codes[obs.values[index]],
|
|
@@ -394,13 +396,21 @@ export function ContinuousObs(_ref4) {
|
|
|
394
396
|
},
|
|
395
397
|
isOmitted: _.includes(obs.omit, obs.codes[obs.values[index]]),
|
|
396
398
|
label: isNaN(obs.values[index]) ? "NaN" : getContinuousLabel(obs.codes[obs.values[index]], obs.bins.binEdges),
|
|
399
|
+
histogramData: settings.colorEncoding === COLOR_ENCODINGS.VAR ? {
|
|
400
|
+
data: (_obsHistograms$fetche2 = obsHistograms.fetchedData) === null || _obsHistograms$fetche2 === void 0 ? void 0 : _obsHistograms$fetche2[obs.values[index]],
|
|
401
|
+
isPending: obsHistograms.isPending,
|
|
402
|
+
altColor: isSliced
|
|
403
|
+
} : {
|
|
404
|
+
data: null,
|
|
405
|
+
isPending: false
|
|
406
|
+
},
|
|
397
407
|
filteredStats: {
|
|
398
408
|
value_counts: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts[obs.values[index]]) || 0,
|
|
399
409
|
pct: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct[obs.values[index]]) || 0
|
|
400
410
|
},
|
|
401
411
|
isSliced: isSliced
|
|
402
412
|
};
|
|
403
|
-
};
|
|
413
|
+
}, [filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, isSliced, obs.bins.binEdges, obs.codes, obs.omit, obs.value_counts, obs.values, obsHistograms.fetchedData, obsHistograms.isPending, settings.colorEncoding, totalCounts]);
|
|
404
414
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListGroup, {
|
|
405
415
|
variant: "flush",
|
|
406
416
|
className: "cherita-list"
|
|
@@ -417,7 +427,8 @@ export function ContinuousObs(_ref4) {
|
|
|
417
427
|
min: min,
|
|
418
428
|
max: max,
|
|
419
429
|
onChange: toggleObs,
|
|
420
|
-
showColor: false
|
|
430
|
+
showColor: false,
|
|
431
|
+
estimateSize: 42
|
|
421
432
|
})), /*#__PURE__*/React.createElement(ObsContinuousStats, {
|
|
422
433
|
obs: obs
|
|
423
434
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haniffalab/cherita-react",
|
|
3
|
-
"version": "1.3.0-dev.2025-06-04.
|
|
3
|
+
"version": "1.3.0-dev.2025-06-04.bee6fd81",
|
|
4
4
|
"author": "Haniffa Lab",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"url": "https://github.com/haniffalab/cherita-react/issues"
|
|
127
127
|
},
|
|
128
128
|
"homepage": "https://github.com/haniffalab/cherita-react#readme",
|
|
129
|
-
"prereleaseSha": "
|
|
129
|
+
"prereleaseSha": "bee6fd816597b2a731ce2565b16db2d9fa63bb06"
|
|
130
130
|
}
|