@bitcobblers/wod-wiki-ui 0.55.2206 → 0.56.2208

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.
@@ -6706,6 +6706,27 @@ function QueryValue({ result, unit: unitProp, label, thresholds }) {
6706
6706
  ] })
6707
6707
  ] });
6708
6708
  }
6709
+ function formatWithUnit(formattedNumber, unit) {
6710
+ const cleanUnit = unit?.trim();
6711
+ return cleanUnit ? `${formattedNumber} ${cleanUnit}` : formattedNumber;
6712
+ }
6713
+ function formatTimeseriesTick(value, unit) {
6714
+ const numeric = Number(value);
6715
+ if (!Number.isFinite(numeric)) {
6716
+ return formatWithUnit(String(value), unit);
6717
+ }
6718
+ const maximumFractionDigits = Math.abs(numeric) >= 100 ? 0 : 1;
6719
+ const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits }).format(numeric);
6720
+ return formatWithUnit(formatted, unit);
6721
+ }
6722
+ function formatTimeseriesTooltipValue(value, unit) {
6723
+ const numeric = Number(value);
6724
+ if (!Number.isFinite(numeric)) {
6725
+ return formatWithUnit(String(value), unit);
6726
+ }
6727
+ const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(numeric);
6728
+ return formatWithUnit(formatted, unit);
6729
+ }
6709
6730
  function WqlTimeseries({ result, unit: unitProp }) {
6710
6731
  const shape = useChartShape(result);
6711
6732
  const data2 = React2.useMemo(() => mergeSeries(result.series), [result]);
@@ -6734,7 +6755,7 @@ function WqlTimeseries({ result, unit: unitProp }) {
6734
6755
  width: 64,
6735
6756
  stroke: "hsl(var(--muted-foreground))",
6736
6757
  tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 },
6737
- unit: unit ? ` ${unit}` : ""
6758
+ tickFormatter: (v) => formatTimeseriesTick(v, unit)
6738
6759
  }
6739
6760
  ),
6740
6761
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6747,7 +6768,7 @@ function WqlTimeseries({ result, unit: unitProp }) {
6747
6768
  color: "hsl(var(--popover-foreground))"
6748
6769
  },
6749
6770
  labelFormatter: (v) => tooltipTimestamp(v),
6750
- formatter: (v) => [`${Number(v).toLocaleString()} ${unit ?? ""}`.trim(), ""]
6771
+ formatter: (v) => [formatTimeseriesTooltipValue(v, unit), ""]
6751
6772
  }
6752
6773
  ),
6753
6774
  result.series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, { wrapperStyle: { fontSize: 11 } }),