MCPcopy
hub / github.com/apache/echarts / scaleRawExtentInfoCreateDeal

Function scaleRawExtentInfoCreateDeal

src/coord/scaleRawExtentInfo.ts:574–627  ·  view source on GitHub ↗
(
    scale: Scale,
    axis: Axis,
    axisDim: DimensionName,
    model: AxisBaseModel,
    from: AxisExtentInfoBuildFrom
)

Source from the content-addressed store, hash-verified

572}
573
574function scaleRawExtentInfoCreateDeal(
575 scale: Scale,
576 axis: Axis,
577 axisDim: DimensionName,
578 model: AxisBaseModel,
579 from: AxisExtentInfoBuildFrom
580): void {
581 const scaleStore = ensureScaleStore(axis);
582 const extent = scaleStore.extent;
583 let requireStartValue = false;
584
585 eachSeriesOnAxis(axis, function (seriesModel) {
586 if (seriesModel.boxCoordinateSystem) {
587 // This supports union extent on case like: pie (or other similar series)
588 // lays out on cartesian2d.
589 const {coord} = getCoordForCoordSysUsageKindBox(seriesModel);
590 const dimIdx = scaleStore.dimIdxInCoord;
591 if (!(dimIdx >= 0)) {
592 if (__DEV__) {
593 // Require `scaleRawExtentInfoEnableBoxCoordSysUsage` have been called to support it.
594 // But if users set it, give a error log but no exceptions.
595 error(`Property "series.coord" is not supported on axis ${seriesModel.boxCoordinateSystem.type}.`);
596 }
597 }
598 // Only `[val1, val2]` case needs to be supported currently.
599 else if (isArray(coord)) {
600 const coordItem = coord[dimIdx];
601 if (coordItem != null && !isArray(coordItem)) {
602 unionExtentFromNumber(extent, scale.parse(coordItem));
603 }
604 }
605 }
606 else if (seriesModel.coordinateSystem) {
607 // NOTE: This data may have been filtered by dataZoom on orthogonal axes.
608 const data = seriesModel.getData();
609 if (data) {
610 const filter = scale.getFilter ? scale.getFilter() : null;
611 each(getDataDimensionsOnAxis(data, axisDim), function (dim) {
612 unionExtentFromExtent(extent, data.getApproximateExtent(dim, filter));
613 });
614 }
615 if (seriesModel.__requireStartValue && seriesModel.__requireStartValue(axis)) {
616 requireStartValue = true;
617 }
618 }
619 });
620
621 const requireContainShape = determineRequireContainShape(scale, axis, model);
622
623 const rawExtentInfo = new ScaleRawExtentInfo(scale, model, extent, requireStartValue, requireContainShape);
624 injectScaleRawExtentInfo(scale, rawExtentInfo, from);
625
626 scaleStore.extent = null; // Clean up
627}
628
629/**
630 * `rawExtentInfo` may not be created in some cases, such as no series declared or extra useless

Callers 1

scaleRawExtentInfoCreateFunction · 0.85

Calls 15

eachSeriesOnAxisFunction · 0.90
errorFunction · 0.90
unionExtentFromNumberFunction · 0.90
getDataDimensionsOnAxisFunction · 0.90
unionExtentFromExtentFunction · 0.90
ensureScaleStoreFunction · 0.85
isArrayFunction · 0.85
injectScaleRawExtentInfoFunction · 0.85
getFilterMethod · 0.80
getApproximateExtentMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…