@haniffalab/cherita-react 1.3.0-dev.2025-06-06.9f7ff5ad → 1.3.0-dev.2025-06-06.c0b05a89
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/dist/cjs/components/obs-list/ObsItem.js +11 -4
- package/dist/cjs/components/scatterplot/Scatterplot.js +12 -5
- package/dist/cjs/context/DatasetContext.js +2 -1
- package/dist/esm/components/obs-list/ObsItem.js +11 -4
- package/dist/esm/components/scatterplot/Scatterplot.js +12 -5
- package/dist/esm/context/DatasetContext.js +2 -1
- package/package.json +2 -2
|
@@ -155,8 +155,12 @@ function CategoricalItem(_ref) {
|
|
|
155
155
|
pct: null
|
|
156
156
|
},
|
|
157
157
|
isSliced,
|
|
158
|
+
colors = null,
|
|
158
159
|
showColor = true
|
|
159
160
|
} = _ref;
|
|
161
|
+
const {
|
|
162
|
+
useUnsColors
|
|
163
|
+
} = (0, _DatasetContext.useDataset)();
|
|
160
164
|
const {
|
|
161
165
|
getColor
|
|
162
166
|
} = (0, _colorHelper.useColor)();
|
|
@@ -241,7 +245,7 @@ function CategoricalItem(_ref) {
|
|
|
241
245
|
y: "0",
|
|
242
246
|
width: "10",
|
|
243
247
|
height: "10",
|
|
244
|
-
fill: "rgb(".concat(getColor({
|
|
248
|
+
fill: "rgb(".concat(getColor(_objectSpread({
|
|
245
249
|
value: (code - min) / (max - min),
|
|
246
250
|
categorical: true,
|
|
247
251
|
grayOut: isOmitted,
|
|
@@ -249,7 +253,9 @@ function CategoricalItem(_ref) {
|
|
|
249
253
|
alpha: 1
|
|
250
254
|
},
|
|
251
255
|
colorEncoding: "obs"
|
|
252
|
-
}
|
|
256
|
+
}, useUnsColors ? {
|
|
257
|
+
colorscale: colors
|
|
258
|
+
} : {})), ")")
|
|
253
259
|
}))) : null))));
|
|
254
260
|
}
|
|
255
261
|
function CategoricalObs(_ref2) {
|
|
@@ -291,9 +297,10 @@ function CategoricalObs(_ref2) {
|
|
|
291
297
|
value_counts: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts[obs.values[index]]) || 0,
|
|
292
298
|
pct: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct[obs.values[index]]) || 0
|
|
293
299
|
},
|
|
294
|
-
isSliced: isSliced
|
|
300
|
+
isSliced: isSliced,
|
|
301
|
+
colors: obs.colors
|
|
295
302
|
};
|
|
296
|
-
}, [settings.colorEncoding, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.
|
|
303
|
+
}, [obs.values, obs.codes, obs.value_counts, obs.omit, obs.colors, totalCounts, settings.colorEncoding, obsHistograms.fetchedData, obsHistograms.isPending, isSliced, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct]);
|
|
297
304
|
showColor &= settings.colorEncoding === _constants.COLOR_ENCODINGS.OBS;
|
|
298
305
|
return /*#__PURE__*/_react.default.createElement(_reactBootstrap.ListGroup, {
|
|
299
306
|
variant: "flush",
|
|
@@ -16,6 +16,7 @@ var _reactBootstrap = require("react-bootstrap");
|
|
|
16
16
|
var _SpatialControls = require("./SpatialControls");
|
|
17
17
|
var _Toolbox = require("./Toolbox");
|
|
18
18
|
var _constants = require("../../constants/constants");
|
|
19
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
19
20
|
var _FilterContext = require("../../context/FilterContext");
|
|
20
21
|
var _SettingsContext = require("../../context/SettingsContext");
|
|
21
22
|
var _ZarrDataContext = require("../../context/ZarrDataContext");
|
|
@@ -42,13 +43,16 @@ const INITIAL_VIEW_STATE = {
|
|
|
42
43
|
bearing: 0
|
|
43
44
|
};
|
|
44
45
|
function Scatterplot(_ref) {
|
|
45
|
-
var _settings$selectedObs2, _settings$selectedObs5, _features$features2, _obsmData$serverError, _xData$serverError, _obsData$serverError, _labelObsData$serverE, _settings$selectedVar, _settings$
|
|
46
|
+
var _settings$selectedObs2, _settings$selectedObs5, _settings$selectedObs8, _features$features2, _obsmData$serverError, _xData$serverError, _obsData$serverError, _labelObsData$serverE, _settings$selectedVar, _settings$selectedObs9, _data$positions;
|
|
46
47
|
let {
|
|
47
48
|
radius = null,
|
|
48
49
|
setShowObs,
|
|
49
50
|
setShowVars,
|
|
50
51
|
isFullscreen = false
|
|
51
52
|
} = _ref;
|
|
53
|
+
const {
|
|
54
|
+
useUnsColors
|
|
55
|
+
} = (0, _DatasetContext.useDataset)();
|
|
52
56
|
const settings = (0, _SettingsContext.useSettings)();
|
|
53
57
|
const {
|
|
54
58
|
obsIndices,
|
|
@@ -207,16 +211,19 @@ function Scatterplot(_ref) {
|
|
|
207
211
|
max: settings.controls.range[1] * (valueMax - valueMin) + valueMin
|
|
208
212
|
};
|
|
209
213
|
const getFillColor = (0, _react.useCallback)((_d, _ref2) => {
|
|
214
|
+
var _settings$selectedObs6, _settings$selectedObs7;
|
|
210
215
|
let {
|
|
211
216
|
index
|
|
212
217
|
} = _ref2;
|
|
213
218
|
const grayOut = isPending || sortedObsIndices && !sortedObsIndices.has(index);
|
|
214
|
-
return getColor({
|
|
219
|
+
return getColor(_objectSpread({
|
|
215
220
|
value: (sortedData.values[index] - min) / (max - min),
|
|
216
221
|
categorical: isCategorical,
|
|
217
222
|
grayOut: grayOut
|
|
218
|
-
})
|
|
219
|
-
|
|
223
|
+
}, useUnsColors && settings.colorEncoding === _constants.COLOR_ENCODINGS.OBS && (_settings$selectedObs6 = settings.selectedObs) !== null && _settings$selectedObs6 !== void 0 && _settings$selectedObs6.colors ? {
|
|
224
|
+
colorscale: (_settings$selectedObs7 = settings.selectedObs) === null || _settings$selectedObs7 === void 0 ? void 0 : _settings$selectedObs7.colors
|
|
225
|
+
} : {})) || [0, 0, 0, 100];
|
|
226
|
+
}, [isPending, sortedObsIndices, getColor, sortedData.values, min, max, isCategorical, useUnsColors, settings.colorEncoding, (_settings$selectedObs8 = settings.selectedObs) === null || _settings$selectedObs8 === void 0 ? void 0 : _settings$selectedObs8.colors]);
|
|
220
227
|
|
|
221
228
|
// @TODO: add support for pseudospatial hover to reflect in radius
|
|
222
229
|
const getRadius = (0, _react.useCallback)((_d, _ref3) => {
|
|
@@ -396,7 +403,7 @@ function Scatterplot(_ref) {
|
|
|
396
403
|
}, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
|
|
397
404
|
icon: _freeSolidSvgIcons.faTriangleExclamation
|
|
398
405
|
}), "\xA0Error loading data"), /*#__PURE__*/_react.default.createElement(_Toolbox.Toolbox, {
|
|
399
|
-
mode: settings.colorEncoding === _constants.COLOR_ENCODINGS.VAR ? (_settings$selectedVar = settings.selectedVar) === null || _settings$selectedVar === void 0 ? void 0 : _settings$selectedVar.name : settings.colorEncoding === _constants.COLOR_ENCODINGS.OBS ? (_settings$
|
|
406
|
+
mode: settings.colorEncoding === _constants.COLOR_ENCODINGS.VAR ? (_settings$selectedVar = settings.selectedVar) === null || _settings$selectedVar === void 0 ? void 0 : _settings$selectedVar.name : settings.colorEncoding === _constants.COLOR_ENCODINGS.OBS ? (_settings$selectedObs9 = settings.selectedObs) === null || _settings$selectedObs9 === void 0 ? void 0 : _settings$selectedObs9.name : null,
|
|
400
407
|
obsLength: parseInt((_data$positions = data.positions) === null || _data$positions === void 0 ? void 0 : _data$positions.length),
|
|
401
408
|
slicedLength: parseInt(slicedLength)
|
|
402
409
|
})), /*#__PURE__*/_react.default.createElement(_Legend.Legend, {
|
|
@@ -147,8 +147,12 @@ function CategoricalItem(_ref) {
|
|
|
147
147
|
pct: null
|
|
148
148
|
},
|
|
149
149
|
isSliced,
|
|
150
|
+
colors = null,
|
|
150
151
|
showColor = true
|
|
151
152
|
} = _ref;
|
|
153
|
+
const {
|
|
154
|
+
useUnsColors
|
|
155
|
+
} = useDataset();
|
|
152
156
|
const {
|
|
153
157
|
getColor
|
|
154
158
|
} = useColor();
|
|
@@ -233,7 +237,7 @@ function CategoricalItem(_ref) {
|
|
|
233
237
|
y: "0",
|
|
234
238
|
width: "10",
|
|
235
239
|
height: "10",
|
|
236
|
-
fill: "rgb(".concat(getColor({
|
|
240
|
+
fill: "rgb(".concat(getColor(_objectSpread({
|
|
237
241
|
value: (code - min) / (max - min),
|
|
238
242
|
categorical: true,
|
|
239
243
|
grayOut: isOmitted,
|
|
@@ -241,7 +245,9 @@ function CategoricalItem(_ref) {
|
|
|
241
245
|
alpha: 1
|
|
242
246
|
},
|
|
243
247
|
colorEncoding: "obs"
|
|
244
|
-
}
|
|
248
|
+
}, useUnsColors ? {
|
|
249
|
+
colorscale: colors
|
|
250
|
+
} : {})), ")")
|
|
245
251
|
}))) : null))));
|
|
246
252
|
}
|
|
247
253
|
export function CategoricalObs(_ref2) {
|
|
@@ -283,9 +289,10 @@ export function CategoricalObs(_ref2) {
|
|
|
283
289
|
value_counts: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts[obs.values[index]]) || 0,
|
|
284
290
|
pct: (filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct[obs.values[index]]) || 0
|
|
285
291
|
},
|
|
286
|
-
isSliced: isSliced
|
|
292
|
+
isSliced: isSliced,
|
|
293
|
+
colors: obs.colors
|
|
287
294
|
};
|
|
288
|
-
}, [settings.colorEncoding, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.
|
|
295
|
+
}, [obs.values, obs.codes, obs.value_counts, obs.omit, obs.colors, totalCounts, settings.colorEncoding, obsHistograms.fetchedData, obsHistograms.isPending, isSliced, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.value_counts, filteredObsData === null || filteredObsData === void 0 ? void 0 : filteredObsData.pct]);
|
|
289
296
|
showColor &= settings.colorEncoding === COLOR_ENCODINGS.OBS;
|
|
290
297
|
return /*#__PURE__*/React.createElement(ListGroup, {
|
|
291
298
|
variant: "flush",
|
|
@@ -15,6 +15,7 @@ import { Alert } from "react-bootstrap";
|
|
|
15
15
|
import { SpatialControls } from "./SpatialControls";
|
|
16
16
|
import { Toolbox } from "./Toolbox";
|
|
17
17
|
import { COLOR_ENCODINGS, OBS_TYPES, SELECTED_POLYGON_FILLCOLOR, UNSELECTED_POLYGON_FILLCOLOR } from "../../constants/constants";
|
|
18
|
+
import { useDataset } from "../../context/DatasetContext";
|
|
18
19
|
import { useFilteredData } from "../../context/FilterContext";
|
|
19
20
|
import { useSettings, useSettingsDispatch } from "../../context/SettingsContext";
|
|
20
21
|
import { useZarrData } from "../../context/ZarrDataContext";
|
|
@@ -34,13 +35,16 @@ const INITIAL_VIEW_STATE = {
|
|
|
34
35
|
bearing: 0
|
|
35
36
|
};
|
|
36
37
|
export function Scatterplot(_ref) {
|
|
37
|
-
var _settings$selectedObs2, _settings$selectedObs5, _features$features2, _obsmData$serverError, _xData$serverError, _obsData$serverError, _labelObsData$serverE, _settings$selectedVar, _settings$
|
|
38
|
+
var _settings$selectedObs2, _settings$selectedObs5, _settings$selectedObs8, _features$features2, _obsmData$serverError, _xData$serverError, _obsData$serverError, _labelObsData$serverE, _settings$selectedVar, _settings$selectedObs9, _data$positions;
|
|
38
39
|
let {
|
|
39
40
|
radius = null,
|
|
40
41
|
setShowObs,
|
|
41
42
|
setShowVars,
|
|
42
43
|
isFullscreen = false
|
|
43
44
|
} = _ref;
|
|
45
|
+
const {
|
|
46
|
+
useUnsColors
|
|
47
|
+
} = useDataset();
|
|
44
48
|
const settings = useSettings();
|
|
45
49
|
const {
|
|
46
50
|
obsIndices,
|
|
@@ -199,16 +203,19 @@ export function Scatterplot(_ref) {
|
|
|
199
203
|
max: settings.controls.range[1] * (valueMax - valueMin) + valueMin
|
|
200
204
|
};
|
|
201
205
|
const getFillColor = useCallback((_d, _ref2) => {
|
|
206
|
+
var _settings$selectedObs6, _settings$selectedObs7;
|
|
202
207
|
let {
|
|
203
208
|
index
|
|
204
209
|
} = _ref2;
|
|
205
210
|
const grayOut = isPending || sortedObsIndices && !sortedObsIndices.has(index);
|
|
206
|
-
return getColor({
|
|
211
|
+
return getColor(_objectSpread({
|
|
207
212
|
value: (sortedData.values[index] - min) / (max - min),
|
|
208
213
|
categorical: isCategorical,
|
|
209
214
|
grayOut: grayOut
|
|
210
|
-
})
|
|
211
|
-
|
|
215
|
+
}, useUnsColors && settings.colorEncoding === COLOR_ENCODINGS.OBS && (_settings$selectedObs6 = settings.selectedObs) !== null && _settings$selectedObs6 !== void 0 && _settings$selectedObs6.colors ? {
|
|
216
|
+
colorscale: (_settings$selectedObs7 = settings.selectedObs) === null || _settings$selectedObs7 === void 0 ? void 0 : _settings$selectedObs7.colors
|
|
217
|
+
} : {})) || [0, 0, 0, 100];
|
|
218
|
+
}, [isPending, sortedObsIndices, getColor, sortedData.values, min, max, isCategorical, useUnsColors, settings.colorEncoding, (_settings$selectedObs8 = settings.selectedObs) === null || _settings$selectedObs8 === void 0 ? void 0 : _settings$selectedObs8.colors]);
|
|
212
219
|
|
|
213
220
|
// @TODO: add support for pseudospatial hover to reflect in radius
|
|
214
221
|
const getRadius = useCallback((_d, _ref3) => {
|
|
@@ -388,7 +395,7 @@ export function Scatterplot(_ref) {
|
|
|
388
395
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
389
396
|
icon: faTriangleExclamation
|
|
390
397
|
}), "\xA0Error loading data"), /*#__PURE__*/React.createElement(Toolbox, {
|
|
391
|
-
mode: settings.colorEncoding === COLOR_ENCODINGS.VAR ? (_settings$selectedVar = settings.selectedVar) === null || _settings$selectedVar === void 0 ? void 0 : _settings$selectedVar.name : settings.colorEncoding === COLOR_ENCODINGS.OBS ? (_settings$
|
|
398
|
+
mode: settings.colorEncoding === COLOR_ENCODINGS.VAR ? (_settings$selectedVar = settings.selectedVar) === null || _settings$selectedVar === void 0 ? void 0 : _settings$selectedVar.name : settings.colorEncoding === COLOR_ENCODINGS.OBS ? (_settings$selectedObs9 = settings.selectedObs) === null || _settings$selectedObs9 === void 0 ? void 0 : _settings$selectedObs9.name : null,
|
|
392
399
|
obsLength: parseInt((_data$positions = data.positions) === null || _data$positions === void 0 ? void 0 : _data$positions.length),
|
|
393
400
|
slicedLength: parseInt(slicedLength)
|
|
394
401
|
})), /*#__PURE__*/React.createElement(Legend, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haniffalab/cherita-react",
|
|
3
|
-
"version": "1.3.0-dev.2025-06-06.
|
|
3
|
+
"version": "1.3.0-dev.2025-06-06.c0b05a89",
|
|
4
4
|
"author": "Haniffa Lab",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"url": "https://github.com/haniffalab/cherita-react/issues"
|
|
128
128
|
},
|
|
129
129
|
"homepage": "https://github.com/haniffalab/cherita-react#readme",
|
|
130
|
-
"prereleaseSha": "
|
|
130
|
+
"prereleaseSha": "c0b05a895b3e582b1719870cbd23b084095c36de"
|
|
131
131
|
}
|