datastake-daf 0.6.817 → 0.6.818

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.
@@ -19302,17 +19302,10 @@ function VegetationWidget(_ref) {
19302
19302
  } = _ref,
19303
19303
  props = _objectWithoutProperties(_ref, _excluded$n);
19304
19304
  let vegetationConfig = getVegetationConfig();
19305
-
19306
- // Get all VEGETATION_KEYS values before filtering (needed for mapping check)
19307
19305
  const allVegetationKeys = vegetationConfig.map(item => item.key);
19308
-
19309
- // Filter to show only specific keys if filterKeys is provided
19310
19306
  if (filterKeys && Array.isArray(filterKeys)) {
19311
19307
  vegetationConfig = vegetationConfig.filter(item => filterKeys.includes(item.key));
19312
19308
  }
19313
-
19314
- // Map growthObservations to VEGETATION_KEYS
19315
- // Handle both formats: growthObservations keys (e.g., "yellowing_leaves") and VEGETATION_KEYS (e.g., "yellowing")
19316
19309
  const mappedGrowthObservations = Array.isArray(growthObservations) ? growthObservations.map(obs => {
19317
19310
  // First try to map from growthObservations format
19318
19311
  const mapped = GROWTH_OBSERVATIONS_TO_VEGETATION_KEYS[obs];
@@ -47901,7 +47894,7 @@ function AvatarGroup(_ref) {
47901
47894
 
47902
47895
  const Container$1 = styled__default["default"].div`
47903
47896
  height: ${props => props.height || '300px'};
47904
- width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
47897
+ width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
47905
47898
  `;
47906
47899
 
47907
47900
  const _excluded$9 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
@@ -49444,6 +49437,45 @@ const RadarChart = _ref => {
49444
49437
  legendConfig,
49445
49438
  isPdf
49446
49439
  });
49440
+
49441
+ // Helper function to wrap long text labels to multiple lines
49442
+ // Ensures text is never hidden - wraps to multiple lines if needed
49443
+ const wrapLabel = React.useCallback(function (text) {
49444
+ let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
49445
+ if (!text) {
49446
+ return '';
49447
+ }
49448
+ const formattedText = formattedXAxis(text);
49449
+
49450
+ // If text is short enough, return as is
49451
+ if (formattedText.length <= maxLength) {
49452
+ return formattedText;
49453
+ }
49454
+
49455
+ // Split by spaces to find word boundaries
49456
+ const words = formattedText.split(' ');
49457
+ const lines = [];
49458
+ let currentLine = '';
49459
+ words.forEach((word, index) => {
49460
+ // If adding this word would exceed maxLength, start a new line
49461
+ if (currentLine && (currentLine + ' ' + word).length > maxLength) {
49462
+ if (currentLine) {
49463
+ lines.push(currentLine);
49464
+ }
49465
+ currentLine = word;
49466
+ } else {
49467
+ currentLine = currentLine ? currentLine + ' ' + word : word;
49468
+ }
49469
+
49470
+ // If it's the last word, add it to lines
49471
+ if (index === words.length - 1 && currentLine) {
49472
+ lines.push(currentLine);
49473
+ }
49474
+ });
49475
+
49476
+ // Ensure we always return something - never empty
49477
+ return lines.length > 0 ? lines.join('\n') : formattedText;
49478
+ }, [formattedXAxis]);
49447
49479
  React.useEffect(() => {
49448
49480
  if (!containerRef.current) {
49449
49481
  return;
@@ -49462,9 +49494,21 @@ const RadarChart = _ref => {
49462
49494
  showMarkers: true
49463
49495
  }, tooltipConfig),
49464
49496
  color: color || token.colorPrimary7,
49497
+ // Increased padding to ensure labels are never clipped
49498
+ padding: [50, 50, 50, 50],
49465
49499
  xAxis: {
49466
49500
  label: {
49467
- formatter: formattedXAxis
49501
+ formatter: text => wrapLabel(text, 10),
49502
+ offset: 15,
49503
+ autoRotate: false,
49504
+ autoHide: false,
49505
+ // Never hide labels
49506
+ autoEllipsis: false,
49507
+ // Never truncate with ellipsis
49508
+ style: {
49509
+ fontSize: 12,
49510
+ fill: '#666'
49511
+ }
49468
49512
  },
49469
49513
  line: null,
49470
49514
  tickLine: null,
@@ -49519,7 +49563,7 @@ const RadarChart = _ref => {
49519
49563
  } else {
49520
49564
  chartRef.current.update(chartConfig);
49521
49565
  }
49522
- }, [data, xFieldKey, yFieldKey, seriesField, renderTooltipContent, tooltipConfig, animated, color, formattedYAxis, formattedXAxis, score, token.colorPrimary7, rest]);
49566
+ }, [data, xFieldKey, yFieldKey, seriesField, renderTooltipContent, tooltipConfig, animated, color, formattedYAxis, formattedXAxis, score, token.colorPrimary7, wrapLabel, rest]);
49523
49567
  React.useEffect(() => {
49524
49568
  return () => {
49525
49569
  if (chartRef.current) {
@@ -12768,7 +12768,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12768
12768
 
12769
12769
  const Container$1 = styled__default["default"].div`
12770
12770
  height: ${props => props.height || '300px'};
12771
- width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
12771
+ width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
12772
12772
  `;
12773
12773
 
12774
12774
  const useLegendConfig = ({
@@ -49812,17 +49812,10 @@ function VegetationWidget({
49812
49812
  ...props
49813
49813
  }) {
49814
49814
  let vegetationConfig = getVegetationConfig();
49815
-
49816
- // Get all VEGETATION_KEYS values before filtering (needed for mapping check)
49817
49815
  const allVegetationKeys = vegetationConfig.map(item => item.key);
49818
-
49819
- // Filter to show only specific keys if filterKeys is provided
49820
49816
  if (filterKeys && Array.isArray(filterKeys)) {
49821
49817
  vegetationConfig = vegetationConfig.filter(item => filterKeys.includes(item.key));
49822
49818
  }
49823
-
49824
- // Map growthObservations to VEGETATION_KEYS
49825
- // Handle both formats: growthObservations keys (e.g., "yellowing_leaves") and VEGETATION_KEYS (e.g., "yellowing")
49826
49819
  const mappedGrowthObservations = Array.isArray(growthObservations) ? growthObservations.map(obs => {
49827
49820
  // First try to map from growthObservations format
49828
49821
  const mapped = GROWTH_OBSERVATIONS_TO_VEGETATION_KEYS[obs];
@@ -52300,6 +52293,44 @@ const RadarChart = ({
52300
52293
  legendConfig,
52301
52294
  isPdf
52302
52295
  });
52296
+
52297
+ // Helper function to wrap long text labels to multiple lines
52298
+ // Ensures text is never hidden - wraps to multiple lines if needed
52299
+ const wrapLabel = React.useCallback((text, maxLength = 10) => {
52300
+ if (!text) {
52301
+ return '';
52302
+ }
52303
+ const formattedText = formattedXAxis(text);
52304
+
52305
+ // If text is short enough, return as is
52306
+ if (formattedText.length <= maxLength) {
52307
+ return formattedText;
52308
+ }
52309
+
52310
+ // Split by spaces to find word boundaries
52311
+ const words = formattedText.split(' ');
52312
+ const lines = [];
52313
+ let currentLine = '';
52314
+ words.forEach((word, index) => {
52315
+ // If adding this word would exceed maxLength, start a new line
52316
+ if (currentLine && (currentLine + ' ' + word).length > maxLength) {
52317
+ if (currentLine) {
52318
+ lines.push(currentLine);
52319
+ }
52320
+ currentLine = word;
52321
+ } else {
52322
+ currentLine = currentLine ? currentLine + ' ' + word : word;
52323
+ }
52324
+
52325
+ // If it's the last word, add it to lines
52326
+ if (index === words.length - 1 && currentLine) {
52327
+ lines.push(currentLine);
52328
+ }
52329
+ });
52330
+
52331
+ // Ensure we always return something - never empty
52332
+ return lines.length > 0 ? lines.join('\n') : formattedText;
52333
+ }, [formattedXAxis]);
52303
52334
  React.useEffect(() => {
52304
52335
  if (!containerRef.current) {
52305
52336
  return;
@@ -52320,9 +52351,21 @@ const RadarChart = ({
52320
52351
  ...tooltipConfig
52321
52352
  },
52322
52353
  color: color || token.colorPrimary7,
52354
+ // Increased padding to ensure labels are never clipped
52355
+ padding: [50, 50, 50, 50],
52323
52356
  xAxis: {
52324
52357
  label: {
52325
- formatter: formattedXAxis
52358
+ formatter: text => wrapLabel(text, 10),
52359
+ offset: 15,
52360
+ autoRotate: false,
52361
+ autoHide: false,
52362
+ // Never hide labels
52363
+ autoEllipsis: false,
52364
+ // Never truncate with ellipsis
52365
+ style: {
52366
+ fontSize: 12,
52367
+ fill: '#666'
52368
+ }
52326
52369
  },
52327
52370
  line: null,
52328
52371
  tickLine: null,
@@ -52380,7 +52423,7 @@ const RadarChart = ({
52380
52423
  } else {
52381
52424
  chartRef.current.update(chartConfig);
52382
52425
  }
52383
- }, [data, xFieldKey, yFieldKey, seriesField, renderTooltipContent, tooltipConfig, animated, color, formattedYAxis, formattedXAxis, score, token.colorPrimary7, rest]);
52426
+ }, [data, xFieldKey, yFieldKey, seriesField, renderTooltipContent, tooltipConfig, animated, color, formattedYAxis, formattedXAxis, score, token.colorPrimary7, wrapLabel, rest]);
52384
52427
  React.useEffect(() => {
52385
52428
  return () => {
52386
52429
  if (chartRef.current) {
@@ -57706,7 +57749,20 @@ const MonitoringScopeAndFindings = ({
57706
57749
  });
57707
57750
  };
57708
57751
 
57709
- const COLORS$3 = ['#016C6E', '#F5C2AC', '#F0A888', '#DF571E', '#C04B19', '#9B3D14', '#7A2F0F'];
57752
+ const VEGETATION_HEALTH_COLORS = {
57753
+ healthy_leaves: '#6AD99E',
57754
+ white_spots: '#E8F0F0',
57755
+ yellowing_leaves: '#CDC14F',
57756
+ black_spots: '#2E3131',
57757
+ reddish_spots: '#CB2525',
57758
+ leaf_mosaic: '#B59E76',
57759
+ spider_webs: '#F8F6EF',
57760
+ damage_from_insects: '#DE8954',
57761
+ dry_dead_leaves: '#767870',
57762
+ no_leaves: '#F97066',
57763
+ other: '#BDBDBD'
57764
+ };
57765
+ const DEFAULT_COLOR$3 = '#9E9E9E';
57710
57766
  const VegetationHealth = ({
57711
57767
  vegetationHealthChart,
57712
57768
  t = s => s,
@@ -57727,7 +57783,7 @@ const VegetationHealth = ({
57727
57783
  return data.map((item, index) => ({
57728
57784
  value: Number(item?.count) || 0,
57729
57785
  percent: total > 0 ? (Number(item?.count) || 0) / total : 0,
57730
- color: COLORS$3[index % COLORS$3.length],
57786
+ color: VEGETATION_HEALTH_COLORS[item?.name] || DEFAULT_COLOR$3,
57731
57787
  label: optionsMap[item?.name] || item?.name || '',
57732
57788
  key: item?.name || `item-${index}`
57733
57789
  }));
@@ -57825,6 +57881,80 @@ const calculateNiceAxisConfig = (data, valueField = 'value', multiplier = 1.2, d
57825
57881
  };
57826
57882
  };
57827
57883
 
57884
+ /**
57885
+ * Calculate y-axis configuration with natural numbers (integers) only
57886
+ * Always starts from 0 and extends slightly above max for better visualization
57887
+ * @param {number} maxValue - Maximum value from the data
57888
+ * @param {Object} options - Optional configuration
57889
+ * @param {number} options.minTicks - Minimum number of ticks to show (default: 4)
57890
+ * @param {number} options.maxTicks - Maximum number of ticks to show (default: 6)
57891
+ * @returns {Object} Axis configuration with min, max, and tickMethod
57892
+ */
57893
+ const calculateNaturalAxisConfig = (maxValue, options = {}) => {
57894
+ const {
57895
+ minTicks = 4,
57896
+ maxTicks = 6
57897
+ } = options;
57898
+ if (maxValue <= 0) {
57899
+ return {
57900
+ min: 0,
57901
+ max: 4,
57902
+ tickMethod: () => [0, 1, 2, 3, 4]
57903
+ };
57904
+ }
57905
+
57906
+ // For very small values (max <= 1), always show 0, 1, 2, 3, 4
57907
+ if (maxValue <= 1) {
57908
+ return {
57909
+ min: 0,
57910
+ max: 4,
57911
+ tickMethod: () => [0, 1, 2, 3, 4]
57912
+ };
57913
+ }
57914
+
57915
+ // Calculate appropriate step size based on max value
57916
+ let step = 1;
57917
+ let displayMax = maxValue;
57918
+ if (maxValue <= 5) {
57919
+ // For small values, use step of 1 and extend a bit above
57920
+ step = 1;
57921
+ displayMax = Math.max(5, Math.ceil(maxValue * 1.5));
57922
+ } else if (maxValue <= 10) {
57923
+ // For medium-small values, use step of 2
57924
+ step = 2;
57925
+ displayMax = Math.ceil(maxValue * 1.2 / step) * step;
57926
+ } else if (maxValue <= 20) {
57927
+ // For medium values, use step of 5
57928
+ step = 5;
57929
+ displayMax = Math.ceil(maxValue * 1.2 / step) * step;
57930
+ } else if (maxValue <= 50) {
57931
+ // For larger values, use step of 10
57932
+ step = 10;
57933
+ displayMax = Math.ceil(maxValue * 1.2 / step) * step;
57934
+ } else {
57935
+ // For very large values, calculate step to get 4-6 ticks
57936
+ const targetTicks = Math.min(maxTicks, Math.max(minTicks, Math.ceil(maxValue / 20)));
57937
+ step = Math.ceil(maxValue / targetTicks / 10) * 10; // Round to nearest 10
57938
+ displayMax = Math.ceil(maxValue * 1.2 / step) * step;
57939
+ }
57940
+
57941
+ // Generate ticks from 0 to displayMax
57942
+ const ticks = [];
57943
+ for (let i = 0; i <= displayMax; i += step) {
57944
+ ticks.push(i);
57945
+ }
57946
+
57947
+ // Ensure max value is included if it's close
57948
+ if (ticks[ticks.length - 1] < maxValue && maxValue - ticks[ticks.length - 1] <= step / 2) {
57949
+ ticks.push(maxValue);
57950
+ }
57951
+ return {
57952
+ min: 0,
57953
+ max: displayMax,
57954
+ tickMethod: () => ticks
57955
+ };
57956
+ };
57957
+
57828
57958
  /**
57829
57959
  * Merge default categories with backend data
57830
57960
  * Ensures all categories are displayed even if they have no data
@@ -57880,13 +58010,11 @@ const SeedlingsHeight$1 = ({
57880
58010
  return mergeDefaultCategories(seedlingsHeightChart, DEFAULT_HEIGHT_RANGES, 'range', 'count', 'label', 'value');
57881
58011
  }, [seedlingsHeightChart]);
57882
58012
  const yAxisConfig = React.useMemo(() => {
57883
- return calculateNiceAxisConfig(chartData, 'value', 2,
57884
- // multiplier: double the max value
57885
- {
57886
- min: 0,
57887
- max: 20,
57888
- tickMethod: () => [0, 5, 10, 15, 20]
57889
- });
58013
+ // Calculate max value from data
58014
+ const maxValue = chartData && chartData.length > 0 ? Math.max(...chartData.map(item => Number(item?.value) || 0)) : 0;
58015
+
58016
+ // Use the helper function to calculate natural number axis configuration
58017
+ return calculateNaturalAxisConfig(maxValue);
57890
58018
  }, [chartData]);
57891
58019
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
57892
58020
  title: t("Seedlings Height"),
@@ -57908,9 +58036,9 @@ const SeedlingsHeight$1 = ({
57908
58036
  const item = data[0]?.data || data[0];
57909
58037
  return {
57910
58038
  title: t("Seedlings Height"),
57911
- subTitle: title,
57912
58039
  items: [{
57913
- label: t("Count"),
58040
+ color: "#016C6E",
58041
+ label: title,
57914
58042
  value: item?.value || 0
57915
58043
  }]
57916
58044
  };
@@ -57921,7 +58049,12 @@ const SeedlingsHeight$1 = ({
57921
58049
  });
57922
58050
  };
57923
58051
 
57924
- const COLORS$2 = ['#6AD99E', '#F5C2AC', '#F0A888', '#DF571E', '#C04B19', '#9B3D14', '#7A2F0F'];
58052
+ const PLANTED_SPECIES_COLORS = {
58053
+ rhyzophora_mangle: '#016C6E',
58054
+ rhyzophora: '#00AEB1',
58055
+ rhyzophora_sp: '#A0EBEC'
58056
+ };
58057
+ const DEFAULT_COLOR$2 = '#9E9E9E';
57925
58058
  const PlantedSpecies$1 = ({
57926
58059
  plantedSpeciesChart,
57927
58060
  t = s => s,
@@ -57942,7 +58075,7 @@ const PlantedSpecies$1 = ({
57942
58075
  return data.map((item, index) => ({
57943
58076
  value: Number(item?.count) || 0,
57944
58077
  percent: total > 0 ? (Number(item?.count) || 0) / total : 0,
57945
- color: COLORS$2[index % COLORS$2.length],
58078
+ color: PLANTED_SPECIES_COLORS[item?.name] || DEFAULT_COLOR$2,
57946
58079
  label: optionsMap[item?.name] || item?.name || '',
57947
58080
  key: item?.name || `item-${index}`
57948
58081
  }));
@@ -57954,15 +58087,22 @@ const PlantedSpecies$1 = ({
57954
58087
  if (isEmpty) {
57955
58088
  return null;
57956
58089
  }
58090
+
58091
+ // Calculate total from all items
58092
+ const total = pieData.reduce((sum, dataItem) => sum + (dataItem.value || 0), 0);
58093
+
58094
+ // Show all items in the tooltip, sorted by value (descending)
58095
+ const allItems = pieData.filter(dataItem => dataItem.value > 0).sort((a, b) => b.value - a.value).map(dataItem => ({
58096
+ color: dataItem.color,
58097
+ label: dataItem.label || '',
58098
+ value: dataItem.value || 0
58099
+ }));
57957
58100
  return renderTooltipJsx({
57958
58101
  title: t("Planted Species"),
57959
- items: [{
57960
- color: item.color,
57961
- label: item.label || '',
57962
- value: item.value || 0
57963
- }]
58102
+ subTitle: total.toLocaleString(),
58103
+ items: allItems
57964
58104
  });
57965
- }, [t, isEmpty]);
58105
+ }, [t, isEmpty, pieData]);
57966
58106
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
57967
58107
  title: t("Planted Species"),
57968
58108
  className: "with-border-header h-w-btn-header",
@@ -58227,13 +58367,8 @@ const ObservedFauna = ({
58227
58367
  }));
58228
58368
  }, [observedFaunaChart, options]);
58229
58369
  const xAxisConfig = React.useMemo(() => {
58230
- return calculateNiceAxisConfig(chartData, 'value', 1.2,
58231
- // multiplier: 20% padding
58232
- {
58233
- min: 0,
58234
- max: 10,
58235
- tickMethod: () => [0, 2, 4, 6, 8, 10]
58236
- });
58370
+ const maxValue = chartData && chartData.length > 0 ? Math.max(...chartData.map(item => Number(item?.value) || 0)) : 0;
58371
+ return calculateNaturalAxisConfig(maxValue);
58237
58372
  }, [chartData]);
58238
58373
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
58239
58374
  title: t("Observed Fauna"),
@@ -58416,21 +58551,29 @@ const BiodiversityHabitat = ({
58416
58551
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
58417
58552
  style: {
58418
58553
  display: "flex",
58419
- gap: "24px"
58554
+ gap: "24px",
58555
+ flexWrap: "wrap"
58420
58556
  },
58421
58557
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
58422
58558
  style: {
58423
- flex: 1
58559
+ flex: 1,
58560
+ minWidth: "300px"
58424
58561
  },
58425
58562
  children: /*#__PURE__*/jsxRuntime.jsx(ObservedFauna, {
58426
58563
  observedFaunaChart: observedFauna,
58427
58564
  t: t,
58428
58565
  options: options
58429
58566
  })
58430
- }), /*#__PURE__*/jsxRuntime.jsx(InvasiveSpecies, {
58431
- invasiveSpeciesChart: invasiveSpecies,
58432
- t: t,
58433
- options: options
58567
+ }), /*#__PURE__*/jsxRuntime.jsx("section", {
58568
+ style: {
58569
+ flex: 1,
58570
+ minWidth: "300px"
58571
+ },
58572
+ children: /*#__PURE__*/jsxRuntime.jsx(InvasiveSpecies, {
58573
+ invasiveSpeciesChart: invasiveSpecies,
58574
+ t: t,
58575
+ options: options
58576
+ })
58434
58577
  })]
58435
58578
  })]
58436
58579
  })
@@ -58503,7 +58646,13 @@ const Stats = ({
58503
58646
  });
58504
58647
  };
58505
58648
 
58506
- const COLORS$1 = ['#016C6E', '#4FB3A1', '#A8E6CF', '#FFD93D', '#F0A888', '#DF571E', '#C04B19'];
58649
+ const SOIL_TYPE_COLORS$1 = {
58650
+ sandy: '#00AEB1',
58651
+ mixed: '#016C6E',
58652
+ clay: '#A0EBEC',
58653
+ muddy: '#4FB3A1'
58654
+ };
58655
+ const DEFAULT_COLOR$1 = '#9E9E9E';
58507
58656
  const SoilType = ({
58508
58657
  soilTypeChart,
58509
58658
  t = s => s,
@@ -58524,7 +58673,7 @@ const SoilType = ({
58524
58673
  return data.map((item, index) => ({
58525
58674
  value: Number(item?.count) || 0,
58526
58675
  percent: total > 0 ? (Number(item?.count) || 0) / total : 0,
58527
- color: COLORS$1[index % COLORS$1.length],
58676
+ color: SOIL_TYPE_COLORS$1[item?.soilType] || DEFAULT_COLOR$1,
58528
58677
  label: optionsMap[item?.soilType] || item?.soilType || '',
58529
58678
  key: item?.soilType || `item-${index}`
58530
58679
  }));
@@ -58536,15 +58685,18 @@ const SoilType = ({
58536
58685
  if (isEmpty) {
58537
58686
  return null;
58538
58687
  }
58688
+
58689
+ // Show all items in the tooltip, sorted by percentage (descending)
58690
+ const allItems = pieData.filter(dataItem => dataItem.value > 0).sort((a, b) => b.percent - a.percent).map(dataItem => ({
58691
+ color: dataItem.color,
58692
+ label: dataItem.label || '',
58693
+ value: renderPercentage(Math.round(dataItem.percent * 100))
58694
+ }));
58539
58695
  return renderTooltipJsx({
58540
58696
  title: t("Soil Type"),
58541
- items: [{
58542
- color: item.color,
58543
- label: optionsMap[item.label] || item.label || '',
58544
- value: `${renderPercentage(item.percent.toFixed(2) * 100)}`
58545
- }]
58697
+ items: allItems
58546
58698
  });
58547
- }, [t, isEmpty, optionsMap]);
58699
+ }, [t, isEmpty, pieData]);
58548
58700
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
58549
58701
  title: t("Soil Type"),
58550
58702
  className: "with-border-header h-w-btn-header",
@@ -58645,7 +58797,16 @@ const SalinityLevels = ({
58645
58797
  });
58646
58798
  };
58647
58799
 
58648
- const COLORS = ['#6AD99E', '#FFD93D', '#F0A888', '#DF571E', '#B0B0B0', '#016C6E', '#4FB3A1'];
58800
+ const WATER_QUALITY_COLORS = {
58801
+ fairly_clear: '#32D583',
58802
+ turbid: '#FFA940',
58803
+ polluted: '#F97066',
58804
+ oil_traces: '#2B3644',
58805
+ no_water: '#DAD6CE',
58806
+ clear: '#6AD99E',
58807
+ other: '#9E9E9E'
58808
+ };
58809
+ const DEFAULT_COLOR = '#9E9E9E';
58649
58810
  const WaterQuality = ({
58650
58811
  waterQualityChart,
58651
58812
  t = s => s,
@@ -58666,7 +58827,7 @@ const WaterQuality = ({
58666
58827
  return data.map((item, index) => ({
58667
58828
  value: Number(item?.count) || 0,
58668
58829
  percent: total > 0 ? (Number(item?.count) || 0) / total : 0,
58669
- color: COLORS[index % COLORS.length],
58830
+ color: WATER_QUALITY_COLORS[item?.waterQuality] || DEFAULT_COLOR,
58670
58831
  label: optionsMap[item?.waterQuality] || item?.waterQuality || '',
58671
58832
  key: item?.waterQuality || `item-${index}`
58672
58833
  }));
@@ -58678,15 +58839,18 @@ const WaterQuality = ({
58678
58839
  if (isEmpty) {
58679
58840
  return null;
58680
58841
  }
58842
+
58843
+ // Show all items in the tooltip, sorted by percentage (descending)
58844
+ const allItems = pieData.filter(dataItem => dataItem.value > 0).sort((a, b) => b.percent - a.percent).map(dataItem => ({
58845
+ color: dataItem.color,
58846
+ label: dataItem.label || '',
58847
+ value: renderPercentage(Math.round(dataItem.percent * 100))
58848
+ }));
58681
58849
  return renderTooltipJsx({
58682
58850
  title: t("Water Quality"),
58683
- items: [{
58684
- color: item.color,
58685
- label: item.label || '',
58686
- value: `${Math.round(item.percent * 100)}%`
58687
- }]
58851
+ items: allItems
58688
58852
  });
58689
- }, [t, isEmpty]);
58853
+ }, [t, isEmpty, pieData]);
58690
58854
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
58691
58855
  title: t("Water Quality"),
58692
58856
  className: "with-border-header h-w-btn-header",