Update dependencies

This commit is contained in:
Joscha 2023-10-21 16:49:57 +02:00
parent ce331877a8
commit 0d48e0791b
4 changed files with 553 additions and 522 deletions

11
scripts/uPlot.d.ts vendored
View file

@ -277,7 +277,7 @@ declare namespace uPlot {
show?: boolean; // true
/** show series values at current cursor.idx */
live?: boolean; // true
/** swiches primary interaction mode to toggle-one/toggle-all */
/** switches primary interaction mode to toggle-one/toggle-all */
isolate?: boolean; // false
/** series indicators */
markers?: Legend.Markers;
@ -656,6 +656,15 @@ declare namespace uPlot {
/** tuples of canvas pixel coordinates that were used to construct the gaps clip */
gaps?: [from: number, to: number][];
/** line width in CSS pixels, if differs from series.width (for dynamic rendering optimization) */
width?: number;
/** fill style, if differs from series.fill (for dynamic rendering optimization) */
_fill?: CanvasRenderingContext2D['fillStyle'];
/** stroke style, if differs from series.stroke (for dynamic rendering optimization) */
_stroke?: CanvasRenderingContext2D['strokeStyle'];
/** bitmap of whether the band clip should be applied to stroke, fill, or both */
flags?: number;
}

View file

@ -4,7 +4,7 @@
*
* uPlot.js (μPlot)
* A small, fast chart for time series, lines, areas, ohlc & bars
* https://github.com/leeoniya/uPlot (v1.6.25)
* https://github.com/leeoniya/uPlot (v1.6.26)
*/
const FEAT_TIME = true;
@ -2409,7 +2409,14 @@ function bars(opts) {
else
barWid = valToPosX(sizes[0], scaleX, xDim, xOff) - valToPosX(0, scaleX, xDim, xOff); // assumes linear scale (delta from 0)
barWid = pxRound(barWid - strokeWidth);
if (strokeWidth >= barWid)
strokeWidth = 0;
// for small gaps, disable pixel snapping since gap inconsistencies become noticible and annoying
// if (gapWid + extraGap < 5)
// pxRound = retArg0;
barWid = pxRound(clamp(barWid - strokeWidth, minWidth, maxWidth)); // TODO: extraGap?
xShift = (_dirX == 1 ? -strokeWidth / 2 : barWid + strokeWidth / 2);
}
@ -2440,14 +2447,23 @@ function bars(opts) {
let gapWid = colWid * gapFactor;
barWid = pxRound(min(maxWidth, max(minWidth, colWid - gapWid)) - strokeWidth - extraGap);
barWid = colWid - gapWid - extraGap;
if (strokeWidth >= barWid)
strokeWidth = 0;
// for small gaps, disable pixel snapping since gap inconsistencies become noticible and annoying
if (gapWid + extraGap < 5)
pxRound = retArg0;
barWid = pxRound(clamp(colWid - gapWid, minWidth, maxWidth) - strokeWidth - extraGap);
xShift = (align == 0 ? barWid / 2 : align == _dirX ? 0 : barWid) - align * _dirX * extraGap / 2;
// when colWidth is smaller than [min-clamped] bar width (e.g. aligned data values are non-uniform)
// disable clipping of null-valued band bars to avoid clip overlap / bleed into adjacent bars
// (this could still bleed clips of adjacent band/stacked bars into each other, so is far from perfect)
if (barWid > colWid)
if (barWid + strokeWidth > colWid)
bandClipNulls = false;
}
@ -2547,6 +2563,10 @@ function bars(opts) {
if (strokeWidth > 0)
_paths.stroke = multiPath ? strokePaths : stroke;
else if (!multiPath) {
_paths._fill = series._stroke ?? series._fill;
_paths.width = 0;
}
_paths.fill = multiPath ? fillPaths : stroke;
@ -3953,9 +3973,14 @@ function uPlot(opts, data, then) {
function drawSeries() {
if (dataLen > 0) {
series.forEach((s, i) => {
if (i > 0 && s.show && s._paths == null) {
let _idxs = mode == 2 ? [0, data[i][0].length - 1] : getOuterIdxs(data[i]);
s._paths = s.paths(self, i, _idxs[0], _idxs[1]);
if (i > 0 && s.show) {
cacheStrokeFill(i, false);
cacheStrokeFill(i, true);
if (s._paths == null) {
let _idxs = mode == 2 ? [0, data[i][0].length - 1] : getOuterIdxs(data[i]);
s._paths = s.paths(self, i, _idxs[0], _idxs[1]);
}
}
});
@ -3964,15 +3989,10 @@ function uPlot(opts, data, then) {
if (ctxAlpha != s.alpha)
ctx.globalAlpha = ctxAlpha = s.alpha;
{
cacheStrokeFill(i, false);
s._paths && drawPath(i, false);
}
s._paths != null && drawPath(i, false);
{
cacheStrokeFill(i, true);
let _gaps = s._paths ? s._paths.gaps : null;
let _gaps = s._paths != null ? s._paths.gaps : null;
let show = s.points.show(self, i, i0, i1, _gaps);
let idxs = s.points.filter(self, i, show, _gaps);
@ -4002,12 +4022,20 @@ function uPlot(opts, data, then) {
function drawPath(si, _points) {
let s = _points ? series[si].points : series[si];
let strokeStyle = s._stroke;
let fillStyle = s._fill;
let {
stroke,
fill,
clip: gapsClip,
flags,
_stroke: strokeStyle = s._stroke,
_fill: fillStyle = s._fill,
_width: width = s.width,
} = s._paths;
width = roundDec(width * pxRatio, 3);
let { stroke, fill, clip: gapsClip, flags } = s._paths;
let boundsClip = null;
let width = roundDec(s.width * pxRatio, 3);
let offset = (width % 2) / 2;
if (_points && fillStyle == null)
@ -5673,7 +5701,7 @@ function uPlot(opts, data, then) {
else
autoScaleX();
shouldSetSelect = select.show;
shouldSetSelect = select.show && (select.width > 0 || select.height > 0);
shouldSetCursor = shouldSetLegend = true;
_setSize(opts.width, opts.height);