MCPcopy Create free account
hub / github.com/csskit/csskit / getCriterionChartConfig

Function getCriterionChartConfig

website/script/benchmarks.js:268–296  ·  view source on GitHub ↗
(
	title,
	yAxisTitle,
	minVal,
	maxVal,
	padding,
	decimalPlaces,
	unitSuffix,
	thresholds = null,
)

Source from the content-addressed store, hash-verified

266}
267
268function 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
298function setupThemeObserver() {
299 const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");

Callers 1

Calls 1

getBaseChartConfigFunction · 0.85

Tested by

no test coverage detected