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

Function addThresholdAnnotations

website/script/benchmarks.js:118–182  ·  view source on GitHub ↗
(thresholds)

Source from the content-addressed store, hash-verified

116}
117
118function addThresholdAnnotations(thresholds) {
119 if (!thresholds) return [];
120
121 const annotations = [];
122 const isDarkMode = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
123
124 // Add good threshold line
125 if (thresholds.good !== undefined) {
126 annotations.push({
127 y: thresholds.good,
128 borderColor: isDarkMode ? "#22c55e" : "#16a34a", // green-500/600
129 borderWidth: 2,
130 strokeDashArray: 5,
131 label: {
132 text: "Good",
133 position: "right",
134 style: {
135 color: isDarkMode ? "#22c55e" : "#16a34a",
136 background: "transparent",
137 fontSize: "12px",
138 },
139 },
140 });
141 }
142
143 // Add warning threshold line
144 if (thresholds.warning !== undefined) {
145 annotations.push({
146 y: thresholds.warning,
147 borderColor: isDarkMode ? "#f59e0b" : "#d97706", // amber-500/600
148 borderWidth: 2,
149 strokeDashArray: 5,
150 label: {
151 text: "Warning",
152 position: "right",
153 style: {
154 color: isDarkMode ? "#f59e0b" : "#d97706",
155 background: "transparent",
156 fontSize: "12px",
157 },
158 },
159 });
160 }
161
162 // Add bad threshold line (for throughput where low is bad)
163 if (thresholds.bad !== undefined) {
164 annotations.push({
165 y: thresholds.bad,
166 borderColor: isDarkMode ? "#ef4444" : "#dc2626", // red-500/600
167 borderWidth: 2,
168 strokeDashArray: 5,
169 label: {
170 text: "Poor",
171 position: "right",
172 style: {
173 color: isDarkMode ? "#ef4444" : "#dc2626",
174 background: "transparent",
175 fontSize: "12px",

Callers 1

getBaseChartConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected