Modern redesign #9
No files matched your search
+170
-447
@@ -1,15 +1,12 @@
|
||||
/* ==========================================================================
|
||||
OpenBench - LLR history chart
|
||||
OpenBench - LLR history graph
|
||||
|
||||
The server (mytags.llr_history_graph) only supplies data: a <div
|
||||
class="llr-chart" data-chart="{json}">. Everything is drawn here, so the
|
||||
chart fills the width of its card and stays crisp on any screen.
|
||||
The server (mytags.llr_history_graph) supplies the data as a
|
||||
<div class="llr-chart" data-chart="{json}">, and the graph is drawn here
|
||||
so that it fills the width of its panel.
|
||||
|
||||
Interaction
|
||||
- the crosshair snaps to the nearest data point, and is pulled towards
|
||||
local peaks / valleys when the pointer is close to one
|
||||
- mouse, touch (horizontal scrub, vertical scroll still works) and
|
||||
keyboard (arrows, Shift = x10, Home / End, Escape)
|
||||
Hovering snaps the marker to the nearest point of the graph, and to the
|
||||
peaks / valleys of the line when the pointer is near one.
|
||||
========================================================================== */
|
||||
|
||||
(function () {
|
||||
@@ -17,10 +14,13 @@
|
||||
|
||||
var SVG_NS = 'http://www.w3.org/2000/svg';
|
||||
var MINUS = '\u2212';
|
||||
var MAGNET = 10; // px a peak / valley may pull the crosshair from the pointer
|
||||
var HEIGHT = 124;
|
||||
var MARGIN = { l: 40, r: 8, t: 8, b: 20 };
|
||||
var MAGNET = 12; // px: how far a peak / valley pulls the marker
|
||||
var SWING = 3; // px: smallest rise / fall that counts as a peak / valley
|
||||
var uid = 0;
|
||||
|
||||
/* ---------- tiny DOM helpers ---------- */
|
||||
/* ---------- helpers ---------- */
|
||||
|
||||
function svg(name, attrs, parent) {
|
||||
var node = document.createElementNS(SVG_NS, name);
|
||||
@@ -32,75 +32,32 @@
|
||||
return node;
|
||||
}
|
||||
|
||||
function div(className, parent, text) {
|
||||
function div(className, parent) {
|
||||
var node = document.createElement('div');
|
||||
node.className = className;
|
||||
if (text !== undefined)
|
||||
node.textContent = text;
|
||||
if (parent)
|
||||
parent.appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
function span(className, parent, text) {
|
||||
var node = document.createElement('span');
|
||||
node.className = className;
|
||||
if (text !== undefined)
|
||||
node.textContent = text;
|
||||
if (parent)
|
||||
parent.appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
/* ---------- number formatting ---------- */
|
||||
|
||||
function fmt(value, digits) {
|
||||
return value.toFixed(digits).replace('-', MINUS);
|
||||
function fmt(value) {
|
||||
return value.toFixed(2).replace('-', MINUS);
|
||||
}
|
||||
|
||||
function commas(value) {
|
||||
return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
}
|
||||
|
||||
function trim(value) {
|
||||
return String(parseFloat(value.toFixed(2)));
|
||||
}
|
||||
|
||||
function compact(value) {
|
||||
var abs = Math.abs(value);
|
||||
if (abs >= 1e6) return trim(value / 1e6) + 'M';
|
||||
if (abs >= 1e3) return trim(value / 1e3) + 'k';
|
||||
return trim(value);
|
||||
}
|
||||
|
||||
function tone(value) {
|
||||
return value > 0 ? 'pos' : value < 0 ? 'neg' : 'zero';
|
||||
if (value >= 1e6) return parseFloat((value / 1e6).toFixed(1)) + 'M';
|
||||
if (value >= 1e3) return parseFloat((value / 1e3).toFixed(1)) + 'k';
|
||||
return String(Math.round(value));
|
||||
}
|
||||
|
||||
function clamp(value, min, max) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
|
||||
/* ---------- scales ---------- */
|
||||
|
||||
function niceTicks(min, max, target) {
|
||||
|
||||
var span = max - min;
|
||||
if (!(span > 0) || !(target > 0))
|
||||
return [min];
|
||||
|
||||
var raw = span / target;
|
||||
var mag = Math.pow(10, Math.floor(Math.log(raw) / Math.LN10));
|
||||
var norm = raw / mag;
|
||||
var step = (norm < 1.5 ? 1 : norm < 3 ? 2 : norm < 7 ? 5 : 10) * mag;
|
||||
|
||||
var ticks = [];
|
||||
for (var i = Math.ceil(min / step); i * step <= max + step * 1e-9; i++)
|
||||
ticks.push(parseFloat((i * step).toPrecision(12)));
|
||||
|
||||
return ticks;
|
||||
}
|
||||
|
||||
// Index of the first point with games >= target
|
||||
function lowerBound(points, target) {
|
||||
|
||||
@@ -113,9 +70,7 @@
|
||||
return lo;
|
||||
}
|
||||
|
||||
/* ---------- path helpers ---------- */
|
||||
|
||||
// Keep first / min / max / last of every pixel column, for very long histories
|
||||
// Keep the first / min / max / last point of every pixel column
|
||||
function decimate(points, sx) {
|
||||
|
||||
var out = [], i = 0, n = points.length;
|
||||
@@ -131,12 +86,11 @@
|
||||
if (points[j].llr > points[hi].llr) hi = j;
|
||||
}
|
||||
|
||||
var picks = [i, lo, hi, j].filter(function (value, index, all) {
|
||||
[i, lo, hi, j].filter(function (value, index, all) {
|
||||
return all.indexOf(value) === index;
|
||||
}).sort(function (a, b) { return a - b; });
|
||||
|
||||
for (var k = 0; k < picks.length; k++)
|
||||
out.push(points[picks[k]]);
|
||||
}).sort(function (a, b) { return a - b; }).forEach(function (k) {
|
||||
out.push(points[k]);
|
||||
});
|
||||
|
||||
i = j + 1;
|
||||
}
|
||||
@@ -144,462 +98,251 @@
|
||||
return out;
|
||||
}
|
||||
|
||||
// Split into runs of consecutive points for which test(a, b) holds
|
||||
function runs(points, test) {
|
||||
/* Peaks and valleys: every turning point of the line where it rises or
|
||||
falls by at least `threshold` before turning around. Flat stretches and
|
||||
tiny wiggles (smaller than a few pixels) are ignored, so what snaps is
|
||||
exactly what is visible on the graph. */
|
||||
function findPivots(points, threshold) {
|
||||
|
||||
var out = [], run = null;
|
||||
var pivots = [];
|
||||
var trend = 0, hi = 0, lo = 0;
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
if (test(points[i - 1], points[i])) {
|
||||
if (!run) { run = [points[i - 1]]; out.push(run); }
|
||||
run.push(points[i]);
|
||||
} else {
|
||||
run = null;
|
||||
|
||||
var value = points[i].llr;
|
||||
|
||||
if (value >= points[hi].llr) hi = i;
|
||||
if (value <= points[lo].llr) lo = i;
|
||||
|
||||
if (trend >= 0 && points[hi].llr - value >= threshold) {
|
||||
pivots.push(hi);
|
||||
trend = -1; hi = i; lo = i;
|
||||
}
|
||||
else if (trend <= 0 && value - points[lo].llr >= threshold) {
|
||||
pivots.push(lo);
|
||||
trend = 1; hi = i; lo = i;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
return pivots;
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
Chart
|
||||
Graph
|
||||
====================================================================== */
|
||||
|
||||
function LlrChart(root, data) {
|
||||
function Graph(root, data) {
|
||||
|
||||
this.root = root;
|
||||
this.lower = Number(data.lower);
|
||||
this.upper = Number(data.upper);
|
||||
this.current = Number(data.current);
|
||||
this.games = Number(data.games);
|
||||
this.finished = !!data.finished;
|
||||
this.active = -1;
|
||||
this.rendered = 0;
|
||||
this.animated = false;
|
||||
|
||||
this.hasBounds = isFinite(this.lower) && isFinite(this.upper) && this.upper > this.lower;
|
||||
|
||||
this.points = data.history.map(function (p) {
|
||||
return { games: Number(p[0]), llr: Number(p[1]), estimated: !!p[2] };
|
||||
}).sort(function (a, b) { return a.games - b.games; });
|
||||
|
||||
this.markExtremes();
|
||||
this.build();
|
||||
root.textContent = '';
|
||||
|
||||
this.plot = div('llrg-plot', root);
|
||||
this.plot.tabIndex = 0;
|
||||
this.plot.setAttribute('role', 'img');
|
||||
this.plot.setAttribute('aria-label', 'LLR history. Use the arrow keys to inspect the points.');
|
||||
|
||||
this.svgEl = svg('svg', { 'class': 'llrg-svg', 'aria-hidden': 'true' }, this.plot);
|
||||
this.tip = div('llrg-tip', this.plot);
|
||||
|
||||
this.render();
|
||||
this.bind();
|
||||
}
|
||||
|
||||
// Flag local peaks and valleys of the measured (non estimated) points
|
||||
LlrChart.prototype.markExtremes = function () {
|
||||
Graph.prototype.render = function () {
|
||||
|
||||
var real = this.points.filter(function (p) { return !p.estimated; });
|
||||
|
||||
for (var i = 1; i < real.length - 1; i++) {
|
||||
var prev = real[i - 1], curr = real[i], next = real[i + 1];
|
||||
if ((curr.llr > prev.llr && curr.llr > next.llr) ||
|
||||
(curr.llr < prev.llr && curr.llr < next.llr))
|
||||
curr.extreme = true;
|
||||
}
|
||||
};
|
||||
|
||||
LlrChart.prototype.ratio = function (llr) {
|
||||
|
||||
if (!this.hasBounds)
|
||||
return 0;
|
||||
|
||||
var bound = llr >= 0 ? this.upper : this.lower;
|
||||
return bound ? clamp(llr / bound, 0, 1) : 0;
|
||||
};
|
||||
|
||||
LlrChart.prototype.build = function () {
|
||||
|
||||
var root = this.root;
|
||||
root.textContent = '';
|
||||
root.classList.add('llrc');
|
||||
|
||||
var kind = tone(this.current);
|
||||
var ratio = this.ratio(this.current);
|
||||
var goal = this.current >= 0 ? 'pass' : 'fail';
|
||||
|
||||
/* Header: current value, progress towards the nearest bound, games */
|
||||
|
||||
var head = div('llrc-head', root);
|
||||
|
||||
var stat = div('llrc-stat', head);
|
||||
span('llrc-stat-label', stat, 'LLR');
|
||||
span('llrc-value is-' + kind, stat, fmt(this.current, 2));
|
||||
|
||||
if (this.hasBounds)
|
||||
span('llrc-of', stat, '/ ' + fmt(this.current >= 0 ? this.upper : this.lower, 2));
|
||||
|
||||
if (this.hasBounds) {
|
||||
var progress = div('llrc-progress', head);
|
||||
var top = div('llrc-progress-top', progress);
|
||||
span('', top, Math.round(ratio * 100) + '% to ' + goal + ' bound');
|
||||
var bar = div('llrc-bar', progress);
|
||||
this.fill = span('is-' + (this.current >= 0 ? 'pos' : 'neg'), bar);
|
||||
this.fill.style.width = '0%';
|
||||
this.fillTarget = ratio * 100;
|
||||
}
|
||||
|
||||
div('llrc-games', head, commas(this.games) + ' games');
|
||||
|
||||
/* Plot */
|
||||
|
||||
this.plot = div('llrc-plot', root);
|
||||
this.plot.tabIndex = 0;
|
||||
this.plot.setAttribute('role', 'img');
|
||||
this.plot.setAttribute('aria-label',
|
||||
'LLR history: ' + fmt(this.current, 2) + ' after ' + commas(this.games) +
|
||||
' games. Use the arrow keys to inspect individual points.');
|
||||
|
||||
this.svgEl = svg('svg', { 'class': 'llrc-svg', 'aria-hidden': 'true' }, this.plot);
|
||||
this.tip = div('llrc-tip', this.plot);
|
||||
|
||||
this.live = div('llrc-sr', root);
|
||||
this.live.setAttribute('aria-live', 'polite');
|
||||
|
||||
/* Legend */
|
||||
|
||||
var legend = div('llrc-legend', root);
|
||||
|
||||
var key = span('llrc-key', legend);
|
||||
span('llrc-swatch llrc-swatch-line', key);
|
||||
span('', key, 'LLR');
|
||||
|
||||
if (this.points.some(function (p) { return p.estimated; })) {
|
||||
key = span('llrc-key', legend);
|
||||
span('llrc-swatch llrc-swatch-est', key);
|
||||
span('', key, 'Estimated');
|
||||
}
|
||||
|
||||
if (this.hasBounds) {
|
||||
key = span('llrc-key', legend);
|
||||
span('llrc-swatch llrc-swatch-bound', key);
|
||||
span('', key, 'Bounds');
|
||||
}
|
||||
|
||||
span('llrc-hint', legend, 'Hover, drag or use \u2190 \u2192 to inspect');
|
||||
};
|
||||
|
||||
LlrChart.prototype.render = function () {
|
||||
|
||||
var plotWidth = Math.floor(this.plot.clientWidth);
|
||||
if (plotWidth < 160)
|
||||
var W = Math.floor(this.plot.clientWidth);
|
||||
if (W < 120)
|
||||
return;
|
||||
|
||||
this.rendered = plotWidth;
|
||||
this.rendered = W;
|
||||
|
||||
var W = plotWidth;
|
||||
var H = W < 460 ? 196 : 244;
|
||||
var m = { l: 46, r: 14, t: 14, b: 26 };
|
||||
var H = HEIGHT, m = MARGIN;
|
||||
var iw = W - m.l - m.r;
|
||||
var ih = H - m.t - m.b;
|
||||
|
||||
var points = this.points;
|
||||
var xMax = Math.max(points[points.length - 1].games, this.games, 1);
|
||||
var xMax = Math.max(points[points.length - 1].games, this.games, 1);
|
||||
|
||||
/* Domain: all the data, zero, and both bounds, so progress is always visible */
|
||||
/* Vertical range: what was observed, and zero, with a minimum height */
|
||||
|
||||
var lo = 0, hi = 0;
|
||||
if (this.hasBounds) { lo = Math.min(lo, this.lower); hi = Math.max(hi, this.upper); }
|
||||
var maxPos = 0, minNeg = 0;
|
||||
|
||||
points.forEach(function (p) {
|
||||
if (p.llr < lo) lo = p.llr;
|
||||
if (p.llr > hi) hi = p.llr;
|
||||
if (p.llr > maxPos) maxPos = p.llr;
|
||||
if (p.llr < minNeg) minNeg = p.llr;
|
||||
});
|
||||
|
||||
var pad = (hi - lo) * 0.07 || 1;
|
||||
var yMin = lo - pad;
|
||||
var yMax = hi + pad;
|
||||
var yMin, yMax;
|
||||
if (hi - lo < 0.75) {
|
||||
var center = (lo + hi) / 2;
|
||||
yMin = center - 0.375;
|
||||
yMax = center + 0.375;
|
||||
} else {
|
||||
var pad = Math.max((hi - lo) * 0.15, 0.15);
|
||||
yMin = lo - pad;
|
||||
yMax = hi + pad;
|
||||
}
|
||||
|
||||
function sx(games) { return m.l + iw * (games / xMax); }
|
||||
function sy(value) { return m.t + ih * (1 - (value - yMin) / (yMax - yMin)); }
|
||||
|
||||
this.g = { W: W, H: H, m: m, iw: iw, ih: ih, xMax: xMax, sx: sx, sy: sy };
|
||||
|
||||
/* Peaks and valleys, plus both ends, are what the marker snaps to */
|
||||
|
||||
var pivots = findPivots(points, SWING * (yMax - yMin) / ih);
|
||||
pivots.push(0, points.length - 1);
|
||||
this.pivots = pivots.filter(function (value, index, all) {
|
||||
return all.indexOf(value) === index;
|
||||
}).sort(function (a, b) { return a - b; });
|
||||
|
||||
/* Drawing */
|
||||
|
||||
var el = this.svgEl;
|
||||
var id = 'llrg' + (++uid);
|
||||
var zeroY = sy(0);
|
||||
var id = 'llrc' + (++uid);
|
||||
var el = this.svgEl;
|
||||
|
||||
el.textContent = '';
|
||||
el.setAttribute('viewBox', '0 0 ' + W + ' ' + H);
|
||||
el.setAttribute('width', W);
|
||||
el.setAttribute('height', H);
|
||||
|
||||
/* Defs: gradients for the area under the curve, clips to split green / red at zero */
|
||||
|
||||
var defs = svg('defs', {}, el);
|
||||
var above = svg('clipPath', { id: id + '-a' }, defs);
|
||||
svg('rect', { x: m.l, y: m.t, width: iw, height: Math.max(zeroY - m.t, 0) }, above);
|
||||
var below = svg('clipPath', { id: id + '-b' }, defs);
|
||||
svg('rect', { x: m.l, y: zeroY, width: iw, height: Math.max(m.t + ih - zeroY, 0) }, below);
|
||||
|
||||
var gradPos = svg('linearGradient', { id: id + '-gp', gradientUnits: 'userSpaceOnUse',
|
||||
x1: 0, x2: 0, y1: sy(maxPos), y2: zeroY }, defs);
|
||||
svg('stop', { offset: '0', 'class': 'llrc-stop-pos', 'stop-opacity': '0.34' }, gradPos);
|
||||
svg('stop', { offset: '1', 'class': 'llrc-stop-pos', 'stop-opacity': '0.02' }, gradPos);
|
||||
|
||||
var gradNeg = svg('linearGradient', { id: id + '-gn', gradientUnits: 'userSpaceOnUse',
|
||||
x1: 0, x2: 0, y1: zeroY, y2: sy(minNeg) }, defs);
|
||||
svg('stop', { offset: '0', 'class': 'llrc-stop-neg', 'stop-opacity': '0.02' }, gradNeg);
|
||||
svg('stop', { offset: '1', 'class': 'llrc-stop-neg', 'stop-opacity': '0.34' }, gradNeg);
|
||||
|
||||
var clipPos = svg('clipPath', { id: id + '-cp' }, defs);
|
||||
svg('rect', { x: m.l, y: m.t - 2, width: iw, height: Math.max(zeroY - m.t + 2, 0) }, clipPos);
|
||||
|
||||
var clipNeg = svg('clipPath', { id: id + '-cn' }, defs);
|
||||
svg('rect', { x: m.l, y: zeroY, width: iw, height: Math.max(H - m.b - zeroY + 2, 0) }, clipNeg);
|
||||
|
||||
/* Zones beyond the bounds */
|
||||
|
||||
if (this.hasBounds) {
|
||||
svg('rect', { 'class': 'llrc-zone-pos', x: m.l, y: m.t,
|
||||
width: iw, height: Math.max(sy(this.upper) - m.t, 0) }, el);
|
||||
svg('rect', { 'class': 'llrc-zone-neg', x: m.l, y: sy(this.lower),
|
||||
width: iw, height: Math.max(H - m.b - sy(this.lower), 0) }, el);
|
||||
}
|
||||
|
||||
/* Grid and axis labels */
|
||||
|
||||
var boundYs = this.hasBounds ? [sy(this.upper), sy(this.lower)] : [];
|
||||
|
||||
niceTicks(yMin, yMax, ih / 38).forEach(function (value) {
|
||||
svg('rect', { 'class': 'llrg-bg', x: m.l, y: m.t, width: iw, height: ih }, el);
|
||||
|
||||
// Horizontal grid + labels: top, middle, bottom
|
||||
[yMax, (yMin + yMax) / 2, yMin].forEach(function (value) {
|
||||
var y = sy(value);
|
||||
if (y < m.t - 0.5 || y > H - m.b + 0.5)
|
||||
return;
|
||||
|
||||
svg('line', { 'class': value === 0 ? 'llrc-zero' : 'llrc-grid',
|
||||
x1: m.l, x2: W - m.r, y1: y, y2: y }, el);
|
||||
|
||||
var nearBound = boundYs.some(function (by) { return Math.abs(by - y) < 9; });
|
||||
if (nearBound && value !== 0)
|
||||
return;
|
||||
|
||||
var label = svg('text', { 'class': 'llrc-tick', x: m.l - 8, y: y, dy: '0.32em',
|
||||
'text-anchor': 'end' }, el);
|
||||
label.textContent = fmt(value, Math.abs(value) % 1 ? 1 : 0);
|
||||
svg('line', { 'class': 'llrg-grid', x1: m.l, x2: m.l + iw, y1: y, y2: y }, el);
|
||||
var label = svg('text', { 'class': 'llrg-tick', x: m.l - 6, y: y, dy: '0.32em', 'text-anchor': 'end' }, el);
|
||||
label.textContent = fmt(value);
|
||||
});
|
||||
|
||||
niceTicks(0, xMax, iw / 96).forEach(function (value) {
|
||||
|
||||
var x = sx(value);
|
||||
svg('line', { 'class': 'llrc-grid llrc-grid-v', x1: x, x2: x, y1: m.t, y2: H - m.b }, el);
|
||||
|
||||
if (x > W - m.r - 12 && value !== xMax)
|
||||
return;
|
||||
|
||||
var label = svg('text', { 'class': 'llrc-tick', x: x, y: H - 8,
|
||||
'text-anchor': value === 0 ? 'start' : 'middle' }, el);
|
||||
label.textContent = compact(value);
|
||||
// Vertical grid
|
||||
[0.25, 0.5, 0.75].forEach(function (fraction) {
|
||||
var x = m.l + iw * fraction;
|
||||
svg('line', { 'class': 'llrg-grid', x1: x, x2: x, y1: m.t, y2: m.t + ih }, el);
|
||||
});
|
||||
|
||||
/* Bounds */
|
||||
|
||||
if (this.hasBounds) {
|
||||
|
||||
var upperY = sy(this.upper), lowerY = sy(this.lower);
|
||||
|
||||
svg('line', { 'class': 'llrc-bound llrc-bound-pos', x1: m.l, x2: W - m.r, y1: upperY, y2: upperY }, el);
|
||||
svg('line', { 'class': 'llrc-bound llrc-bound-neg', x1: m.l, x2: W - m.r, y1: lowerY, y2: lowerY }, el);
|
||||
|
||||
var upperLabel = svg('text', { 'class': 'llrc-bound-label llrc-bound-label-pos',
|
||||
x: m.l + 8, y: upperY - 6 }, el);
|
||||
upperLabel.textContent = 'PASS ' + fmt(this.upper, 2);
|
||||
|
||||
var lowerLabel = svg('text', { 'class': 'llrc-bound-label llrc-bound-label-neg',
|
||||
x: m.l + 8, y: lowerY + 14 }, el);
|
||||
lowerLabel.textContent = 'FAIL ' + fmt(this.lower, 2);
|
||||
}
|
||||
|
||||
/* Series: drawn twice and clipped, so the line is green above zero and red below */
|
||||
|
||||
var drawn = points.length > iw * 1.5 ? decimate(points, sx) : points;
|
||||
|
||||
function path(list) {
|
||||
return list.map(function (run) {
|
||||
return run.map(function (p, i) {
|
||||
return (i ? 'L' : 'M') + sx(p.games).toFixed(1) + ' ' + sy(p.llr).toFixed(1);
|
||||
}).join('');
|
||||
}).join('');
|
||||
}
|
||||
|
||||
var solid = path(runs(drawn, function (a, b) { return !a.estimated && !b.estimated; }));
|
||||
var dashed = path(runs(drawn, function (a, b) { return a.estimated || b.estimated; }));
|
||||
|
||||
var area = '';
|
||||
if (drawn.length > 1) {
|
||||
area = 'M' + sx(drawn[0].games).toFixed(1) + ' ' + zeroY.toFixed(1) +
|
||||
drawn.map(function (p) { return 'L' + sx(p.games).toFixed(1) + ' ' + sy(p.llr).toFixed(1); }).join('') +
|
||||
'L' + sx(drawn[drawn.length - 1].games).toFixed(1) + ' ' + zeroY.toFixed(1) + 'Z';
|
||||
}
|
||||
|
||||
[['pos', id + '-cp', id + '-gp'], ['neg', id + '-cn', id + '-gn']].forEach(function (side) {
|
||||
|
||||
var group = svg('g', { 'clip-path': 'url(#' + side[1] + ')' }, el);
|
||||
|
||||
if (area)
|
||||
svg('path', { 'class': 'llrc-area', d: area, fill: 'url(#' + side[2] + ')' }, group);
|
||||
if (dashed)
|
||||
svg('path', { 'class': 'llrc-line llrc-line-est llrc-line-' + side[0], d: dashed }, group);
|
||||
if (solid)
|
||||
svg('path', { 'class': 'llrc-line llrc-line-solid llrc-line-' + side[0], d: solid,
|
||||
pathLength: '1' }, group);
|
||||
// Games axis
|
||||
[[0, 'start', m.l], [xMax / 2, 'middle', m.l + iw / 2], [xMax, 'end', m.l + iw]].forEach(function (tick) {
|
||||
var label = svg('text', { 'class': 'llrg-tick', x: tick[2], y: H - 5, 'text-anchor': tick[1] }, el);
|
||||
label.textContent = tick[0] === 0 ? '0' : compact(tick[0]);
|
||||
});
|
||||
|
||||
/* Latest value */
|
||||
|
||||
var last = points[points.length - 1];
|
||||
var kind = tone(last.llr);
|
||||
|
||||
if (!this.finished)
|
||||
svg('circle', { 'class': 'llrc-now-ring is-' + kind, cx: sx(last.games), cy: sy(last.llr), r: 5 }, el);
|
||||
svg('circle', { 'class': 'llrc-now is-' + kind, cx: sx(last.games), cy: sy(last.llr), r: 3.5 }, el);
|
||||
|
||||
/* Crosshair */
|
||||
|
||||
var hover = svg('g', { 'class': 'llrc-hover' }, el);
|
||||
this.hv = svg('line', { 'class': 'llrc-hover-v', y1: m.t, y2: H - m.b }, hover);
|
||||
this.hh = svg('line', { 'class': 'llrc-hover-h', x1: m.l, x2: W - m.r }, hover);
|
||||
this.hr = svg('circle', { 'class': 'llrc-hover-halo', r: 8 }, hover);
|
||||
this.hd = svg('circle', { 'class': 'llrc-hover-dot', r: 4.5 }, hover);
|
||||
this.hover = hover;
|
||||
|
||||
/* One-off entrance animation */
|
||||
|
||||
if (!this.animated) {
|
||||
this.animated = true;
|
||||
this.root.classList.add('llrc-animate');
|
||||
|
||||
if (this.fill) {
|
||||
var fill = this.fill, target = this.fillTarget;
|
||||
window.requestAnimationFrame(function () {
|
||||
window.requestAnimationFrame(function () { fill.style.width = target + '%'; });
|
||||
});
|
||||
// Bounds and zero, when they are in range
|
||||
var lower = this.lower, upper = this.upper;
|
||||
[[lower, 'llrg-bound'], [0, 'llrg-zero'], [upper, 'llrg-bound']].forEach(function (guide) {
|
||||
if (guide[0] >= yMin && guide[0] <= yMax) {
|
||||
var y = sy(guide[0]);
|
||||
svg('line', { 'class': guide[1], x1: m.l, x2: m.l + iw, y1: y, y2: y }, el);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The line: green above zero, red below
|
||||
var drawn = points.length > iw * 1.5 ? decimate(points, sx) : points;
|
||||
var d = drawn.map(function (p, i) {
|
||||
return (i ? 'L' : 'M') + sx(p.games).toFixed(1) + ' ' + sy(p.llr).toFixed(1);
|
||||
}).join('');
|
||||
|
||||
svg('path', { 'class': 'llrg-line llrg-line-pos', d: d, 'clip-path': 'url(#' + id + '-a)' }, el);
|
||||
svg('path', { 'class': 'llrg-line llrg-line-neg', d: d, 'clip-path': 'url(#' + id + '-b)' }, el);
|
||||
|
||||
// Marker
|
||||
this.hoverLine = svg('line', { 'class': 'llrg-hover-line', y1: m.t, y2: m.t + ih }, el);
|
||||
this.hoverDot = svg('circle', { 'class': 'llrg-hover-dot', r: 3.5 }, el);
|
||||
|
||||
if (this.active >= 0)
|
||||
this.setActive(this.active, true);
|
||||
this.setActive(this.active);
|
||||
};
|
||||
|
||||
/* ---------- snapping ---------- */
|
||||
|
||||
// Index of the point the crosshair should snap to for a pointer at x (px, svg space)
|
||||
LlrChart.prototype.pick = function (x) {
|
||||
Graph.prototype.pick = function (x) {
|
||||
|
||||
var g = this.g, points = this.points;
|
||||
var target = clamp((x - g.m.l) / g.iw, 0, 1) * g.xMax;
|
||||
|
||||
var after = lowerBound(points, target);
|
||||
// Nearest point
|
||||
var after = Math.min(lowerBound(points, target), points.length - 1);
|
||||
var before = Math.max(after - 1, 0);
|
||||
after = Math.min(after, points.length - 1);
|
||||
var best = Math.abs(g.sx(points[before].games) - x) <= Math.abs(g.sx(points[after].games) - x) ? before : after;
|
||||
|
||||
var best = Math.abs(g.sx(points[before].games) - x) <= Math.abs(g.sx(points[after].games) - x)
|
||||
? before : after;
|
||||
|
||||
// Pull towards a nearby peak / valley
|
||||
// Nearest peak / valley, if the pointer is close enough to one
|
||||
var magnet = -1, magnetDistance = MAGNET + 1;
|
||||
|
||||
for (var i = best; i >= 0; i--) {
|
||||
var d = Math.abs(g.sx(points[i].games) - x);
|
||||
if (d > MAGNET) break;
|
||||
if (points[i].extreme && d < magnetDistance) { magnet = i; magnetDistance = d; }
|
||||
}
|
||||
|
||||
for (var j = best + 1; j < points.length; j++) {
|
||||
var e = Math.abs(g.sx(points[j].games) - x);
|
||||
if (e > MAGNET) break;
|
||||
if (points[j].extreme && e < magnetDistance) { magnet = j; magnetDistance = e; }
|
||||
for (var i = 0; i < this.pivots.length; i++) {
|
||||
var distance = Math.abs(g.sx(points[this.pivots[i]].games) - x);
|
||||
if (distance < magnetDistance) {
|
||||
magnet = this.pivots[i];
|
||||
magnetDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
return magnet >= 0 ? magnet : best;
|
||||
};
|
||||
|
||||
LlrChart.prototype.setActive = function (index, keepTip) {
|
||||
Graph.prototype.setActive = function (index) {
|
||||
|
||||
if (index < 0 || !this.g) {
|
||||
this.active = -1;
|
||||
this.hover.classList.remove('is-active');
|
||||
this.tip.classList.remove('is-active');
|
||||
this.hoverLine.classList.remove('active');
|
||||
this.hoverDot.classList.remove('active', 'llrg-pos', 'llrg-neg');
|
||||
this.tip.classList.remove('active');
|
||||
return;
|
||||
}
|
||||
|
||||
var g = this.g;
|
||||
var p = this.points[index];
|
||||
var x = g.sx(p.games);
|
||||
var y = g.sy(p.llr);
|
||||
var k = tone(p.llr);
|
||||
var g = this.g, p = this.points[index];
|
||||
var x = g.sx(p.games), y = g.sy(p.llr);
|
||||
|
||||
this.active = index;
|
||||
|
||||
this.hv.setAttribute('x1', x); this.hv.setAttribute('x2', x);
|
||||
this.hh.setAttribute('y1', y); this.hh.setAttribute('y2', y);
|
||||
this.hr.setAttribute('cx', x); this.hr.setAttribute('cy', y);
|
||||
this.hd.setAttribute('cx', x); this.hd.setAttribute('cy', y);
|
||||
this.hr.setAttribute('class', 'llrc-hover-halo is-' + k);
|
||||
this.hd.setAttribute('class', 'llrc-hover-dot is-' + k);
|
||||
this.hover.classList.add('is-active');
|
||||
this.hoverLine.setAttribute('x1', x);
|
||||
this.hoverLine.setAttribute('x2', x);
|
||||
this.hoverDot.setAttribute('cx', x);
|
||||
this.hoverDot.setAttribute('cy', y);
|
||||
this.hoverDot.setAttribute('class', 'llrg-hover-dot active ' + (p.llr >= 0 ? 'llrg-pos' : 'llrg-neg'));
|
||||
this.hoverLine.classList.add('active');
|
||||
|
||||
/* Tooltip */
|
||||
this.tip.textContent = commas(p.games) + ' games | LLR ' + (p.estimated ? '\u2248' : '') + fmt(p.llr);
|
||||
this.tip.classList.add('active');
|
||||
|
||||
var tip = this.tip;
|
||||
tip.textContent = '';
|
||||
var left = clamp(x + 8, 0, g.W - this.tip.offsetWidth);
|
||||
var top = clamp(y - this.tip.offsetHeight - 8, 0, g.H - this.tip.offsetHeight);
|
||||
|
||||
div('llrc-tip-games', tip, commas(p.games) + ' games');
|
||||
|
||||
var row = div('llrc-tip-llr', tip);
|
||||
span('llrc-tip-label', row, p.estimated ? 'LLR \u2248' : 'LLR');
|
||||
span('llrc-tip-value is-' + k, row, fmt(p.llr, 2));
|
||||
|
||||
if (this.hasBounds) {
|
||||
var pct = Math.round(this.ratio(p.llr) * 100);
|
||||
div('llrc-tip-sub', tip, pct + '% to ' + (p.llr >= 0 ? 'pass' : 'fail') + ' bound');
|
||||
}
|
||||
|
||||
if (p.estimated)
|
||||
div('llrc-tip-sub', tip, 'estimated');
|
||||
|
||||
tip.classList.add('is-active');
|
||||
|
||||
var w = tip.offsetWidth, h = tip.offsetHeight;
|
||||
var left = x + 14;
|
||||
if (left + w > g.W - 2) left = x - w - 14;
|
||||
var top = y - h - 12;
|
||||
if (top < 0) top = y + 14;
|
||||
|
||||
tip.style.left = Math.max(left, 0) + 'px';
|
||||
tip.style.top = Math.max(top, 0) + 'px';
|
||||
this.tip.style.left = left + 'px';
|
||||
this.tip.style.top = top + 'px';
|
||||
};
|
||||
|
||||
/* ---------- events ---------- */
|
||||
|
||||
LlrChart.prototype.pointerX = function (event) {
|
||||
Graph.prototype.bind = function () {
|
||||
|
||||
var box = this.svgEl.getBoundingClientRect();
|
||||
return (event.clientX - box.left) * (this.g.W / (box.width || this.g.W));
|
||||
};
|
||||
|
||||
LlrChart.prototype.announce = function (index) {
|
||||
|
||||
var p = this.points[index];
|
||||
this.live.textContent = commas(p.games) + ' games, LLR ' + fmt(p.llr, 2) + (p.estimated ? ', estimated' : '');
|
||||
};
|
||||
|
||||
LlrChart.prototype.bind = function () {
|
||||
|
||||
var self = this;
|
||||
var plot = this.plot;
|
||||
var self = this, plot = this.plot;
|
||||
|
||||
function move(event) {
|
||||
if (self.g)
|
||||
self.setActive(self.pick(self.pointerX(event)));
|
||||
if (!self.g)
|
||||
return;
|
||||
var box = self.svgEl.getBoundingClientRect();
|
||||
var x = (event.clientX - box.left) * (self.g.W / (box.width || self.g.W));
|
||||
self.setActive(self.pick(x));
|
||||
}
|
||||
|
||||
plot.addEventListener('pointerenter', move);
|
||||
plot.addEventListener('pointermove', move);
|
||||
plot.addEventListener('pointerdown', move);
|
||||
|
||||
plot.addEventListener('pointerleave', function (event) {
|
||||
if (event.pointerType === 'mouse')
|
||||
self.setActive(-1);
|
||||
@@ -607,26 +350,23 @@
|
||||
|
||||
plot.addEventListener('keydown', function (event) {
|
||||
|
||||
var count = self.points.length;
|
||||
var step = event.shiftKey ? 10 : 1;
|
||||
var last = self.points.length - 1;
|
||||
var step = event.shiftKey ? 10 : 1;
|
||||
var index = self.active;
|
||||
|
||||
if (event.key === 'ArrowLeft') index = index < 0 ? count - 1 : index - step;
|
||||
else if (event.key === 'ArrowRight') index = index < 0 ? count - 1 : index + step;
|
||||
if (event.key === 'ArrowLeft') index = index < 0 ? last : index - step;
|
||||
else if (event.key === 'ArrowRight') index = index < 0 ? last : index + step;
|
||||
else if (event.key === 'Home') index = 0;
|
||||
else if (event.key === 'End') index = count - 1;
|
||||
else if (event.key === 'End') index = last;
|
||||
else if (event.key === 'Escape') { self.setActive(-1); return; }
|
||||
else return;
|
||||
|
||||
event.preventDefault();
|
||||
index = clamp(index, 0, count - 1);
|
||||
self.setActive(index);
|
||||
self.announce(index);
|
||||
self.setActive(clamp(index, 0, last));
|
||||
});
|
||||
|
||||
plot.addEventListener('blur', function () { self.setActive(-1); });
|
||||
|
||||
// Redraw when the card changes width
|
||||
function redraw() {
|
||||
if (Math.floor(plot.clientWidth) !== self.rendered)
|
||||
self.render();
|
||||
@@ -648,22 +388,9 @@
|
||||
Loading
|
||||
====================================================================== */
|
||||
|
||||
function showMessage(container, text, retry) {
|
||||
|
||||
container.textContent = '';
|
||||
function showError(container, text) {
|
||||
container.removeAttribute('aria-busy');
|
||||
|
||||
var box = div('llrc-message', container);
|
||||
span('', box, text);
|
||||
|
||||
if (retry) {
|
||||
var button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = 'anchorbutton btn-start llrc-retry';
|
||||
button.textContent = 'Retry';
|
||||
button.addEventListener('click', retry);
|
||||
box.appendChild(button);
|
||||
}
|
||||
container.innerHTML = '<div class="llr-history-placeholder llr-history-placeholder-error">' + text + '</div>';
|
||||
}
|
||||
|
||||
function load(container) {
|
||||
@@ -688,16 +415,12 @@
|
||||
|
||||
var node = container.querySelector('.llr-chart');
|
||||
if (!node)
|
||||
return showMessage(container, 'No LLR history to show yet.');
|
||||
return showError(container, 'No history to show yet.');
|
||||
|
||||
try {
|
||||
new LlrChart(node, JSON.parse(node.getAttribute('data-chart')));
|
||||
} catch (error) {
|
||||
showMessage(container, 'Unable to draw the history graph.', function () { load(container); });
|
||||
}
|
||||
new Graph(node, JSON.parse(node.getAttribute('data-chart')));
|
||||
|
||||
}).catch(function () {
|
||||
showMessage(container, 'Unable to load the history graph.', function () { load(container); });
|
||||
showError(container, 'Unable to load history graph.');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+62
-377
@@ -1,161 +1,18 @@
|
||||
/* ==========================================================================
|
||||
OpenBench - workload page: layout + LLR history chart
|
||||
Loaded after style.css, so same-specificity rules here win.
|
||||
OpenBench - workload page: LLR history graph
|
||||
(the panel itself, its label and the placeholder are styled in style.css)
|
||||
========================================================================== */
|
||||
|
||||
/* ---------- Layout ---------- */
|
||||
|
||||
#content .workload-container {
|
||||
grid-template-columns: minmax(0, 1fr) 372px;
|
||||
}
|
||||
|
||||
#content #config { grid-column: 1; grid-row: 1; }
|
||||
#content #llr { grid-column: 1; grid-row: 2; }
|
||||
#content #actions { grid-column: 2; grid-row: 1 / span 2; padding-bottom: 16px; }
|
||||
|
||||
#content #parameters,
|
||||
#content #results {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
|
||||
#content .workload-container {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
#content #config,
|
||||
#content #llr,
|
||||
#content #actions,
|
||||
#content #parameters,
|
||||
#content #results {
|
||||
grid-column: 1;
|
||||
grid-row: auto;
|
||||
}
|
||||
|
||||
#content #actions {
|
||||
order: -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- LLR card ---------- */
|
||||
|
||||
#content .llr-history-loader {
|
||||
min-height: 200px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#content .llrc-skeleton,
|
||||
#content .llrc-message {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 14px;
|
||||
min-height: 220px;
|
||||
padding: 24px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
#content .llr-history-placeholder {
|
||||
width: 100%;
|
||||
height: 124px;
|
||||
}
|
||||
|
||||
#content .llrc-skeleton {
|
||||
background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.035) 50%, transparent 70%) 0 0 / 200% 100%;
|
||||
animation: llrc-shimmer 1.4s linear infinite;
|
||||
}
|
||||
|
||||
#content .llrc-retry {
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
@keyframes llrc-shimmer {
|
||||
to { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
#content .llrc {
|
||||
position: relative;
|
||||
padding: 18px 20px 14px;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
#content .llrc-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 12px 32px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
#content .llrc-stat {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
#content .llrc-stat-label {
|
||||
color: var(--muted);
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
|
||||
#content .llrc-value {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 30px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
#content .llrc-value.is-pos { color: var(--ok); }
|
||||
#content .llrc-value.is-neg { color: var(--bad); }
|
||||
#content .llrc-value.is-zero { color: var(--color-font1); }
|
||||
|
||||
#content .llrc-of {
|
||||
color: var(--muted);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#content .llrc-progress {
|
||||
flex: 1 1 200px;
|
||||
max-width: 340px;
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
#content .llrc-progress-top {
|
||||
margin-bottom: 7px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#content .llrc-bar {
|
||||
height: 4px;
|
||||
overflow: hidden;
|
||||
background-color: var(--line-strong);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
#content .llrc-bar > span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
}
|
||||
|
||||
#content .llrc-bar > .is-pos { background-color: var(--ok); }
|
||||
#content .llrc-bar > .is-neg { background-color: var(--bad); }
|
||||
|
||||
#content .llrc-games {
|
||||
margin-left: auto;
|
||||
color: var(--muted);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
/* Plot */
|
||||
|
||||
#content .llrc-plot {
|
||||
#content .llrg-plot {
|
||||
position: relative;
|
||||
cursor: crosshair;
|
||||
touch-action: pan-y;
|
||||
@@ -163,171 +20,91 @@
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
#content .llrc-plot:focus-visible {
|
||||
#content .llrg-plot:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 4px;
|
||||
}
|
||||
|
||||
#content .llrc-svg {
|
||||
#content .llrg-svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.llrc-tick {
|
||||
.llrg-bg {
|
||||
fill: var(--color1);
|
||||
stroke: var(--line-strong);
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
.llrg-grid {
|
||||
stroke: rgba(197, 204, 217, 0.09);
|
||||
stroke-width: 1;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.llrg-zero {
|
||||
stroke: #6E7FA6;
|
||||
stroke-width: 1;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.llrg-bound {
|
||||
stroke: var(--bad);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 4 3;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.llrg-tick {
|
||||
fill: var(--muted);
|
||||
font: 500 10.5px var(--font-mono);
|
||||
font: 500 10px var(--font-mono);
|
||||
}
|
||||
|
||||
.llrc-grid {
|
||||
stroke: rgba(197, 204, 217, 0.07);
|
||||
stroke-width: 1;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.llrc-grid-v {
|
||||
stroke: rgba(197, 204, 217, 0.04);
|
||||
}
|
||||
|
||||
.llrc-zero {
|
||||
stroke: rgba(197, 204, 217, 0.3);
|
||||
stroke-width: 1;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
.llrc-zone-pos { fill: rgba(52, 211, 153, 0.05); }
|
||||
.llrc-zone-neg { fill: rgba(248, 113, 113, 0.05); }
|
||||
|
||||
.llrc-bound {
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 5 4;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.llrc-bound-pos { stroke: var(--ok); }
|
||||
.llrc-bound-neg { stroke: var(--bad); }
|
||||
|
||||
.llrc-bound-label {
|
||||
font: 600 10px var(--font-mono);
|
||||
letter-spacing: 0.08em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.llrc-bound-label-pos { fill: var(--ok); }
|
||||
.llrc-bound-label-neg { fill: var(--bad); }
|
||||
|
||||
.llrc-stop-pos { stop-color: var(--ok); }
|
||||
.llrc-stop-neg { stop-color: var(--bad); }
|
||||
|
||||
.llrc-line {
|
||||
.llrg-line {
|
||||
fill: none;
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.llrc-line-pos { stroke: var(--ok); }
|
||||
.llrc-line-neg { stroke: var(--bad); }
|
||||
.llrg-line-pos { stroke: var(--ok); }
|
||||
.llrg-line-neg { stroke: var(--bad); }
|
||||
|
||||
.llrc-line-est {
|
||||
stroke-dasharray: 3 4;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.llrc-animate .llrc-line-solid {
|
||||
stroke-dasharray: 1;
|
||||
stroke-dashoffset: 1;
|
||||
animation: llrc-draw 0.9s cubic-bezier(0.22, 0.7, 0.2, 1) 0.05s forwards;
|
||||
}
|
||||
|
||||
.llrc-animate .llrc-area {
|
||||
animation: llrc-fade 0.8s ease 0.25s both;
|
||||
}
|
||||
|
||||
@keyframes llrc-draw { to { stroke-dashoffset: 0; } }
|
||||
@keyframes llrc-fade { from { opacity: 0; } to { opacity: 1; } }
|
||||
|
||||
/* Latest value marker */
|
||||
|
||||
.llrc-now {
|
||||
stroke: var(--color2);
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.llrc-now.is-pos { fill: var(--ok); }
|
||||
.llrc-now.is-neg { fill: var(--bad); }
|
||||
.llrc-now.is-zero { fill: var(--color-font1); }
|
||||
|
||||
.llrc-now-ring {
|
||||
fill: none;
|
||||
stroke-width: 1.5;
|
||||
transform-box: fill-box;
|
||||
transform-origin: center;
|
||||
animation: llrc-pulse 2s ease-out infinite;
|
||||
}
|
||||
|
||||
.llrc-now-ring.is-pos { stroke: var(--ok); }
|
||||
.llrc-now-ring.is-neg { stroke: var(--bad); }
|
||||
.llrc-now-ring.is-zero { stroke: var(--color-font1); }
|
||||
|
||||
@keyframes llrc-pulse {
|
||||
0% { transform: scale(0.7); opacity: 0.8; }
|
||||
100% { transform: scale(2.6); opacity: 0; }
|
||||
}
|
||||
|
||||
/* Crosshair */
|
||||
|
||||
.llrc-hover {
|
||||
.llrg-hover-line {
|
||||
stroke: var(--color-font1);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 2 2;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.12s ease;
|
||||
}
|
||||
|
||||
.llrc-hover.is-active {
|
||||
opacity: 1;
|
||||
.llrg-hover-dot {
|
||||
fill: var(--color-font1);
|
||||
stroke-width: 1.5;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.llrc-hover-v {
|
||||
stroke: rgba(241, 244, 250, 0.35);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 3 3;
|
||||
.llrg-hover-line.active,
|
||||
.llrg-hover-dot.active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.llrc-hover-h {
|
||||
stroke: rgba(241, 244, 250, 0.14);
|
||||
stroke-width: 1;
|
||||
}
|
||||
.llrg-hover-dot.llrg-pos { stroke: var(--ok); }
|
||||
.llrg-hover-dot.llrg-neg { stroke: var(--bad); }
|
||||
|
||||
.llrc-hover-halo.is-pos { fill: rgba(52, 211, 153, 0.22); }
|
||||
.llrc-hover-halo.is-neg { fill: rgba(248, 113, 113, 0.22); }
|
||||
.llrc-hover-halo.is-zero { fill: rgba(241, 244, 250, 0.2); }
|
||||
|
||||
.llrc-hover-dot {
|
||||
stroke: var(--color1);
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.llrc-hover-dot.is-pos { fill: var(--ok); }
|
||||
.llrc-hover-dot.is-neg { fill: var(--bad); }
|
||||
.llrc-hover-dot.is-zero { fill: var(--color-font1); }
|
||||
|
||||
/* Tooltip */
|
||||
|
||||
#content .llrc-tip {
|
||||
#content .llrg-tip {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
min-width: 120px;
|
||||
padding: 8px 10px;
|
||||
background-color: rgba(11, 14, 20, 0.97);
|
||||
z-index: 1;
|
||||
padding: 0.2rem 0.5rem 0.18rem;
|
||||
background-color: rgba(11, 14, 20, 0.96);
|
||||
border: 1px solid var(--line-strong);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
|
||||
color: var(--color-font1);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
font-size: 0.72rem;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
@@ -335,105 +112,13 @@
|
||||
transition: opacity 0.12s ease, transform 0.12s ease;
|
||||
}
|
||||
|
||||
#content .llrc-tip.is-active {
|
||||
#content .llrg-tip.active {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
#content .llrc-tip-games {
|
||||
color: var(--color-font1);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
#content .llrc-tip-llr {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
#content .llrc-tip-label {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
#content .llrc-tip-value.is-pos { color: var(--ok); }
|
||||
#content .llrc-tip-value.is-neg { color: var(--bad); }
|
||||
#content .llrc-tip-value.is-zero { color: var(--color-font1); }
|
||||
|
||||
#content .llrc-tip-sub {
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Legend */
|
||||
|
||||
#content .llrc-legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px 18px;
|
||||
margin-top: 10px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#content .llrc-key {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
#content .llrc-swatch {
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
#content .llrc-swatch-line { border-top: 2px solid var(--ok); }
|
||||
#content .llrc-swatch-est { border-top: 2px dotted var(--ok); }
|
||||
#content .llrc-swatch-bound { border-top: 1px dashed var(--muted); }
|
||||
|
||||
#content .llrc-hint {
|
||||
margin-left: auto;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
#content .llrc-sr {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
|
||||
#content .llrc {
|
||||
padding: 16px 12px 12px;
|
||||
}
|
||||
|
||||
#content .llrc-hint {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#content .llrc-value {
|
||||
font-size: 26px;
|
||||
}
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
|
||||
.llrc-animate .llrc-line-solid,
|
||||
.llrc-animate .llrc-area,
|
||||
.llrc-now-ring {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.llrc-animate .llrc-line-solid {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
|
||||
#content .llrc-skeleton {
|
||||
animation: none;
|
||||
#content .llrg-tip {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -198,19 +198,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- LLR history for SPRT tests: the data is fetched lazily, and drawn by llr_history.js -->
|
||||
{% if workload.test_mode == "SPRT" %}
|
||||
<div id="llr" class="card">
|
||||
<header class="card-head">
|
||||
<h2 class="card-title">LLR History</h2>
|
||||
</header>
|
||||
<div id="llr-history-container" class="llr-history-loader" data-history-url="{{llr_history_endpoint}}" aria-busy="true">
|
||||
<div class="llrc-skeleton" role="status">Loading history…</div>
|
||||
<!-- LLR history for SPRT tests: fetched lazily, and drawn by llr_history.js -->
|
||||
{% if workload.test_mode == "SPRT" %}
|
||||
<div class="llr-history-panel" title="LLR history over the lifetime of the test">
|
||||
<div class="llr-history-label">LLR History</div>
|
||||
<div id="llr-history-container" class="llr-history-loader" data-history-url="{{llr_history_endpoint}}">
|
||||
<div class="llr-history-placeholder">Loading history graph...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- SPSA Paramater Summary, for Tunes -->
|
||||
{% if type == "TUNE" %}
|
||||
|
||||
Reference in new issue
Block a user