@nova-ui/dashboards 19.0.4 → 19.0.5

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.
@@ -8162,7 +8162,13 @@ var TimeseriesWidgetProjectType;
8162
8162
  // THE SOFTWARE.
8163
8163
  function metricsSeriesMeasurementsMinMax(series, axisUnits) {
8164
8164
  if (axisUnits === "percent") {
8165
- return { min: 0, max: 100 };
8165
+ const percentMetrics = series.filter((metric) => metric.metricUnits === "percent" && metric.data?.length);
8166
+ const percentMax = percentMetrics.length > 0
8167
+ ? percentMetrics
8168
+ .flatMap((m) => m.data ?? [])
8169
+ .reduce((acc, measurement) => Math.max(acc, measurement.y), 0)
8170
+ : 0;
8171
+ return { min: 0, max: Math.max(100, percentMax) };
8166
8172
  }
8167
8173
  // skips percent measurements as they are displayed on the left y-axis and would affect right y-axis domain
8168
8174
  const nonPercentMetrics = series.filter((metric) => metric.metricUnits !== "percent" && metric.data?.length);
@@ -8349,7 +8355,13 @@ class TimeseriesScalesService {
8349
8355
  }
8350
8356
  if (scaleConfig.properties?.axisUnits === "percent" &&
8351
8357
  scale.setFixDomainValues) {
8352
- scale.setFixDomainValues([0, 25, 50, 75, 100]);
8358
+ const domainMax = scaleConfig.properties?.domain?.max ?? 100;
8359
+ const upperBound = Math.max(100, Math.ceil(domainMax / 25) * 25);
8360
+ const points = [];
8361
+ for (let i = 0; i <= upperBound; i += 25) {
8362
+ points.push(i);
8363
+ }
8364
+ scale.setFixDomainValues(points);
8353
8365
  }
8354
8366
  if (scaleConfig.properties?.axisUnits !== "percent" &&
8355
8367
  scaleConfig.properties?.domain &&