update plugin files
This commit is contained in:
@@ -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.1)
|
||||
* https://github.com/leeoniya/uPlot (v1.6.3)
|
||||
*/
|
||||
|
||||
var uPlot = (function () {
|
||||
@@ -336,21 +336,33 @@ var uPlot = (function () {
|
||||
}
|
||||
|
||||
// nullModes
|
||||
var NULL_IGNORE = 0; // all nulls are ignored by isGap
|
||||
var NULL_GAP = 1; // alignment nulls are ignored by isGap (default)
|
||||
var NULL_EXPAND = 2; // nulls are expand to include adjacent alignment nulls
|
||||
var NULL_IGNORE = 0; // all nulls are ignored, converted to undefined (e.g. spanGaps: true)
|
||||
var NULL_GAP = 1; // nulls are retained, alignment artifacts = undefined values (default)
|
||||
var NULL_EXPAND = 2; // nulls are expanded to include adjacent alignment artifacts (undefined values)
|
||||
|
||||
// mark all filler nulls as explicit when adjacent to existing explicit nulls (minesweeper)
|
||||
function nullExpand(yVals, nullIdxs, alignedLen) {
|
||||
for (var i = 0, xi = (void 0), lastNullIdx = -inf; i < nullIdxs.length; i++) {
|
||||
var nullIdx = nullIdxs[i];
|
||||
|
||||
if (nullIdx > lastNullIdx) {
|
||||
xi = nullIdx - 1;
|
||||
while (xi >= 0 && yVals[xi] == null)
|
||||
{ yVals[xi--] = null; }
|
||||
|
||||
xi = nullIdx + 1;
|
||||
while (xi < alignedLen && yVals[xi] == null)
|
||||
{ yVals[lastNullIdx = xi++] = null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nullModes is a tables-matched array indicating how to treat nulls in each series
|
||||
function join(tables, nullModes) {
|
||||
if (tables.length == 1) {
|
||||
return {
|
||||
data: tables[0],
|
||||
isGap: nullModes ? (u, seriesIdx, dataIdx) => nullModes[0][seriesIdx] != NULL_IGNORE : () => true,
|
||||
};
|
||||
}
|
||||
if (tables.length == 1)
|
||||
{ return tables[0]; }
|
||||
|
||||
var xVals = new Set();
|
||||
var xNulls = [new Set()];
|
||||
|
||||
for (var ti = 0; ti < tables.length; ti++) {
|
||||
var t = tables[ti];
|
||||
@@ -359,22 +371,6 @@ var uPlot = (function () {
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
{ xVals.add(xs[i]); }
|
||||
|
||||
for (var si = 1; si < t.length; si++) {
|
||||
var nulls = new Set();
|
||||
|
||||
// cache original nulls for isGap lookup
|
||||
if (nullModes == null || nullModes[ti][si] == NULL_GAP || nullModes[ti][si] == NULL_EXPAND) {
|
||||
var ys = t[si];
|
||||
|
||||
for (var i$1 = 0; i$1 < len; i$1++) {
|
||||
if (ys[i$1] == null)
|
||||
{ nulls.add(xs[i$1]); }
|
||||
}
|
||||
}
|
||||
|
||||
xNulls.push(nulls);
|
||||
}
|
||||
}
|
||||
|
||||
var data = [Array.from(xVals).sort((a, b) => a - b)];
|
||||
@@ -383,67 +379,45 @@ var uPlot = (function () {
|
||||
|
||||
var xIdxs = new Map();
|
||||
|
||||
for (var i$2 = 0; i$2 < alignedLen; i$2++)
|
||||
{ xIdxs.set(data[0][i$2], i$2); }
|
||||
|
||||
var gsi = 1;
|
||||
for (var i$1 = 0; i$1 < alignedLen; i$1++)
|
||||
{ xIdxs.set(data[0][i$1], i$1); }
|
||||
|
||||
for (var ti$1 = 0; ti$1 < tables.length; ti$1++) {
|
||||
var t$1 = tables[ti$1];
|
||||
var xs$1 = t$1[0];
|
||||
|
||||
for (var si$1 = 1; si$1 < t$1.length; si$1++) {
|
||||
var ys$1 = t$1[si$1];
|
||||
for (var si = 1; si < t$1.length; si++) {
|
||||
var ys = t$1[si];
|
||||
|
||||
var yVals = Array(alignedLen).fill(null);
|
||||
var yVals = Array(alignedLen).fill(undefined);
|
||||
|
||||
for (var i$3 = 0; i$3 < ys$1.length; i$3++)
|
||||
{ yVals[xIdxs.get(xs$1[i$3])] = ys$1[i$3]; }
|
||||
var nullMode = nullModes ? nullModes[ti$1][si] : NULL_GAP;
|
||||
|
||||
// mark all filler nulls as explicit when adjacent to existing explicit nulls (minesweeper)
|
||||
if (nullModes && nullModes[ti$1][si$1] == NULL_EXPAND) {
|
||||
var nulls$1 = xNulls[gsi];
|
||||
var size = nulls$1.size;
|
||||
var i$4 = 0;
|
||||
var xi = (void 0);
|
||||
var nullIdxs = [];
|
||||
|
||||
var lastAddedX = -inf;
|
||||
for (var i$2 = 0; i$2 < ys.length; i$2++) {
|
||||
var yVal = ys[i$2];
|
||||
var alignedIdx = xIdxs.get(xs$1[i$2]);
|
||||
|
||||
for (var xVal of nulls$1.values()) {
|
||||
if (i$4++ == size)
|
||||
{ break; }
|
||||
if (yVal == null) {
|
||||
if (nullMode != NULL_IGNORE) {
|
||||
yVals[alignedIdx] = yVal;
|
||||
|
||||
if (xVal > lastAddedX) {
|
||||
var xIdx = xIdxs.get(xVal);
|
||||
|
||||
xi = xIdx - 1;
|
||||
while (yVals[xi] === null) {
|
||||
nulls$1.add(data[0][xi]);
|
||||
xi--;
|
||||
}
|
||||
|
||||
xi = xIdx + 1;
|
||||
while (yVals[xi] === null) {
|
||||
nulls$1.add(lastAddedX = data[0][xi]);
|
||||
xi++;
|
||||
}
|
||||
if (nullMode == NULL_EXPAND)
|
||||
{ nullIdxs.push(alignedIdx); }
|
||||
}
|
||||
}
|
||||
else
|
||||
{ yVals[alignedIdx] = yVal; }
|
||||
}
|
||||
|
||||
data.push(yVals);
|
||||
nullExpand(yVals, nullIdxs, alignedLen);
|
||||
|
||||
gsi++;
|
||||
data.push(yVals);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
data: data,
|
||||
isGap: function isGap(u, seriesIdx, dataIdx) {
|
||||
var xVal = u._data[0][dataIdx];
|
||||
return xNulls[seriesIdx].has(xVal);
|
||||
},
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
var microTask = typeof queueMicrotask == "undefined" ? fn => Promise.resolve().then(fn) : queueMicrotask;
|
||||
@@ -1123,6 +1097,7 @@ var uPlot = (function () {
|
||||
var xAxisOpts = {
|
||||
show: true,
|
||||
scale: "x",
|
||||
stroke: hexBlack,
|
||||
space: 50,
|
||||
gap: 5,
|
||||
size: 50,
|
||||
@@ -1236,6 +1211,7 @@ var uPlot = (function () {
|
||||
var yAxisOpts = {
|
||||
show: true,
|
||||
scale: "y",
|
||||
stroke: hexBlack,
|
||||
space: 30,
|
||||
gap: 5,
|
||||
size: 50,
|
||||
@@ -1270,7 +1246,8 @@ var uPlot = (function () {
|
||||
|
||||
function seriesFillTo(self, seriesIdx, dataMin, dataMax) {
|
||||
var scale = self.scales[self.series[seriesIdx].scale];
|
||||
return scale.distr == 3 ? scale.min : 0;
|
||||
var isUpperBandEdge = self.bands && self.bands.some(b => b.series[0] == seriesIdx);
|
||||
return scale.distr == 3 || isUpperBandEdge ? scale.min : 0;
|
||||
}
|
||||
|
||||
var ySeriesOpts = {
|
||||
@@ -1280,7 +1257,6 @@ var uPlot = (function () {
|
||||
show: true,
|
||||
band: false,
|
||||
spanGaps: false,
|
||||
isGap: (self, seriesIdx, dataIdx) => true,
|
||||
alpha: 1,
|
||||
points: {
|
||||
show: seriesPoints,
|
||||
@@ -1516,8 +1492,6 @@ var uPlot = (function () {
|
||||
drawAcc = drawAccV;
|
||||
}
|
||||
|
||||
var isGap = series.isGap;
|
||||
|
||||
var dir = scaleX.dir * (scaleX.ori == 0 ? 1 : -1);
|
||||
|
||||
var _paths = {stroke: new Path2D(), fill: null, clip: null, band: null};
|
||||
@@ -1554,7 +1528,7 @@ var uPlot = (function () {
|
||||
minY = min(outY, minY);
|
||||
maxY = max(outY, maxY);
|
||||
}
|
||||
else if (!accGaps && isGap(u, seriesIdx, i))
|
||||
else if (!accGaps && dataY[i] === null)
|
||||
{ accGaps = true; }
|
||||
}
|
||||
else {
|
||||
@@ -1575,14 +1549,14 @@ var uPlot = (function () {
|
||||
minY = maxY = outY;
|
||||
|
||||
// prior pixel can have data but still start a gap if ends with null
|
||||
if (x - accX > 1 && dataY[i - dir] == null && isGap(u, seriesIdx, i - dir))
|
||||
if (x - accX > 1 && dataY[i - dir] === null)
|
||||
{ _addGap = true; }
|
||||
}
|
||||
else {
|
||||
minY = inf;
|
||||
maxY = -inf;
|
||||
|
||||
if (!accGaps && isGap(u, seriesIdx, i))
|
||||
if (!accGaps && dataY[i] === null)
|
||||
{ accGaps = true; }
|
||||
}
|
||||
|
||||
@@ -1656,7 +1630,7 @@ var uPlot = (function () {
|
||||
var xPos = valToPosX(xVal, scaleX, xDim, xOff);
|
||||
|
||||
if (yVal == null) {
|
||||
if (series.isGap(u, seriesIdx, i)) {
|
||||
if (yVal === null) {
|
||||
addGap(gaps, prevXPos, xPos);
|
||||
inGap = true;
|
||||
}
|
||||
@@ -1851,7 +1825,7 @@ var uPlot = (function () {
|
||||
var x1 = round(valToPosX(dataX[i], scaleX, xDim, xOff));
|
||||
|
||||
if (yVal1 == null) {
|
||||
if (series.isGap(u, seriesIdx, i)) {
|
||||
if (yVal1 === null) {
|
||||
addGap(gaps, prevXPos, x1);
|
||||
inGap = true;
|
||||
}
|
||||
@@ -2578,7 +2552,7 @@ var uPlot = (function () {
|
||||
s.paths = s.paths || linearPath || retNull;
|
||||
s.fillTo = fnOrSelf(s.fillTo || seriesFillTo);
|
||||
|
||||
s.stroke = fnOrSelf(s.stroke || hexBlack);
|
||||
s.stroke = fnOrSelf(s.stroke || null);
|
||||
s.fill = fnOrSelf(s.fill || null);
|
||||
s._stroke = s._fill = s._paths = null;
|
||||
|
||||
@@ -2652,7 +2626,12 @@ var uPlot = (function () {
|
||||
axis.incrs = fnOrSelf(axis.incrs || ( sc.distr == 2 ? wholeIncrs : (isTime ? (ms == 1 ? timeIncrsMs : timeIncrsS) : numIncrs)));
|
||||
axis.splits = fnOrSelf(axis.splits || (isTime && sc.distr == 1 ? _timeAxisSplits : sc.distr == 3 ? logAxisSplits : numAxisSplits));
|
||||
|
||||
axis.stroke = fnOrSelf(axis.stroke);
|
||||
axis.grid.stroke = fnOrSelf(axis.grid.stroke);
|
||||
axis.ticks.stroke = fnOrSelf(axis.ticks.stroke);
|
||||
|
||||
var av = axis.values;
|
||||
|
||||
axis.values = (
|
||||
isTime ? (
|
||||
isArr(av) ?
|
||||
@@ -2717,11 +2696,6 @@ var uPlot = (function () {
|
||||
var viaAutoScaleX = false;
|
||||
|
||||
function setData(_data, _resetScales) {
|
||||
if (!isArr(_data) && isObj(_data)) {
|
||||
_data.isGap && series.forEach(s => { s.isGap = _data.isGap; });
|
||||
_data = _data.data;
|
||||
}
|
||||
|
||||
_data = _data || [];
|
||||
_data[0] = _data[0] || [];
|
||||
|
||||
@@ -3087,13 +3061,13 @@ var uPlot = (function () {
|
||||
ctx.rect(lft, top, wid, hgt);
|
||||
ctx.clip();
|
||||
|
||||
if (clip != null)
|
||||
{ ctx.clip(clip); }
|
||||
clip && ctx.clip(clip);
|
||||
|
||||
if (!fillBands(si, _fill) && _fill != null)
|
||||
{ ctx.fill(fill); }
|
||||
var isUpperEdge = fillBands(si, _fill);
|
||||
|
||||
width && ctx.stroke(stroke);
|
||||
!isUpperEdge && _fill && fill && ctx.fill(fill);
|
||||
|
||||
width && _stroke && stroke && ctx.stroke(stroke);
|
||||
|
||||
ctx.restore();
|
||||
|
||||
@@ -3301,7 +3275,7 @@ var uPlot = (function () {
|
||||
var x = ori == 1 ? finalPos : 0;
|
||||
|
||||
ctx.font = axis.font[0];
|
||||
ctx.fillStyle = axis.stroke || hexBlack; // rgba?
|
||||
ctx.fillStyle = axis.stroke(self, i); // rgba?
|
||||
ctx.textAlign = axis.align == 1 ? LEFT :
|
||||
axis.align == 2 ? RIGHT :
|
||||
angle > 0 ? LEFT :
|
||||
@@ -3377,7 +3351,7 @@ var uPlot = (function () {
|
||||
basePos,
|
||||
tickSize,
|
||||
roundDec(ticks.width * pxRatio, 3),
|
||||
ticks.stroke,
|
||||
ticks.stroke(self, i),
|
||||
ticks.dash,
|
||||
ticks.cap
|
||||
);
|
||||
@@ -3395,7 +3369,7 @@ var uPlot = (function () {
|
||||
ori == 0 ? plotTop : plotLft,
|
||||
ori == 0 ? plotHgt : plotWid,
|
||||
roundDec(grid.width * pxRatio, 3),
|
||||
grid.stroke,
|
||||
grid.stroke(self, i),
|
||||
grid.dash,
|
||||
grid.cap
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user