MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / drawMono

Function drawMono

libs/echarts/echarts.simple.js:34361–34413  ·  view source on GitHub ↗

* Draw smoothed line in monotone, in which only vertical or horizontal bezier * control points will be used. This should be used when points are monotone * either in x or y dimension.

(
    ctx, points, start, segLen, allLen,
    dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls
)

Source from the content-addressed store, hash-verified

34359 * either in x or y dimension.
34360 */
34361function drawMono(
34362 ctx, points, start, segLen, allLen,
34363 dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls
34364) {
34365 var prevIdx = 0;
34366 var idx = start;
34367 for (var k = 0; k < segLen; k++) {
34368 var p = points[idx];
34369 if (idx >= allLen || idx < 0) {
34370 break;
34371 }
34372 if (isPointNull(p)) {
34373 if (connectNulls) {
34374 idx += dir;
34375 continue;
34376 }
34377 break;
34378 }
34379
34380 if (idx === start) {
34381 ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]);
34382 }
34383 else {
34384 if (smooth > 0) {
34385 var prevP = points[prevIdx];
34386 var dim = smoothMonotone === 'y' ? 1 : 0;
34387
34388 // Length of control point to p, either in x or y, but not both
34389 var ctrlLen = (p[dim] - prevP[dim]) * smooth;
34390
34391 v2Copy(cp0, prevP);
34392 cp0[dim] = prevP[dim] + ctrlLen;
34393
34394 v2Copy(cp1, p);
34395 cp1[dim] = p[dim] - ctrlLen;
34396
34397 ctx.bezierCurveTo(
34398 cp0[0], cp0[1],
34399 cp1[0], cp1[1],
34400 p[0], p[1]
34401 );
34402 }
34403 else {
34404 ctx.lineTo(p[0], p[1]);
34405 }
34406 }
34407
34408 prevIdx = idx;
34409 idx += dir;
34410 }
34411
34412 return k;
34413}
34414
34415/**
34416 * Draw smoothed line in non-monotone, in may cause undesired curve in extreme

Callers

nothing calls this directly

Calls 1

isPointNullFunction · 0.70

Tested by

no test coverage detected