@genspectrum/dashboard-components 0.5.1 → 0.5.2

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.
@@ -5336,34 +5336,33 @@ function sortNullToBeginningThenByDate(a2, b3) {
5336
5336
  return a2.dateRange === null ? -1 : b3.dateRange === null ? 1 : a2.dateRange.toString().localeCompare(b3.dateRange.toString());
5337
5337
  }
5338
5338
  const getDataset$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod) => {
5339
- const generalConfig = {
5339
+ return {
5340
5340
  borderWidth: 1,
5341
5341
  pointRadius: 0,
5342
5342
  label: prevalenceOverTimeVariant.displayName,
5343
5343
  backgroundColor: singleGraphColorRGBAById(index, 0.3),
5344
- borderColor: singleGraphColorRGBAById(index)
5344
+ borderColor: singleGraphColorRGBAById(index),
5345
+ data: prevalenceOverTimeVariant.content.map(mapDataPoint(confidenceIntervalMethod))
5346
+ };
5347
+ };
5348
+ const mapDataPoint = (confidenceIntervalMethod) => {
5349
+ return (dataPoint) => {
5350
+ var _a;
5351
+ const confidenceInterval = getConfidenceInterval(dataPoint, confidenceIntervalMethod);
5352
+ return {
5353
+ y: dataPoint.prevalence,
5354
+ yMin: confidenceInterval.lowerLimit,
5355
+ yMax: confidenceInterval.upperLimit,
5356
+ x: ((_a = dataPoint.dateRange) == null ? void 0 : _a.toString()) ?? "Unknown"
5357
+ };
5345
5358
  };
5359
+ };
5360
+ const getConfidenceInterval = (dataPoint, confidenceIntervalMethod) => {
5346
5361
  switch (confidenceIntervalMethod) {
5347
5362
  case "wilson":
5348
- return {
5349
- ...generalConfig,
5350
- data: prevalenceOverTimeVariant.content.map((dataPoint) => {
5351
- var _a;
5352
- return {
5353
- y: dataPoint.prevalence,
5354
- yMin: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
5355
- yMax: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
5356
- x: ((_a = dataPoint.dateRange) == null ? void 0 : _a.toString()) ?? "Unknown"
5357
- };
5358
- })
5359
- };
5363
+ return wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total);
5360
5364
  default:
5361
- return {
5362
- ...generalConfig,
5363
- data: prevalenceOverTimeVariant.content.map((dataPoint) => {
5364
- return { y: dataPoint.prevalence, x: dataPoint.dateRange };
5365
- })
5366
- };
5365
+ return { lowerLimit: void 0, upperLimit: void 0 };
5367
5366
  }
5368
5367
  };
5369
5368
  const tooltip$2 = (confidenceIntervalMethod) => {