MCPcopy Create free account
hub / github.com/leeoniya/uPlot / autoScaleX

Function autoScaleX

src/uPlot.js:1284–1319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1282 self.setData = setData;
1283
1284 function autoScaleX() {
1285 viaAutoScaleX = true;
1286
1287 let _min, _max;
1288
1289 if (mode == 1) {
1290 if (dataLen > 0) {
1291 i0 = idxs[0] = 0;
1292 i1 = idxs[1] = dataLen - 1;
1293
1294 _min = data[0][i0];
1295 _max = data[0][i1];
1296
1297 if (xScaleDistr == 2) {
1298 _min = i0;
1299 _max = i1;
1300 }
1301 else if (_min == _max) {
1302 if (xScaleDistr == 3)
1303 [_min, _max] = rangeLog(_min, _min, scaleX.log, false);
1304 else if (xScaleDistr == 4)
1305 [_min, _max] = rangeAsinh(_min, _min, scaleX.log, false);
1306 else if (scaleX.time)
1307 _max = _min + round(86400 / ms);
1308 else
1309 [_min, _max] = rangeNum(_min, _max, rangePad, true);
1310 }
1311 }
1312 else {
1313 i0 = idxs[0] = _min = null;
1314 i1 = idxs[1] = _max = null;
1315 }
1316 }
1317
1318 _setScale(xScaleKey, _min, _max);
1319 }
1320
1321 let ctxStroke, ctxFill, ctxWidth, ctxDash, ctxJoin, ctxCap, ctxFont, ctxAlign, ctxBaseline;
1322 let ctxAlpha;

Callers 3

setDataFunction · 0.85
dblClickFunction · 0.85
_initFunction · 0.85

Calls 4

rangeLogFunction · 0.90
rangeAsinhFunction · 0.90
rangeNumFunction · 0.90
_setScaleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…