( title, yAxisTitle, minVal, maxVal, padding, decimalPlaces, unitSuffix, thresholds = null, )
| 266 | } |
| 267 | |
| 268 | function getCriterionChartConfig( |
| 269 | title, |
| 270 | yAxisTitle, |
| 271 | minVal, |
| 272 | maxVal, |
| 273 | padding, |
| 274 | decimalPlaces, |
| 275 | unitSuffix, |
| 276 | thresholds = null, |
| 277 | ) { |
| 278 | const yAxisOptions = { |
| 279 | min: Math.max(0, minVal - padding), |
| 280 | max: maxVal + padding, |
| 281 | decimalsInFloat: decimalPlaces, |
| 282 | }; |
| 283 | |
| 284 | const config = getBaseChartConfig(title, yAxisTitle, yAxisOptions, thresholds); |
| 285 | config.stroke.width = 3; |
| 286 | config.tooltip.y = { |
| 287 | formatter: function (y) { |
| 288 | if (typeof y !== "undefined" && typeof y === "number" && !isNaN(y)) { |
| 289 | return y.toFixed(decimalPlaces) + unitSuffix; |
| 290 | } |
| 291 | return y; |
| 292 | }, |
| 293 | }; |
| 294 | |
| 295 | return config; |
| 296 | } |
| 297 | |
| 298 | function setupThemeObserver() { |
| 299 | const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); |
no test coverage detected