import { AxisModelCommonMixin, AxisTickLabelComputingKind, Axis_default, Component_default, Component_default2, Interval_default, Line_default, Model_default, OrdinalMeta_default, SINGLE_REFERRING, WH, XY, computeLabelGeometry2, createAxisLabelsComputingContext, createBoxLayoutReference, createScaleByModel, createSymbol, createTextStyle, ensureLabelLayoutWithGeometry, enterEmphasis, error, expandOrShrinkRect, fetchLayoutMode, getDataDimensionsOnAxis, getECData, getLabelStatesModels, getLayoutParams, getLayoutRect, getPrecisionSafe, getScaleBreakHelper, getScaleExtent, groupTransition, hideOverlap, ifAxisCrossZero, increaseInterval, initProps, injectCoordSysByOption, isIntervalOrLogScale, isNameLocationCenter, isRadianAroundZero, isValueNice, labelIntersect, labelLayoutApplyTranslation, leaveEmphasis, log, logTransform, makeInner, mathMax, mergeLayoutParam, newLabelLayoutWithGeometry, niceScaleExtent, normalizeSymbolOffset, normalizeSymbolSize, parseFinder, parsePositionSizeOption, remRadian, removeElement, retrieveAxisBreaksOption, retrieveRawValue, round, saveOldStyle, setLabelLayoutDirty, setLabelStyle, setTooltipConfig, shouldAxisShow, shouldShowAllLabels, subPixelOptimizeLine, toggleHoverEmphasis, tokens_default, traverseElements, updateProps, warn } from "./chunk-7TUCBJTM.js"; import { BoundingRect_default, Group_default, Image_default, Point_default, Rect_default, Text_default, __extends, applyTransform, assert, clone, copyTransform, create, createHashMap, curry, defaults, each, eqNaN, extend, filter, find, identity, indexOf, invert, isArray, isFunction, isNumber, isObject, isString, keys, map, merge, mixin, mul, retrieve, retrieve2, retrieve3, rotate } from "./chunk-ZAVXMU2G.js"; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/GridModel.js var OUTER_BOUNDS_DEFAULT = { left: 0, right: 0, top: 0, bottom: 0 }; var OUTER_BOUNDS_CLAMP_DEFAULT = ["25%", "25%"]; var GridModel = ( /** @class */ function(_super) { __extends(GridModel2, _super); function GridModel2() { return _super !== null && _super.apply(this, arguments) || this; } GridModel2.prototype.mergeDefaultAndTheme = function(option, ecModel) { var outerBoundsCp = getLayoutParams(option.outerBounds); _super.prototype.mergeDefaultAndTheme.apply(this, arguments); if (outerBoundsCp && option.outerBounds) { mergeLayoutParam(option.outerBounds, outerBoundsCp); } }; GridModel2.prototype.mergeOption = function(newOption, ecModel) { _super.prototype.mergeOption.apply(this, arguments); if (this.option.outerBounds && newOption.outerBounds) { mergeLayoutParam(this.option.outerBounds, newOption.outerBounds); } }; GridModel2.type = "grid"; GridModel2.dependencies = ["xAxis", "yAxis"]; GridModel2.layoutMode = "box"; GridModel2.defaultOption = { show: false, // zlevel: 0, z: 0, left: "15%", top: 65, right: "10%", bottom: 80, // If grid size contain label containLabel: false, outerBoundsMode: "auto", outerBounds: OUTER_BOUNDS_DEFAULT, outerBoundsContain: "all", outerBoundsClampWidth: OUTER_BOUNDS_CLAMP_DEFAULT[0], outerBoundsClampHeight: OUTER_BOUNDS_CLAMP_DEFAULT[1], // width: {totalWidth} - left - right, // height: {totalHeight} - top - bottom, backgroundColor: tokens_default.color.transparent, borderWidth: 1, borderColor: tokens_default.color.neutral30 }; return GridModel2; }(Component_default) ); var GridModel_default = GridModel; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/AxisModel.js var CartesianAxisModel = ( /** @class */ function(_super) { __extends(CartesianAxisModel2, _super); function CartesianAxisModel2() { return _super !== null && _super.apply(this, arguments) || this; } CartesianAxisModel2.prototype.getCoordSysModel = function() { return this.getReferringComponents("grid", SINGLE_REFERRING).models[0]; }; CartesianAxisModel2.type = "cartesian2dAxis"; return CartesianAxisModel2; }(Component_default) ); mixin(CartesianAxisModel, AxisModelCommonMixin); // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/axisDefault.js var defaultOption = { show: true, // zlevel: 0, z: 0, // Inverse the axis. inverse: false, // Axis name displayed. name: "", // 'start' | 'middle' | 'end' nameLocation: "end", // By degree. By default auto rotate by nameLocation. nameRotate: null, nameTruncate: { maxWidth: null, ellipsis: "...", placeholder: "." }, // Use global text style by default. nameTextStyle: { // textMargin: never, // The default value will be specified based on `nameLocation`. }, // The gap between axisName and axisLine. nameGap: 15, // Default `false` to support tooltip. silent: false, // Default `false` to avoid legacy user event listener fail. triggerEvent: false, tooltip: { show: false }, axisPointer: {}, axisLine: { show: true, onZero: true, onZeroAxisIndex: null, lineStyle: { color: tokens_default.color.axisLine, width: 1, type: "solid" }, // The arrow at both ends the the axis. symbol: ["none", "none"], symbolSize: [10, 15], breakLine: true }, axisTick: { show: true, // Whether axisTick is inside the grid or outside the grid. inside: false, // The length of axisTick. length: 5, lineStyle: { width: 1 } }, axisLabel: { show: true, // Whether axisLabel is inside the grid or outside the grid. inside: false, rotate: 0, // true | false | null/undefined (auto) showMinLabel: null, // true | false | null/undefined (auto) showMaxLabel: null, margin: 8, // formatter: null, fontSize: 12, color: tokens_default.color.axisLabel, // In scenarios like axis labels, when labels text's progression direction matches the label // layout direction (e.g., when all letters are in a single line), extra start/end margin is // needed to prevent the text from appearing visually joined. In the other case, when lables // are stacked (e.g., having rotation or horizontal labels on yAxis), the layout needs to be // compact, so NO extra top/bottom margin should be applied. textMargin: [0, 3] }, splitLine: { show: true, showMinLine: true, showMaxLine: true, lineStyle: { color: tokens_default.color.axisSplitLine, width: 1, type: "solid" } }, splitArea: { show: false, areaStyle: { color: [tokens_default.color.backgroundTint, tokens_default.color.backgroundTransparent] } }, breakArea: { show: true, itemStyle: { color: tokens_default.color.neutral00, // Break border color should be darker than the splitLine // because it has opacity and should be more prominent borderColor: tokens_default.color.border, borderWidth: 1, borderType: [3, 3], opacity: 0.6 }, zigzagAmplitude: 4, zigzagMinSpan: 4, zigzagMaxSpan: 20, zigzagZ: 100, expandOnClick: true }, breakLabelLayout: { moveOverlap: "auto" } }; var categoryAxis = merge({ // The gap at both ends of the axis. For categoryAxis, boolean. boundaryGap: true, // Set false to faster category collection. deduplication: null, jitter: 0, jitterOverlap: true, jitterMargin: 2, // splitArea: { // show: false // }, splitLine: { show: false }, axisTick: { // If tick is align with label when boundaryGap is true alignWithLabel: false, interval: "auto", show: "auto" }, axisLabel: { interval: "auto" } }, defaultOption); var valueAxis = merge({ boundaryGap: [0, 0], axisLine: { // Not shown when other axis is categoryAxis in cartesian show: "auto" }, axisTick: { // Not shown when other axis is categoryAxis in cartesian show: "auto" }, // TODO // min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60] splitNumber: 5, minorTick: { // Minor tick, not available for cateogry axis. show: false, // Split number of minor ticks. The value should be in range of (0, 100) splitNumber: 5, // Length of minor tick length: 3, // Line style lineStyle: { // Default to be same with axisTick } }, minorSplitLine: { show: false, lineStyle: { color: tokens_default.color.axisMinorSplitLine, width: 1 } } }, defaultOption); var timeAxis = merge({ splitNumber: 6, axisLabel: { // To eliminate labels that are not nice showMinLabel: false, showMaxLabel: false, rich: { primary: { fontWeight: "bold" } } }, splitLine: { show: false } }, valueAxis); var logAxis = defaults({ logBase: 10 }, valueAxis); var axisDefault_default = { category: categoryAxis, value: valueAxis, time: timeAxis, log: logAxis }; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/axisCommonTypes.js var AXIS_TYPES = { value: 1, category: 1, time: 1, log: 1 }; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/axisBreakHelper.js var _impl = null; function registerAxisBreakHelperImpl(impl) { if (!_impl) { _impl = impl; } } function getAxisBreakHelper() { return _impl; } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/axisModelCreator.js function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) { each(AXIS_TYPES, function(v, axisType) { var defaultOption2 = merge(merge({}, axisDefault_default[axisType], true), extraDefaultOption, true); var AxisModel = ( /** @class */ function(_super) { __extends(AxisModel2, _super); function AxisModel2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = axisName + "Axis." + axisType; return _this; } AxisModel2.prototype.mergeDefaultAndTheme = function(option, ecModel) { var layoutMode = fetchLayoutMode(this); var inputPositionParams = layoutMode ? getLayoutParams(option) : {}; var themeModel = ecModel.getTheme(); merge(option, themeModel.get(axisType + "Axis")); merge(option, this.getDefaultOption()); option.type = getAxisType(option); if (layoutMode) { mergeLayoutParam(option, inputPositionParams, layoutMode); } }; AxisModel2.prototype.optionUpdated = function() { var thisOption = this.option; if (thisOption.type === "category") { this.__ordinalMeta = OrdinalMeta_default.createByAxisModel(this); } }; AxisModel2.prototype.getCategories = function(rawData) { var option = this.option; if (option.type === "category") { if (rawData) { return option.data; } return this.__ordinalMeta.categories; } }; AxisModel2.prototype.getOrdinalMeta = function() { return this.__ordinalMeta; }; AxisModel2.prototype.updateAxisBreaks = function(payload) { var axisBreakHelper = getAxisBreakHelper(); return axisBreakHelper ? axisBreakHelper.updateModelAxisBreak(this, payload) : { breaks: [] }; }; AxisModel2.type = axisName + "Axis." + axisType; AxisModel2.defaultOption = defaultOption2; return AxisModel2; }(BaseAxisModelClass) ); registers.registerComponentModel(AxisModel); }); registers.registerSubTypeDefaulter(axisName + "Axis", getAxisType); } function getAxisType(option) { return option.type || (option.data ? "category" : "value"); } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/Cartesian.js var Cartesian = ( /** @class */ function() { function Cartesian2(name) { this.type = "cartesian"; this._dimList = []; this._axes = {}; this.name = name || ""; } Cartesian2.prototype.getAxis = function(dim) { return this._axes[dim]; }; Cartesian2.prototype.getAxes = function() { return map(this._dimList, function(dim) { return this._axes[dim]; }, this); }; Cartesian2.prototype.getAxesByScale = function(scaleType) { scaleType = scaleType.toLowerCase(); return filter(this.getAxes(), function(axis) { return axis.scale.type === scaleType; }); }; Cartesian2.prototype.addAxis = function(axis) { var dim = axis.dim; this._axes[dim] = axis; this._dimList.push(dim); }; return Cartesian2; }() ); var Cartesian_default = Cartesian; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/Cartesian2D.js var cartesian2DDimensions = ["x", "y"]; function canCalculateAffineTransform(scale) { return (scale.type === "interval" || scale.type === "time") && !scale.hasBreaks(); } var Cartesian2D = ( /** @class */ function(_super) { __extends(Cartesian2D2, _super); function Cartesian2D2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = "cartesian2d"; _this.dimensions = cartesian2DDimensions; return _this; } Cartesian2D2.prototype.calcAffineTransform = function() { this._transform = this._invTransform = null; var xAxisScale = this.getAxis("x").scale; var yAxisScale = this.getAxis("y").scale; if (!canCalculateAffineTransform(xAxisScale) || !canCalculateAffineTransform(yAxisScale)) { return; } var xScaleExtent = xAxisScale.getExtent(); var yScaleExtent = yAxisScale.getExtent(); var start = this.dataToPoint([xScaleExtent[0], yScaleExtent[0]]); var end = this.dataToPoint([xScaleExtent[1], yScaleExtent[1]]); var xScaleSpan = xScaleExtent[1] - xScaleExtent[0]; var yScaleSpan = yScaleExtent[1] - yScaleExtent[0]; if (!xScaleSpan || !yScaleSpan) { return; } var scaleX = (end[0] - start[0]) / xScaleSpan; var scaleY = (end[1] - start[1]) / yScaleSpan; var translateX = start[0] - xScaleExtent[0] * scaleX; var translateY = start[1] - yScaleExtent[0] * scaleY; var m = this._transform = [scaleX, 0, 0, scaleY, translateX, translateY]; this._invTransform = invert([], m); }; Cartesian2D2.prototype.getBaseAxis = function() { return this.getAxesByScale("ordinal")[0] || this.getAxesByScale("time")[0] || this.getAxis("x"); }; Cartesian2D2.prototype.containPoint = function(point) { var axisX = this.getAxis("x"); var axisY = this.getAxis("y"); return axisX.contain(axisX.toLocalCoord(point[0])) && axisY.contain(axisY.toLocalCoord(point[1])); }; Cartesian2D2.prototype.containData = function(data) { return this.getAxis("x").containData(data[0]) && this.getAxis("y").containData(data[1]); }; Cartesian2D2.prototype.containZone = function(data1, data2) { var zoneDiag1 = this.dataToPoint(data1); var zoneDiag2 = this.dataToPoint(data2); var area = this.getArea(); var zone = new BoundingRect_default(zoneDiag1[0], zoneDiag1[1], zoneDiag2[0] - zoneDiag1[0], zoneDiag2[1] - zoneDiag1[1]); return area.intersect(zone); }; Cartesian2D2.prototype.dataToPoint = function(data, clamp, out) { out = out || []; var xVal = data[0]; var yVal = data[1]; if (this._transform && xVal != null && isFinite(xVal) && yVal != null && isFinite(yVal)) { return applyTransform(out, data, this._transform); } var xAxis = this.getAxis("x"); var yAxis = this.getAxis("y"); out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp)); out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp)); return out; }; Cartesian2D2.prototype.clampData = function(data, out) { var xScale = this.getAxis("x").scale; var yScale = this.getAxis("y").scale; var xAxisExtent = xScale.getExtent(); var yAxisExtent = yScale.getExtent(); var x = xScale.parse(data[0]); var y = yScale.parse(data[1]); out = out || []; out[0] = Math.min(Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x), Math.max(xAxisExtent[0], xAxisExtent[1])); out[1] = Math.min(Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y), Math.max(yAxisExtent[0], yAxisExtent[1])); return out; }; Cartesian2D2.prototype.pointToData = function(point, clamp, out) { out = out || []; if (this._invTransform) { return applyTransform(out, point, this._invTransform); } var xAxis = this.getAxis("x"); var yAxis = this.getAxis("y"); out[0] = xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp); out[1] = yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp); return out; }; Cartesian2D2.prototype.getOtherAxis = function(axis) { return this.getAxis(axis.dim === "x" ? "y" : "x"); }; Cartesian2D2.prototype.getArea = function(tolerance) { tolerance = tolerance || 0; var xExtent = this.getAxis("x").getGlobalExtent(); var yExtent = this.getAxis("y").getGlobalExtent(); var x = Math.min(xExtent[0], xExtent[1]) - tolerance; var y = Math.min(yExtent[0], yExtent[1]) - tolerance; var width = Math.max(xExtent[0], xExtent[1]) - x + tolerance; var height = Math.max(yExtent[0], yExtent[1]) - y + tolerance; return new BoundingRect_default(x, y, width, height); }; return Cartesian2D2; }(Cartesian_default) ); var Cartesian2D_default = Cartesian2D; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/Axis2D.js var Axis2D = ( /** @class */ function(_super) { __extends(Axis2D2, _super); function Axis2D2(dim, scale, coordExtent, axisType, position) { var _this = _super.call(this, dim, scale, coordExtent) || this; _this.index = 0; _this.type = axisType || "value"; _this.position = position || "bottom"; return _this; } Axis2D2.prototype.isHorizontal = function() { var position = this.position; return position === "top" || position === "bottom"; }; Axis2D2.prototype.getGlobalExtent = function(asc) { var ret = this.getExtent(); ret[0] = this.toGlobalCoord(ret[0]); ret[1] = this.toGlobalCoord(ret[1]); asc && ret[0] > ret[1] && ret.reverse(); return ret; }; Axis2D2.prototype.pointToData = function(point, clamp) { return this.coordToData(this.toLocalCoord(point[this.dim === "x" ? 0 : 1]), clamp); }; Axis2D2.prototype.setCategorySortInfo = function(info) { if (this.type !== "category") { return false; } this.model.option.categorySortInfo = info; this.scale.setSortInfo(info); }; return Axis2D2; }(Axis_default) ); var Axis2D_default = Axis2D; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/axisAction.js var AXIS_BREAK_EXPAND_ACTION_TYPE = "expandAxisBreak"; var AXIS_BREAK_COLLAPSE_ACTION_TYPE = "collapseAxisBreak"; var AXIS_BREAK_TOGGLE_ACTION_TYPE = "toggleAxisBreak"; var AXIS_BREAK_CHANGED_EVENT_TYPE = "axisbreakchanged"; var expandAxisBreakActionInfo = { type: AXIS_BREAK_EXPAND_ACTION_TYPE, event: AXIS_BREAK_CHANGED_EVENT_TYPE, update: "update", refineEvent: refineAxisBreakChangeEvent }; var collapseAxisBreakActionInfo = { type: AXIS_BREAK_COLLAPSE_ACTION_TYPE, event: AXIS_BREAK_CHANGED_EVENT_TYPE, update: "update", refineEvent: refineAxisBreakChangeEvent }; var toggleAxisBreakActionInfo = { type: AXIS_BREAK_TOGGLE_ACTION_TYPE, event: AXIS_BREAK_CHANGED_EVENT_TYPE, update: "update", refineEvent: refineAxisBreakChangeEvent }; function refineAxisBreakChangeEvent(actionResultBatch, payload, ecModel, api) { var breaks = []; each(actionResultBatch, function(actionResult) { breaks = breaks.concat(actionResult.eventBreaks); }); return { eventContent: { breaks } }; } function registerAction(registers) { registers.registerAction(expandAxisBreakActionInfo, actionHandler); registers.registerAction(collapseAxisBreakActionInfo, actionHandler); registers.registerAction(toggleAxisBreakActionInfo, actionHandler); function actionHandler(payload, ecModel) { var eventBreaks = []; var finderResult = parseFinder(ecModel, payload); function dealUpdate(modelProp, indexProp) { each(finderResult[modelProp], function(axisModel) { var result = axisModel.updateAxisBreaks(payload); each(result.breaks, function(item) { var _a; eventBreaks.push(defaults((_a = {}, _a[indexProp] = axisModel.componentIndex, _a), item)); }); }); } dealUpdate("xAxisModels", "xAxisIndex"); dealUpdate("yAxisModels", "yAxisIndex"); dealUpdate("singleAxisModels", "singleAxisIndex"); return { eventBreaks }; } } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/AxisBuilder.js var PI = Math.PI; var DEFAULT_CENTER_NAME_MARGIN_LEVELS = [[1, 2, 1, 2], [5, 3, 5, 3], [8, 3, 8, 3]]; var DEFAULT_ENDS_NAME_MARGIN_LEVELS = [[0, 1, 0, 1], [0, 3, 0, 3], [0, 3, 0, 3]]; var getLabelInner = makeInner(); var getTickInner = makeInner(); var AxisBuilderSharedContext = ( /** @class */ function() { function AxisBuilderSharedContext2(resolveAxisNameOverlap) { this.recordMap = {}; this.resolveAxisNameOverlap = resolveAxisNameOverlap; } AxisBuilderSharedContext2.prototype.ensureRecord = function(axisModel) { var dim = axisModel.axis.dim; var idx = axisModel.componentIndex; var recordMap = this.recordMap; var records = recordMap[dim] || (recordMap[dim] = []); return records[idx] || (records[idx] = { ready: {} }); }; return AxisBuilderSharedContext2; }() ); function resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList) { var axis = axisModel.axis; var record = shared.ensureRecord(axisModel); var labelInfoList = []; var stOccupiedRect; var useStOccupiedRect = hasAxisName(cfg.axisName) && isNameLocationCenter(cfg.nameLocation); each(labelLayoutList, function(layout2) { var layoutInfo = ensureLabelLayoutWithGeometry(layout2); if (!layoutInfo || layoutInfo.label.ignore) { return; } labelInfoList.push(layoutInfo); var transGroup = record.transGroup; if (useStOccupiedRect) { transGroup.transform ? invert(_stTransTmp, transGroup.transform) : identity(_stTransTmp); if (layoutInfo.transform) { mul(_stTransTmp, _stTransTmp, layoutInfo.transform); } BoundingRect_default.copy(_stLabelRectTmp, layoutInfo.localRect); _stLabelRectTmp.applyTransform(_stTransTmp); stOccupiedRect ? stOccupiedRect.union(_stLabelRectTmp) : BoundingRect_default.copy(stOccupiedRect = new BoundingRect_default(0, 0, 0, 0), _stLabelRectTmp); } }); var sortByDim = Math.abs(record.dirVec.x) > 0.1 ? "x" : "y"; var sortByValue = record.transGroup[sortByDim]; labelInfoList.sort(function(info1, info2) { return Math.abs(info1.label[sortByDim] - sortByValue) - Math.abs(info2.label[sortByDim] - sortByValue); }); if (useStOccupiedRect && stOccupiedRect) { var extent = axis.getExtent(); var axisLineX = Math.min(extent[0], extent[1]); var axisLineWidth = Math.max(extent[0], extent[1]) - axisLineX; stOccupiedRect.union(new BoundingRect_default(axisLineX, 0, axisLineWidth, 1)); } record.stOccupiedRect = stOccupiedRect; record.labelInfoList = labelInfoList; } var _stTransTmp = create(); var _stLabelRectTmp = new BoundingRect_default(0, 0, 0, 0); var resolveAxisNameOverlapDefault = function(cfg, ctx, axisModel, nameLayoutInfo, nameMoveDirVec, thisRecord) { if (isNameLocationCenter(cfg.nameLocation)) { var stOccupiedRect = thisRecord.stOccupiedRect; if (stOccupiedRect) { moveIfOverlap(computeLabelGeometry2({}, stOccupiedRect, thisRecord.transGroup.transform), nameLayoutInfo, nameMoveDirVec); } } else { moveIfOverlapByLinearLabels(thisRecord.labelInfoList, thisRecord.dirVec, nameLayoutInfo, nameMoveDirVec); } }; function moveIfOverlap(basedLayoutInfo, movableLayoutInfo, moveDirVec) { var mtv = new Point_default(); if (labelIntersect(basedLayoutInfo, movableLayoutInfo, mtv, { direction: Math.atan2(moveDirVec.y, moveDirVec.x), bidirectional: false, touchThreshold: 0.05 })) { labelLayoutApplyTranslation(movableLayoutInfo, mtv); } } function moveIfOverlapByLinearLabels(baseLayoutInfoList, baseDirVec, movableLayoutInfo, moveDirVec) { var sameDir = Point_default.dot(moveDirVec, baseDirVec) >= 0; for (var idx = 0, len = baseLayoutInfoList.length; idx < len; idx++) { var labelInfo = baseLayoutInfoList[sameDir ? idx : len - 1 - idx]; if (!labelInfo.label.ignore) { moveIfOverlap(labelInfo, movableLayoutInfo, moveDirVec); } } } var AxisBuilder = ( /** @class */ function() { function AxisBuilder2(axisModel, api, opt, shared) { this.group = new Group_default(); this._axisModel = axisModel; this._api = api; this._local = {}; this._shared = shared || new AxisBuilderSharedContext(resolveAxisNameOverlapDefault); this._resetCfgDetermined(opt); } AxisBuilder2.prototype.updateCfg = function(opt) { if (true) { var ready = this._shared.ensureRecord(this._axisModel).ready; assert(!ready.axisLine && !ready.axisTickLabelDetermine); ready.axisName = ready.axisTickLabelEstimate = false; } var raw = this._cfg.raw; raw.position = opt.position; raw.labelOffset = opt.labelOffset; this._resetCfgDetermined(raw); }; AxisBuilder2.prototype.__getRawCfg = function() { return this._cfg.raw; }; AxisBuilder2.prototype._resetCfgDetermined = function(raw) { var axisModel = this._axisModel; var axisModelDefaultOption = axisModel.getDefaultOption ? axisModel.getDefaultOption() : {}; var axisName = retrieve2(raw.axisName, axisModel.get("name")); var nameMoveOverlapOption = axisModel.get("nameMoveOverlap"); if (nameMoveOverlapOption == null || nameMoveOverlapOption === "auto") { nameMoveOverlapOption = retrieve2(raw.defaultNameMoveOverlap, true); } var cfg = { raw, position: raw.position, rotation: raw.rotation, nameDirection: retrieve2(raw.nameDirection, 1), tickDirection: retrieve2(raw.tickDirection, 1), labelDirection: retrieve2(raw.labelDirection, 1), labelOffset: retrieve2(raw.labelOffset, 0), silent: retrieve2(raw.silent, true), axisName, nameLocation: retrieve3(axisModel.get("nameLocation"), axisModelDefaultOption.nameLocation, "end"), shouldNameMoveOverlap: hasAxisName(axisName) && nameMoveOverlapOption, optionHideOverlap: axisModel.get(["axisLabel", "hideOverlap"]), showMinorTicks: axisModel.get(["minorTick", "show"]) }; if (true) { assert(cfg.position != null); assert(cfg.rotation != null); } this._cfg = cfg; var transformGroup = new Group_default({ x: cfg.position[0], y: cfg.position[1], rotation: cfg.rotation }); transformGroup.updateTransform(); this._transformGroup = transformGroup; var record = this._shared.ensureRecord(axisModel); record.transGroup = this._transformGroup; record.dirVec = new Point_default(Math.cos(-cfg.rotation), Math.sin(-cfg.rotation)); }; AxisBuilder2.prototype.build = function(axisPartNameMap, extraParams) { var _this = this; if (!axisPartNameMap) { axisPartNameMap = { axisLine: true, axisTickLabelEstimate: false, axisTickLabelDetermine: true, axisName: true }; } each(AXIS_BUILDER_AXIS_PART_NAMES, function(partName) { if (axisPartNameMap[partName]) { builders[partName](_this._cfg, _this._local, _this._shared, _this._axisModel, _this.group, _this._transformGroup, _this._api, extraParams || {}); } }); return this; }; AxisBuilder2.innerTextLayout = function(axisRotation, textRotation, direction) { var rotationDiff = remRadian(textRotation - axisRotation); var textAlign; var textVerticalAlign; if (isRadianAroundZero(rotationDiff)) { textVerticalAlign = direction > 0 ? "top" : "bottom"; textAlign = "center"; } else if (isRadianAroundZero(rotationDiff - PI)) { textVerticalAlign = direction > 0 ? "bottom" : "top"; textAlign = "center"; } else { textVerticalAlign = "middle"; if (rotationDiff > 0 && rotationDiff < PI) { textAlign = direction > 0 ? "right" : "left"; } else { textAlign = direction > 0 ? "left" : "right"; } } return { rotation: rotationDiff, textAlign, textVerticalAlign }; }; AxisBuilder2.makeAxisEventDataBase = function(axisModel) { var eventData = { componentType: axisModel.mainType, componentIndex: axisModel.componentIndex }; eventData[axisModel.mainType + "Index"] = axisModel.componentIndex; return eventData; }; AxisBuilder2.isLabelSilent = function(axisModel) { var tooltipOpt = axisModel.get("tooltip"); return axisModel.get("silent") || !(axisModel.get("triggerEvent") || tooltipOpt && tooltipOpt.show); }; return AxisBuilder2; }() ); var AXIS_BUILDER_AXIS_PART_NAMES = ["axisLine", "axisTickLabelEstimate", "axisTickLabelDetermine", "axisName"]; var builders = { axisLine: function(cfg, local, shared, axisModel, group, transformGroup, api) { if (true) { var ready = shared.ensureRecord(axisModel).ready; assert(!ready.axisLine); ready.axisLine = true; } var shown = axisModel.get(["axisLine", "show"]); if (shown === "auto") { shown = true; if (cfg.raw.axisLineAutoShow != null) { shown = !!cfg.raw.axisLineAutoShow; } } if (!shown) { return; } var extent = axisModel.axis.getExtent(); var matrix = transformGroup.transform; var pt1 = [extent[0], 0]; var pt2 = [extent[1], 0]; var inverse = pt1[0] > pt2[0]; if (matrix) { applyTransform(pt1, pt1, matrix); applyTransform(pt2, pt2, matrix); } var lineStyle = extend({ lineCap: "round" }, axisModel.getModel(["axisLine", "lineStyle"]).getLineStyle()); var pathBaseProp = { strokeContainThreshold: cfg.raw.strokeContainThreshold || 5, silent: true, z2: 1, style: lineStyle }; if (axisModel.get(["axisLine", "breakLine"]) && axisModel.axis.scale.hasBreaks()) { getAxisBreakHelper().buildAxisBreakLine(axisModel, group, transformGroup, pathBaseProp); } else { var line = new Line_default(extend({ shape: { x1: pt1[0], y1: pt1[1], x2: pt2[0], y2: pt2[1] } }, pathBaseProp)); subPixelOptimizeLine(line.shape, line.style.lineWidth); line.anid = "line"; group.add(line); } var arrows = axisModel.get(["axisLine", "symbol"]); if (arrows != null) { var arrowSize = axisModel.get(["axisLine", "symbolSize"]); if (isString(arrows)) { arrows = [arrows, arrows]; } if (isString(arrowSize) || isNumber(arrowSize)) { arrowSize = [arrowSize, arrowSize]; } var arrowOffset = normalizeSymbolOffset(axisModel.get(["axisLine", "symbolOffset"]) || 0, arrowSize); var symbolWidth_1 = arrowSize[0]; var symbolHeight_1 = arrowSize[1]; each([{ rotate: cfg.rotation + Math.PI / 2, offset: arrowOffset[0], r: 0 }, { rotate: cfg.rotation - Math.PI / 2, offset: arrowOffset[1], r: Math.sqrt((pt1[0] - pt2[0]) * (pt1[0] - pt2[0]) + (pt1[1] - pt2[1]) * (pt1[1] - pt2[1])) }], function(point, index) { if (arrows[index] !== "none" && arrows[index] != null) { var symbol = createSymbol(arrows[index], -symbolWidth_1 / 2, -symbolHeight_1 / 2, symbolWidth_1, symbolHeight_1, lineStyle.stroke, true); var r = point.r + point.offset; var pt = inverse ? pt2 : pt1; symbol.attr({ rotation: point.rotate, x: pt[0] + r * Math.cos(cfg.rotation), y: pt[1] - r * Math.sin(cfg.rotation), silent: true, z2: 11 }); group.add(symbol); } }); } }, /** * [CAUTION] This method can be called multiple times, following the change due to `resetCfg` called * in size measurement. Thus this method should be idempotent, and should be performant. */ axisTickLabelEstimate: function(cfg, local, shared, axisModel, group, transformGroup, api, extraParams) { if (true) { var ready = shared.ensureRecord(axisModel).ready; assert(!ready.axisTickLabelDetermine); ready.axisTickLabelEstimate = true; } var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams); if (needCallLayout) { layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.estimate); } }, /** * Finish axis tick label build. * Can be only called once. */ axisTickLabelDetermine: function(cfg, local, shared, axisModel, group, transformGroup, api, extraParams) { if (true) { var ready = shared.ensureRecord(axisModel).ready; ready.axisTickLabelDetermine = true; } var needCallLayout = dealLastTickLabelResultReusable(local, group, extraParams); if (needCallLayout) { layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, AxisTickLabelComputingKind.determine); } var ticksEls = buildAxisMajorTicks(cfg, group, transformGroup, axisModel); syncLabelIgnoreToMajorTicks(cfg, local.labelLayoutList, ticksEls); buildAxisMinorTicks(cfg, group, transformGroup, axisModel, cfg.tickDirection); }, /** * [CAUTION] This method can be called multiple times, following the change due to `resetCfg` called * in size measurement. Thus this method should be idempotent, and should be performant. */ axisName: function(cfg, local, shared, axisModel, group, transformGroup, api, extraParams) { var sharedRecord = shared.ensureRecord(axisModel); if (true) { var ready = sharedRecord.ready; assert(ready.axisTickLabelEstimate || ready.axisTickLabelDetermine); ready.axisName = true; } if (local.nameEl) { group.remove(local.nameEl); local.nameEl = sharedRecord.nameLayout = sharedRecord.nameLocation = null; } var name = cfg.axisName; if (!hasAxisName(name)) { return; } var nameLocation = cfg.nameLocation; var nameDirection = cfg.nameDirection; var textStyleModel = axisModel.getModel("nameTextStyle"); var gap = axisModel.get("nameGap") || 0; var extent = axisModel.axis.getExtent(); var gapStartEndSignal = axisModel.axis.inverse ? -1 : 1; var pos = new Point_default(0, 0); var nameMoveDirVec = new Point_default(0, 0); if (nameLocation === "start") { pos.x = extent[0] - gapStartEndSignal * gap; nameMoveDirVec.x = -gapStartEndSignal; } else if (nameLocation === "end") { pos.x = extent[1] + gapStartEndSignal * gap; nameMoveDirVec.x = gapStartEndSignal; } else { pos.x = (extent[0] + extent[1]) / 2; pos.y = cfg.labelOffset + nameDirection * gap; nameMoveDirVec.y = nameDirection; } var mt = create(); nameMoveDirVec.transform(rotate(mt, mt, cfg.rotation)); var nameRotation = axisModel.get("nameRotate"); if (nameRotation != null) { nameRotation = nameRotation * PI / 180; } var labelLayout; var axisNameAvailableWidth; if (isNameLocationCenter(nameLocation)) { labelLayout = AxisBuilder.innerTextLayout( cfg.rotation, nameRotation != null ? nameRotation : cfg.rotation, // Adapt to axis. nameDirection ); } else { labelLayout = endTextLayout(cfg.rotation, nameLocation, nameRotation || 0, extent); axisNameAvailableWidth = cfg.raw.axisNameAvailableWidth; if (axisNameAvailableWidth != null) { axisNameAvailableWidth = Math.abs(axisNameAvailableWidth / Math.sin(labelLayout.rotation)); !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null); } } var textFont = textStyleModel.getFont(); var truncateOpt = axisModel.get("nameTruncate", true) || {}; var ellipsis = truncateOpt.ellipsis; var maxWidth = retrieve(cfg.raw.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth); var nameMarginLevel = extraParams.nameMarginLevel || 0; var textEl = new Text_default({ x: pos.x, y: pos.y, rotation: labelLayout.rotation, silent: AxisBuilder.isLabelSilent(axisModel), style: createTextStyle(textStyleModel, { text: name, font: textFont, overflow: "truncate", width: maxWidth, ellipsis, fill: textStyleModel.getTextColor() || axisModel.get(["axisLine", "lineStyle", "color"]), align: textStyleModel.get("align") || labelLayout.textAlign, verticalAlign: textStyleModel.get("verticalAlign") || labelLayout.textVerticalAlign }), z2: 1 }); setTooltipConfig({ el: textEl, componentModel: axisModel, itemName: name }); textEl.__fullText = name; textEl.anid = "name"; if (axisModel.get("triggerEvent")) { var eventData = AxisBuilder.makeAxisEventDataBase(axisModel); eventData.targetType = "axisName"; eventData.name = name; getECData(textEl).eventData = eventData; } transformGroup.add(textEl); textEl.updateTransform(); local.nameEl = textEl; var nameLayout = sharedRecord.nameLayout = ensureLabelLayoutWithGeometry({ label: textEl, priority: textEl.z2, defaultAttr: { ignore: textEl.ignore }, marginDefault: isNameLocationCenter(nameLocation) ? DEFAULT_CENTER_NAME_MARGIN_LEVELS[nameMarginLevel] : DEFAULT_ENDS_NAME_MARGIN_LEVELS[nameMarginLevel] }); sharedRecord.nameLocation = nameLocation; group.add(textEl); textEl.decomposeTransform(); if (cfg.shouldNameMoveOverlap && nameLayout) { var record = shared.ensureRecord(axisModel); if (true) { assert(record.labelInfoList); } shared.resolveAxisNameOverlap(cfg, shared, axisModel, nameLayout, nameMoveDirVec, record); } } }; function layOutAxisTickLabel(cfg, local, shared, axisModel, group, transformGroup, api, kind) { if (!axisLabelBuildResultExists(local)) { buildAxisLabel(cfg, local, group, kind, axisModel, api); } var labelLayoutList = local.labelLayoutList; updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup); adjustBreakLabels(axisModel, cfg.rotation, labelLayoutList); var optionHideOverlap = cfg.optionHideOverlap; fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap); if (optionHideOverlap) { hideOverlap( // Filter the already ignored labels by the previous overlap resolving methods. filter(labelLayoutList, function(layout2) { return layout2 && !layout2.label.ignore; }) ); } resetOverlapRecordToShared(cfg, shared, axisModel, labelLayoutList); } function endTextLayout(rotation, textPosition, textRotate, extent) { var rotationDiff = remRadian(textRotate - rotation); var textAlign; var textVerticalAlign; var inverse = extent[0] > extent[1]; var onLeft = textPosition === "start" && !inverse || textPosition !== "start" && inverse; if (isRadianAroundZero(rotationDiff - PI / 2)) { textVerticalAlign = onLeft ? "bottom" : "top"; textAlign = "center"; } else if (isRadianAroundZero(rotationDiff - PI * 1.5)) { textVerticalAlign = onLeft ? "top" : "bottom"; textAlign = "center"; } else { textVerticalAlign = "middle"; if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) { textAlign = onLeft ? "left" : "right"; } else { textAlign = onLeft ? "right" : "left"; } } return { rotation: rotationDiff, textAlign, textVerticalAlign }; } function fixMinMaxLabelShow(axisModel, labelLayoutList, optionHideOverlap) { if (shouldShowAllLabels(axisModel.axis)) { return; } function deal(showMinMaxLabel, outmostLabelIdx, innerLabelIdx) { var outmostLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[outmostLabelIdx]); var innerLabelLayout = ensureLabelLayoutWithGeometry(labelLayoutList[innerLabelIdx]); if (!outmostLabelLayout || !innerLabelLayout) { return; } if (showMinMaxLabel === false || outmostLabelLayout.suggestIgnore) { ignoreEl(outmostLabelLayout.label); return; } if (innerLabelLayout.suggestIgnore) { ignoreEl(innerLabelLayout.label); return; } var touchThreshold = 0.1; if (!optionHideOverlap) { var marginForce = [0, 0, 0, 0]; outmostLabelLayout = newLabelLayoutWithGeometry({ marginForce }, outmostLabelLayout); innerLabelLayout = newLabelLayoutWithGeometry({ marginForce }, innerLabelLayout); } if (labelIntersect(outmostLabelLayout, innerLabelLayout, null, { touchThreshold })) { if (showMinMaxLabel) { ignoreEl(innerLabelLayout.label); } else { ignoreEl(outmostLabelLayout.label); } } } var showMinLabel = axisModel.get(["axisLabel", "showMinLabel"]); var showMaxLabel = axisModel.get(["axisLabel", "showMaxLabel"]); var labelsLen = labelLayoutList.length; deal(showMinLabel, 0, 1); deal(showMaxLabel, labelsLen - 1, labelsLen - 2); } function syncLabelIgnoreToMajorTicks(cfg, labelLayoutList, tickEls) { if (cfg.showMinorTicks) { return; } each(labelLayoutList, function(labelLayout) { if (labelLayout && labelLayout.label.ignore) { for (var idx = 0; idx < tickEls.length; idx++) { var tickEl = tickEls[idx]; var tickInner = getTickInner(tickEl); var labelInner = getLabelInner(labelLayout.label); if (tickInner.tickValue != null && !tickInner.onBand && tickInner.tickValue === labelInner.tickValue) { ignoreEl(tickEl); return; } } } }); } function ignoreEl(el) { el && (el.ignore = true); } function createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, anidPrefix) { var tickEls = []; var pt1 = []; var pt2 = []; for (var i = 0; i < ticksCoords.length; i++) { var tickCoord = ticksCoords[i].coord; pt1[0] = tickCoord; pt1[1] = 0; pt2[0] = tickCoord; pt2[1] = tickEndCoord; if (tickTransform) { applyTransform(pt1, pt1, tickTransform); applyTransform(pt2, pt2, tickTransform); } var tickEl = new Line_default({ shape: { x1: pt1[0], y1: pt1[1], x2: pt2[0], y2: pt2[1] }, style: tickLineStyle, z2: 2, autoBatch: true, silent: true }); subPixelOptimizeLine(tickEl.shape, tickEl.style.lineWidth); tickEl.anid = anidPrefix + "_" + ticksCoords[i].tickValue; tickEls.push(tickEl); var inner2 = getTickInner(tickEl); inner2.onBand = !!ticksCoords[i].onBand; inner2.tickValue = ticksCoords[i].tickValue; } return tickEls; } function buildAxisMajorTicks(cfg, group, transformGroup, axisModel) { var axis = axisModel.axis; var tickModel = axisModel.getModel("axisTick"); var shown = tickModel.get("show"); if (shown === "auto") { shown = true; if (cfg.raw.axisTickAutoShow != null) { shown = !!cfg.raw.axisTickAutoShow; } } if (!shown || axis.scale.isBlank()) { return []; } var lineStyleModel = tickModel.getModel("lineStyle"); var tickEndCoord = cfg.tickDirection * tickModel.get("length"); var ticksCoords = axis.getTicksCoords(); var ticksEls = createTicks(ticksCoords, transformGroup.transform, tickEndCoord, defaults(lineStyleModel.getLineStyle(), { stroke: axisModel.get(["axisLine", "lineStyle", "color"]) }), "ticks"); for (var i = 0; i < ticksEls.length; i++) { group.add(ticksEls[i]); } return ticksEls; } function buildAxisMinorTicks(cfg, group, transformGroup, axisModel, tickDirection) { var axis = axisModel.axis; var minorTickModel = axisModel.getModel("minorTick"); if (!cfg.showMinorTicks || axis.scale.isBlank()) { return; } var minorTicksCoords = axis.getMinorTicksCoords(); if (!minorTicksCoords.length) { return; } var lineStyleModel = minorTickModel.getModel("lineStyle"); var tickEndCoord = tickDirection * minorTickModel.get("length"); var minorTickLineStyle = defaults(lineStyleModel.getLineStyle(), defaults(axisModel.getModel("axisTick").getLineStyle(), { stroke: axisModel.get(["axisLine", "lineStyle", "color"]) })); for (var i = 0; i < minorTicksCoords.length; i++) { var minorTicksEls = createTicks(minorTicksCoords[i], transformGroup.transform, tickEndCoord, minorTickLineStyle, "minorticks_" + i); for (var k = 0; k < minorTicksEls.length; k++) { group.add(minorTicksEls[k]); } } } function dealLastTickLabelResultReusable(local, group, extraParams) { if (axisLabelBuildResultExists(local)) { var axisLabelsCreationContext = local.axisLabelsCreationContext; if (true) { assert(local.labelGroup && axisLabelsCreationContext); } var noPxChangeTryDetermine = axisLabelsCreationContext.out.noPxChangeTryDetermine; if (extraParams.noPxChange) { var canDetermine = true; for (var idx = 0; idx < noPxChangeTryDetermine.length; idx++) { canDetermine = canDetermine && noPxChangeTryDetermine[idx](); } if (canDetermine) { return false; } } if (noPxChangeTryDetermine.length) { group.remove(local.labelGroup); axisLabelBuildResultSet(local, null, null, null); } } return true; } function buildAxisLabel(cfg, local, group, kind, axisModel, api) { var axis = axisModel.axis; var show = retrieve(cfg.raw.axisLabelShow, axisModel.get(["axisLabel", "show"])); var labelGroup = new Group_default(); group.add(labelGroup); var axisLabelCreationCtx = createAxisLabelsComputingContext(kind); if (!show || axis.scale.isBlank()) { axisLabelBuildResultSet(local, [], labelGroup, axisLabelCreationCtx); return; } var labelModel = axisModel.getModel("axisLabel"); var labels = axis.getViewLabels(axisLabelCreationCtx); var labelRotation = (retrieve(cfg.raw.labelRotate, labelModel.get("rotate")) || 0) * PI / 180; var labelLayout = AxisBuilder.innerTextLayout(cfg.rotation, labelRotation, cfg.labelDirection); var rawCategoryData = axisModel.getCategories && axisModel.getCategories(true); var labelEls = []; var triggerEvent = axisModel.get("triggerEvent"); var z2Min = Infinity; var z2Max = -Infinity; each(labels, function(labelItem, index) { var _a; var tickValue = axis.scale.type === "ordinal" ? axis.scale.getRawOrdinalNumber(labelItem.tickValue) : labelItem.tickValue; var formattedLabel = labelItem.formattedLabel; var rawLabel = labelItem.rawLabel; var itemLabelModel = labelModel; if (rawCategoryData && rawCategoryData[tickValue]) { var rawCategoryItem = rawCategoryData[tickValue]; if (isObject(rawCategoryItem) && rawCategoryItem.textStyle) { itemLabelModel = new Model_default(rawCategoryItem.textStyle, labelModel, axisModel.ecModel); } } var textColor = itemLabelModel.getTextColor() || axisModel.get(["axisLine", "lineStyle", "color"]); var align = itemLabelModel.getShallow("align", true) || labelLayout.textAlign; var alignMin = retrieve2(itemLabelModel.getShallow("alignMinLabel", true), align); var alignMax = retrieve2(itemLabelModel.getShallow("alignMaxLabel", true), align); var verticalAlign = itemLabelModel.getShallow("verticalAlign", true) || itemLabelModel.getShallow("baseline", true) || labelLayout.textVerticalAlign; var verticalAlignMin = retrieve2(itemLabelModel.getShallow("verticalAlignMinLabel", true), verticalAlign); var verticalAlignMax = retrieve2(itemLabelModel.getShallow("verticalAlignMaxLabel", true), verticalAlign); var z2 = 10 + (((_a = labelItem.time) === null || _a === void 0 ? void 0 : _a.level) || 0); z2Min = Math.min(z2Min, z2); z2Max = Math.max(z2Max, z2); var textEl = new Text_default({ // --- transform props start --- // All of the transform props MUST not be set here, but should be set in // `updateAxisLabelChangableProps`, because they may change in estimation, // and need to calculate based on global coord sys by `decomposeTransform`. x: 0, y: 0, rotation: 0, // --- transform props end --- silent: AxisBuilder.isLabelSilent(axisModel), z2, style: createTextStyle(itemLabelModel, { text: formattedLabel, align: index === 0 ? alignMin : index === labels.length - 1 ? alignMax : align, verticalAlign: index === 0 ? verticalAlignMin : index === labels.length - 1 ? verticalAlignMax : verticalAlign, fill: isFunction(textColor) ? textColor( // (1) In category axis with data zoom, tick is not the original // index of axis.data. So tick should not be exposed to user // in category axis. // (2) Compatible with previous version, which always use formatted label as // input. But in interval scale the formatted label is like '223,445', which // maked user replace ','. So we modify it to return original val but remain // it as 'string' to avoid error in replacing. axis.type === "category" ? rawLabel : axis.type === "value" ? tickValue + "" : tickValue, index ) : textColor }) }); textEl.anid = "label_" + tickValue; var inner2 = getLabelInner(textEl); inner2["break"] = labelItem["break"]; inner2.tickValue = tickValue; inner2.layoutRotation = labelLayout.rotation; setTooltipConfig({ el: textEl, componentModel: axisModel, itemName: formattedLabel, formatterParamsExtra: { isTruncated: function() { return textEl.isTruncated; }, value: rawLabel, tickIndex: index } }); if (triggerEvent) { var eventData = AxisBuilder.makeAxisEventDataBase(axisModel); eventData.targetType = "axisLabel"; eventData.value = rawLabel; eventData.tickIndex = index; if (labelItem["break"]) { eventData["break"] = { // type: labelItem.break.type, start: labelItem["break"].parsedBreak.vmin, end: labelItem["break"].parsedBreak.vmax }; } if (axis.type === "category") { eventData.dataIndex = tickValue; } getECData(textEl).eventData = eventData; if (labelItem["break"]) { addBreakEventHandler(axisModel, api, textEl, labelItem["break"]); } } labelEls.push(textEl); labelGroup.add(textEl); }); var labelLayoutList = map(labelEls, function(label) { return { label, priority: getLabelInner(label)["break"] ? label.z2 + (z2Max - z2Min + 1) : label.z2, defaultAttr: { ignore: label.ignore } }; }); axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelCreationCtx); } function axisLabelBuildResultExists(local) { return !!local.labelLayoutList; } function axisLabelBuildResultSet(local, labelLayoutList, labelGroup, axisLabelsCreationContext) { local.labelLayoutList = labelLayoutList; local.labelGroup = labelGroup; local.axisLabelsCreationContext = axisLabelsCreationContext; } function updateAxisLabelChangableProps(cfg, axisModel, labelLayoutList, transformGroup) { var labelMargin = axisModel.get(["axisLabel", "margin"]); each(labelLayoutList, function(layout2, idx) { var geometry = ensureLabelLayoutWithGeometry(layout2); if (!geometry) { return; } var labelEl = geometry.label; var inner2 = getLabelInner(labelEl); geometry.suggestIgnore = labelEl.ignore; labelEl.ignore = false; copyTransform(_tmpLayoutEl, _tmpLayoutElReset); _tmpLayoutEl.x = axisModel.axis.dataToCoord(inner2.tickValue); _tmpLayoutEl.y = cfg.labelOffset + cfg.labelDirection * labelMargin; _tmpLayoutEl.rotation = inner2.layoutRotation; transformGroup.add(_tmpLayoutEl); _tmpLayoutEl.updateTransform(); transformGroup.remove(_tmpLayoutEl); _tmpLayoutEl.decomposeTransform(); copyTransform(labelEl, _tmpLayoutEl); labelEl.markRedraw(); setLabelLayoutDirty(geometry, true); ensureLabelLayoutWithGeometry(geometry); }); } var _tmpLayoutEl = new Rect_default(); var _tmpLayoutElReset = new Rect_default(); function hasAxisName(axisName) { return !!axisName; } function addBreakEventHandler(axisModel, api, textEl, visualBreak) { textEl.on("click", function(params) { var payload = { type: AXIS_BREAK_EXPAND_ACTION_TYPE, breaks: [{ start: visualBreak.parsedBreak.breakOption.start, end: visualBreak.parsedBreak.breakOption.end }] }; payload[axisModel.axis.dim + "AxisIndex"] = axisModel.componentIndex; api.dispatchAction(payload); }); } function adjustBreakLabels(axisModel, axisRotation, labelLayoutList) { var scaleBreakHelper = getScaleBreakHelper(); if (!scaleBreakHelper) { return; } var breakLabelIndexPairs = scaleBreakHelper.retrieveAxisBreakPairs(labelLayoutList, function(layoutInfo) { return layoutInfo && getLabelInner(layoutInfo.label)["break"]; }, true); var moveOverlap = axisModel.get(["breakLabelLayout", "moveOverlap"], true); if (moveOverlap === true || moveOverlap === "auto") { each(breakLabelIndexPairs, function(idxPair) { getAxisBreakHelper().adjustBreakLabelPair(axisModel.axis.inverse, axisRotation, [ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[0]]), ensureLabelLayoutWithGeometry(labelLayoutList[idxPair[1]])]); }); } } var AxisBuilder_default = AxisBuilder; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/cartesianAxisHelper.js function layout(rect, axisModel, opt) { opt = opt || {}; var axis = axisModel.axis; var layout2 = {}; var otherAxisOnZeroOf = axis.getAxesOnZeroOf()[0]; var rawAxisPosition = axis.position; var axisPosition = otherAxisOnZeroOf ? "onZero" : rawAxisPosition; var axisDim = axis.dim; var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; var idx = { left: 0, right: 1, top: 0, bottom: 1, onZero: 2 }; var axisOffset = axisModel.get("offset") || 0; var posBound = axisDim === "x" ? [rectBound[2] - axisOffset, rectBound[3] + axisOffset] : [rectBound[0] - axisOffset, rectBound[1] + axisOffset]; if (otherAxisOnZeroOf) { var onZeroCoord = otherAxisOnZeroOf.toGlobalCoord(otherAxisOnZeroOf.dataToCoord(0)); posBound[idx.onZero] = Math.max(Math.min(onZeroCoord, posBound[1]), posBound[0]); } layout2.position = [axisDim === "y" ? posBound[idx[axisPosition]] : rectBound[0], axisDim === "x" ? posBound[idx[axisPosition]] : rectBound[3]]; layout2.rotation = Math.PI / 2 * (axisDim === "x" ? 0 : 1); var dirMap = { top: -1, bottom: 1, left: -1, right: 1 }; layout2.labelDirection = layout2.tickDirection = layout2.nameDirection = dirMap[rawAxisPosition]; layout2.labelOffset = otherAxisOnZeroOf ? posBound[idx[rawAxisPosition]] - posBound[idx.onZero] : 0; if (axisModel.get(["axisTick", "inside"])) { layout2.tickDirection = -layout2.tickDirection; } if (retrieve(opt.labelInside, axisModel.get(["axisLabel", "inside"]))) { layout2.labelDirection = -layout2.labelDirection; } var labelRotate = axisModel.get(["axisLabel", "rotate"]); layout2.labelRotate = axisPosition === "top" ? -labelRotate : labelRotate; layout2.z2 = 1; return layout2; } function isCartesian2DInjectedAsDataCoordSys(seriesModel) { return seriesModel.coordinateSystem && seriesModel.coordinateSystem.type === "cartesian2d"; } function findAxisModels(seriesModel) { var axisModelMap = { xAxisModel: null, yAxisModel: null }; each(axisModelMap, function(v, key) { var axisType = key.replace(/Model$/, ""); var axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0]; if (true) { if (!axisModel) { throw new Error(axisType + ' "' + retrieve3(seriesModel.get(axisType + "Index"), seriesModel.get(axisType + "Id"), 0) + '" not found'); } } axisModelMap[key] = axisModel; }); return axisModelMap; } function createCartesianAxisViewCommonPartBuilder(gridRect, cartesians, axisModel, api, ctx, defaultNameMoveOverlap) { var layoutResult = layout(gridRect, axisModel); var axisLineAutoShow = false; var axisTickAutoShow = false; for (var i = 0; i < cartesians.length; i++) { if (isIntervalOrLogScale(cartesians[i].getOtherAxis(axisModel.axis).scale)) { axisLineAutoShow = axisTickAutoShow = true; if (axisModel.axis.type === "category" && axisModel.axis.onBand) { axisTickAutoShow = false; } } } layoutResult.axisLineAutoShow = axisLineAutoShow; layoutResult.axisTickAutoShow = axisTickAutoShow; layoutResult.defaultNameMoveOverlap = defaultNameMoveOverlap; return new AxisBuilder_default(axisModel, api, layoutResult, ctx); } function updateCartesianAxisViewCommonPartBuilder(axisBuilder, gridRect, axisModel) { var newRaw = layout(gridRect, axisModel); if (true) { var oldRaw_1 = axisBuilder.__getRawCfg(); each(keys(newRaw), function(prop) { if (prop !== "position" && prop !== "labelOffset") { assert(newRaw[prop] === oldRaw_1[prop]); } }); } axisBuilder.updateCfg(newRaw); } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/axisAlignTicks.js function alignScaleTicks(scale, axisModel, alignToScale) { var _a; var intervalScaleProto = Interval_default.prototype; var alignToTicks = intervalScaleProto.getTicks.call(alignToScale); var alignToNicedTicks = intervalScaleProto.getTicks.call(alignToScale, { expandToNicedExtent: true }); var alignToSplitNumber = alignToTicks.length - 1; var alignToInterval = intervalScaleProto.getInterval.call(alignToScale); var scaleExtent = getScaleExtent(scale, axisModel); var rawExtent = scaleExtent.extent; var isMinFixed = scaleExtent.fixMin; var isMaxFixed = scaleExtent.fixMax; if (scale.type === "log") { rawExtent = logTransform(scale.base, rawExtent, true); } scale.setBreaksFromOption(retrieveAxisBreaksOption(axisModel)); scale.setExtent(rawExtent[0], rawExtent[1]); scale.calcNiceExtent({ splitNumber: alignToSplitNumber, fixMin: isMinFixed, fixMax: isMaxFixed }); var extent = intervalScaleProto.getExtent.call(scale); if (isMinFixed) { rawExtent[0] = extent[0]; } if (isMaxFixed) { rawExtent[1] = extent[1]; } var interval = intervalScaleProto.getInterval.call(scale); var min = rawExtent[0]; var max = rawExtent[1]; if (isMinFixed && isMaxFixed) { interval = (max - min) / alignToSplitNumber; } else if (isMinFixed) { max = rawExtent[0] + interval * alignToSplitNumber; while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])) { interval = increaseInterval(interval); max = rawExtent[0] + interval * alignToSplitNumber; } } else if (isMaxFixed) { min = rawExtent[1] - interval * alignToSplitNumber; while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])) { interval = increaseInterval(interval); min = rawExtent[1] - interval * alignToSplitNumber; } } else { var nicedSplitNumber = scale.getTicks().length - 1; if (nicedSplitNumber > alignToSplitNumber) { interval = increaseInterval(interval); } var range = interval * alignToSplitNumber; max = Math.ceil(rawExtent[1] / interval) * interval; min = round(max - range); if (min < 0 && rawExtent[0] >= 0) { min = 0; max = round(range); } else if (max > 0 && rawExtent[1] <= 0) { max = 0; min = -round(range); } } var t0 = (alignToTicks[0].value - alignToNicedTicks[0].value) / alignToInterval; var t1 = (alignToTicks[alignToSplitNumber].value - alignToNicedTicks[alignToSplitNumber].value) / alignToInterval; intervalScaleProto.setExtent.call(scale, min + interval * t0, max + interval * t1); intervalScaleProto.setInterval.call(scale, interval); if (t0 || t1) { intervalScaleProto.setNiceExtent.call(scale, min + interval, max - interval); } if (true) { var ticks = intervalScaleProto.getTicks.call(scale); if (ticks[1] && (!isValueNice(interval) || getPrecisionSafe(ticks[1].value) > getPrecisionSafe(interval))) { warn("The ticks may be not readable when set min: " + axisModel.get("min") + ", max: " + axisModel.get("max") + (" and alignTicks: true. (" + ((_a = axisModel.axis) === null || _a === void 0 ? void 0 : _a.dim) + "AxisIndex: " + axisModel.componentIndex + ")"), true); } } } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/coord/cartesian/Grid.js var XY_TO_MARGIN_IDX = [ [3, 1], [0, 2] // xyIdx 1 => 'y' ]; var Grid = ( /** @class */ function() { function Grid2(gridModel, ecModel, api) { this.type = "grid"; this._coordsMap = {}; this._coordsList = []; this._axesMap = {}; this._axesList = []; this.axisPointerEnabled = true; this.dimensions = cartesian2DDimensions; this._initCartesian(gridModel, ecModel, api); this.model = gridModel; } Grid2.prototype.getRect = function() { return this._rect; }; Grid2.prototype.update = function(ecModel, api) { var axesMap = this._axesMap; this._updateScale(ecModel, this.model); function updateAxisTicks(axes) { var alignTo; var axesIndices = keys(axes); var len = axesIndices.length; if (!len) { return; } var axisNeedsAlign = []; for (var i = len - 1; i >= 0; i--) { var idx = +axesIndices[i]; var axis = axes[idx]; var model = axis.model; var scale = axis.scale; if ( // Only value and log axis without interval support alignTicks. isIntervalOrLogScale(scale) && model.get("alignTicks") && model.get("interval") == null ) { axisNeedsAlign.push(axis); } else { niceScaleExtent(scale, model); if (isIntervalOrLogScale(scale)) { alignTo = axis; } } } ; if (axisNeedsAlign.length) { if (!alignTo) { alignTo = axisNeedsAlign.pop(); niceScaleExtent(alignTo.scale, alignTo.model); } each(axisNeedsAlign, function(axis2) { alignScaleTicks(axis2.scale, axis2.model, alignTo.scale); }); } } updateAxisTicks(axesMap.x); updateAxisTicks(axesMap.y); var onZeroRecords = {}; each(axesMap.x, function(xAxis) { fixAxisOnZero(axesMap, "y", xAxis, onZeroRecords); }); each(axesMap.y, function(yAxis) { fixAxisOnZero(axesMap, "x", yAxis, onZeroRecords); }); this.resize(this.model, api); }; Grid2.prototype.resize = function(gridModel, api, beforeDataProcessing) { var layoutRef = createBoxLayoutReference(gridModel, api); var gridRect = this._rect = getLayoutRect(gridModel.getBoxLayoutParams(), layoutRef.refContainer); var axesMap = this._axesMap; var coordsList = this._coordsList; var optionContainLabel = gridModel.get("containLabel"); updateAllAxisExtentTransByGridRect(axesMap, gridRect); if (!beforeDataProcessing) { var axisBuilderSharedCtx = createAxisBiulders(gridRect, coordsList, axesMap, optionContainLabel, api); var noPxChange = void 0; if (optionContainLabel) { if (legacyLayOutGridByContainLabel) { legacyLayOutGridByContainLabel(this._axesList, gridRect); updateAllAxisExtentTransByGridRect(axesMap, gridRect); } else { if (true) { log("Specified `grid.containLabel` but no `use(LegacyGridContainLabel)`;use `grid.outerBounds` instead.", true); } noPxChange = layOutGridByOuterBounds(gridRect.clone(), "axisLabel", null, gridRect, axesMap, axisBuilderSharedCtx, layoutRef); } } else { var _a = prepareOuterBounds(gridModel, gridRect, layoutRef), outerBoundsRect = _a.outerBoundsRect, parsedOuterBoundsContain = _a.parsedOuterBoundsContain, outerBoundsClamp = _a.outerBoundsClamp; if (outerBoundsRect) { noPxChange = layOutGridByOuterBounds(outerBoundsRect, parsedOuterBoundsContain, outerBoundsClamp, gridRect, axesMap, axisBuilderSharedCtx, layoutRef); } } createOrUpdateAxesView(gridRect, axesMap, AxisTickLabelComputingKind.determine, null, noPxChange, layoutRef); } each(this._coordsList, function(coord) { coord.calcAffineTransform(); }); }; Grid2.prototype.getAxis = function(dim, axisIndex) { var axesMapOnDim = this._axesMap[dim]; if (axesMapOnDim != null) { return axesMapOnDim[axisIndex || 0]; } }; Grid2.prototype.getAxes = function() { return this._axesList.slice(); }; Grid2.prototype.getCartesian = function(xAxisIndex, yAxisIndex) { if (xAxisIndex != null && yAxisIndex != null) { var key = "x" + xAxisIndex + "y" + yAxisIndex; return this._coordsMap[key]; } if (isObject(xAxisIndex)) { yAxisIndex = xAxisIndex.yAxisIndex; xAxisIndex = xAxisIndex.xAxisIndex; } for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) { if (coordList[i].getAxis("x").index === xAxisIndex || coordList[i].getAxis("y").index === yAxisIndex) { return coordList[i]; } } }; Grid2.prototype.getCartesians = function() { return this._coordsList.slice(); }; Grid2.prototype.convertToPixel = function(ecModel, finder, value) { var target = this._findConvertTarget(finder); return target.cartesian ? target.cartesian.dataToPoint(value) : target.axis ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) : null; }; Grid2.prototype.convertFromPixel = function(ecModel, finder, value) { var target = this._findConvertTarget(finder); return target.cartesian ? target.cartesian.pointToData(value) : target.axis ? target.axis.coordToData(target.axis.toLocalCoord(value)) : null; }; Grid2.prototype._findConvertTarget = function(finder) { var seriesModel = finder.seriesModel; var xAxisModel = finder.xAxisModel || seriesModel && seriesModel.getReferringComponents("xAxis", SINGLE_REFERRING).models[0]; var yAxisModel = finder.yAxisModel || seriesModel && seriesModel.getReferringComponents("yAxis", SINGLE_REFERRING).models[0]; var gridModel = finder.gridModel; var coordsList = this._coordsList; var cartesian; var axis; if (seriesModel) { cartesian = seriesModel.coordinateSystem; indexOf(coordsList, cartesian) < 0 && (cartesian = null); } else if (xAxisModel && yAxisModel) { cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex); } else if (xAxisModel) { axis = this.getAxis("x", xAxisModel.componentIndex); } else if (yAxisModel) { axis = this.getAxis("y", yAxisModel.componentIndex); } else if (gridModel) { var grid = gridModel.coordinateSystem; if (grid === this) { cartesian = this._coordsList[0]; } } return { cartesian, axis }; }; Grid2.prototype.containPoint = function(point) { var coord = this._coordsList[0]; if (coord) { return coord.containPoint(point); } }; Grid2.prototype._initCartesian = function(gridModel, ecModel, api) { var _this = this; var grid = this; var axisPositionUsed = { left: false, right: false, top: false, bottom: false }; var axesMap = { x: {}, y: {} }; var axesCount = { x: 0, y: 0 }; ecModel.eachComponent("xAxis", createAxisCreator("x"), this); ecModel.eachComponent("yAxis", createAxisCreator("y"), this); if (!axesCount.x || !axesCount.y) { this._axesMap = {}; this._axesList = []; return; } this._axesMap = axesMap; each(axesMap.x, function(xAxis, xAxisIndex) { each(axesMap.y, function(yAxis, yAxisIndex) { var key = "x" + xAxisIndex + "y" + yAxisIndex; var cartesian = new Cartesian2D_default(key); cartesian.master = _this; cartesian.model = gridModel; _this._coordsMap[key] = cartesian; _this._coordsList.push(cartesian); cartesian.addAxis(xAxis); cartesian.addAxis(yAxis); }); }); function createAxisCreator(dimName) { return function(axisModel, idx) { if (!isAxisUsedInTheGrid(axisModel, gridModel)) { return; } var axisPosition = axisModel.get("position"); if (dimName === "x") { if (axisPosition !== "top" && axisPosition !== "bottom") { axisPosition = axisPositionUsed.bottom ? "top" : "bottom"; } } else { if (axisPosition !== "left" && axisPosition !== "right") { axisPosition = axisPositionUsed.left ? "right" : "left"; } } axisPositionUsed[axisPosition] = true; var axis = new Axis2D_default(dimName, createScaleByModel(axisModel), [0, 0], axisModel.get("type"), axisPosition); var isCategory = axis.type === "category"; axis.onBand = isCategory && axisModel.get("boundaryGap"); axis.inverse = axisModel.get("inverse"); axisModel.axis = axis; axis.model = axisModel; axis.grid = grid; axis.index = idx; grid._axesList.push(axis); axesMap[dimName][idx] = axis; axesCount[dimName]++; }; } }; Grid2.prototype._updateScale = function(ecModel, gridModel) { each(this._axesList, function(axis) { axis.scale.setExtent(Infinity, -Infinity); if (axis.type === "category") { var categorySortInfo = axis.model.get("categorySortInfo"); axis.scale.setSortInfo(categorySortInfo); } }); ecModel.eachSeries(function(seriesModel) { if (isCartesian2DInjectedAsDataCoordSys(seriesModel)) { var axesModelMap = findAxisModels(seriesModel); var xAxisModel = axesModelMap.xAxisModel; var yAxisModel = axesModelMap.yAxisModel; if (!isAxisUsedInTheGrid(xAxisModel, gridModel) || !isAxisUsedInTheGrid(yAxisModel, gridModel)) { return; } var cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex); var data = seriesModel.getData(); var xAxis = cartesian.getAxis("x"); var yAxis = cartesian.getAxis("y"); unionExtent(data, xAxis); unionExtent(data, yAxis); } }, this); function unionExtent(data, axis) { each(getDataDimensionsOnAxis(data, axis.dim), function(dim) { axis.scale.unionExtentFromData(data, dim); }); } }; Grid2.prototype.getTooltipAxes = function(dim) { var baseAxes = []; var otherAxes = []; each(this.getCartesians(), function(cartesian) { var baseAxis = dim != null && dim !== "auto" ? cartesian.getAxis(dim) : cartesian.getBaseAxis(); var otherAxis = cartesian.getOtherAxis(baseAxis); indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis); indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis); }); return { baseAxes, otherAxes }; }; Grid2.create = function(ecModel, api) { var grids = []; ecModel.eachComponent("grid", function(gridModel, idx) { var grid = new Grid2(gridModel, ecModel, api); grid.name = "grid_" + idx; grid.resize(gridModel, api, true); gridModel.coordinateSystem = grid; grids.push(grid); }); ecModel.eachSeries(function(seriesModel) { injectCoordSysByOption({ targetModel: seriesModel, coordSysType: "cartesian2d", coordSysProvider }); function coordSysProvider() { var axesModelMap = findAxisModels(seriesModel); var xAxisModel = axesModelMap.xAxisModel; var yAxisModel = axesModelMap.yAxisModel; var gridModel = xAxisModel.getCoordSysModel(); if (true) { if (!gridModel) { throw new Error('Grid "' + retrieve3(xAxisModel.get("gridIndex"), xAxisModel.get("gridId"), 0) + '" not found'); } if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) { throw new Error("xAxis and yAxis must use the same grid"); } } var grid = gridModel.coordinateSystem; return grid.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex); } }); return grids; }; Grid2.dimensions = cartesian2DDimensions; return Grid2; }() ); function isAxisUsedInTheGrid(axisModel, gridModel) { return axisModel.getCoordSysModel() === gridModel; } function fixAxisOnZero(axesMap, otherAxisDim, axis, onZeroRecords) { axis.getAxesOnZeroOf = function() { return otherAxisOnZeroOf ? [otherAxisOnZeroOf] : []; }; var otherAxes = axesMap[otherAxisDim]; var otherAxisOnZeroOf; var axisModel = axis.model; var onZero = axisModel.get(["axisLine", "onZero"]); var onZeroAxisIndex = axisModel.get(["axisLine", "onZeroAxisIndex"]); if (!onZero) { return; } if (onZeroAxisIndex != null) { if (canOnZeroToAxis(otherAxes[onZeroAxisIndex])) { otherAxisOnZeroOf = otherAxes[onZeroAxisIndex]; } } else { for (var idx in otherAxes) { if (otherAxes.hasOwnProperty(idx) && canOnZeroToAxis(otherAxes[idx]) && !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) { otherAxisOnZeroOf = otherAxes[idx]; break; } } } if (otherAxisOnZeroOf) { onZeroRecords[getOnZeroRecordKey(otherAxisOnZeroOf)] = true; } function getOnZeroRecordKey(axis2) { return axis2.dim + "_" + axis2.index; } } function canOnZeroToAxis(axis) { return axis && axis.type !== "category" && axis.type !== "time" && ifAxisCrossZero(axis); } function updateAxisTransform(axis, coordBase) { var axisExtent = axis.getExtent(); var axisExtentSum = axisExtent[0] + axisExtent[1]; axis.toGlobalCoord = axis.dim === "x" ? function(coord) { return coord + coordBase; } : function(coord) { return axisExtentSum - coord + coordBase; }; axis.toLocalCoord = axis.dim === "x" ? function(coord) { return coord - coordBase; } : function(coord) { return axisExtentSum - coord + coordBase; }; } function updateAllAxisExtentTransByGridRect(axesMap, gridRect) { each(axesMap.x, function(axis) { return updateAxisExtentTransByGridRect(axis, gridRect.x, gridRect.width); }); each(axesMap.y, function(axis) { return updateAxisExtentTransByGridRect(axis, gridRect.y, gridRect.height); }); } function updateAxisExtentTransByGridRect(axis, gridXY, gridWH) { var extent = [0, gridWH]; var idx = axis.inverse ? 1 : 0; axis.setExtent(extent[idx], extent[1 - idx]); updateAxisTransform(axis, gridXY); } var legacyLayOutGridByContainLabel; function registerLegacyGridContainLabelImpl(impl) { legacyLayOutGridByContainLabel = impl; } function layOutGridByOuterBounds(outerBoundsRect, outerBoundsContain, outerBoundsClamp, gridRect, axesMap, axisBuilderSharedCtx, layoutRef) { if (true) { assert(outerBoundsContain === "all" || outerBoundsContain === "axisLabel"); } createOrUpdateAxesView(gridRect, axesMap, AxisTickLabelComputingKind.estimate, outerBoundsContain, false, layoutRef); var margin = [0, 0, 0, 0]; fillLabelNameOverflowOnOneDimension(0); fillLabelNameOverflowOnOneDimension(1); fillMarginOnOneDimension(gridRect, 0, NaN); fillMarginOnOneDimension(gridRect, 1, NaN); var noPxChange = find(margin, function(item) { return item > 0; }) == null; expandOrShrinkRect(gridRect, margin, true, true, outerBoundsClamp); updateAllAxisExtentTransByGridRect(axesMap, gridRect); return noPxChange; function fillLabelNameOverflowOnOneDimension(xyIdx) { each(axesMap[XY[xyIdx]], function(axis) { if (!shouldAxisShow(axis.model)) { return; } var sharedRecord = axisBuilderSharedCtx.ensureRecord(axis.model); var labelInfoList = sharedRecord.labelInfoList; if (labelInfoList) { for (var idx = 0; idx < labelInfoList.length; idx++) { var labelInfo = labelInfoList[idx]; var proportion = axis.scale.normalize(getLabelInner(labelInfo.label).tickValue); proportion = xyIdx === 1 ? 1 - proportion : proportion; fillMarginOnOneDimension(labelInfo.rect, xyIdx, proportion); fillMarginOnOneDimension(labelInfo.rect, 1 - xyIdx, NaN); } } var nameLayout = sharedRecord.nameLayout; if (nameLayout) { var proportion = isNameLocationCenter(sharedRecord.nameLocation) ? 0.5 : NaN; fillMarginOnOneDimension(nameLayout.rect, xyIdx, proportion); fillMarginOnOneDimension(nameLayout.rect, 1 - xyIdx, NaN); } }); } function fillMarginOnOneDimension(itemRect, xyIdx, proportion) { var overflow1 = outerBoundsRect[XY[xyIdx]] - itemRect[XY[xyIdx]]; var overflow2 = itemRect[WH[xyIdx]] + itemRect[XY[xyIdx]] - (outerBoundsRect[WH[xyIdx]] + outerBoundsRect[XY[xyIdx]]); overflow1 = applyProportion(overflow1, 1 - proportion); overflow2 = applyProportion(overflow2, proportion); var minIdx = XY_TO_MARGIN_IDX[xyIdx][0]; var maxIdx = XY_TO_MARGIN_IDX[xyIdx][1]; margin[minIdx] = mathMax(margin[minIdx], overflow1); margin[maxIdx] = mathMax(margin[maxIdx], overflow2); } function applyProportion(overflow, proportion) { if (overflow > 0 && !eqNaN(proportion) && proportion > 1e-4) { overflow /= proportion; } return overflow; } } function createAxisBiulders(gridRect, cartesians, axesMap, optionContainLabel, api) { var axisBuilderSharedCtx = new AxisBuilderSharedContext(resolveAxisNameOverlapForGrid); each(axesMap, function(axisList) { return each(axisList, function(axis) { if (shouldAxisShow(axis.model)) { var defaultNameMoveOverlap = !optionContainLabel; axis.axisBuilder = createCartesianAxisViewCommonPartBuilder(gridRect, cartesians, axis.model, api, axisBuilderSharedCtx, defaultNameMoveOverlap); } }); }); return axisBuilderSharedCtx; } function createOrUpdateAxesView(gridRect, axesMap, kind, outerBoundsContain, noPxChange, layoutRef) { var isDetermine = kind === AxisTickLabelComputingKind.determine; each(axesMap, function(axisList) { return each(axisList, function(axis) { if (shouldAxisShow(axis.model)) { updateCartesianAxisViewCommonPartBuilder(axis.axisBuilder, gridRect, axis.model); axis.axisBuilder.build(isDetermine ? { axisTickLabelDetermine: true } : { axisTickLabelEstimate: true }, { noPxChange }); } }); }); var nameMarginLevelMap = { x: 0, y: 0 }; calcNameMarginLevel(0); calcNameMarginLevel(1); function calcNameMarginLevel(xyIdx) { nameMarginLevelMap[XY[1 - xyIdx]] = gridRect[WH[xyIdx]] <= layoutRef.refContainer[WH[xyIdx]] * 0.5 ? 0 : 1 - xyIdx === 1 ? 2 : 1; } each(axesMap, function(axisList, xy) { return each(axisList, function(axis) { if (shouldAxisShow(axis.model)) { if (outerBoundsContain === "all" || isDetermine) { axis.axisBuilder.build({ axisName: true }, { nameMarginLevel: nameMarginLevelMap[xy] }); } if (isDetermine) { axis.axisBuilder.build({ axisLine: true }); } } }); }); } function prepareOuterBounds(gridModel, rawRridRect, layoutRef) { var outerBoundsRect; var optionOuterBoundsMode = gridModel.get("outerBoundsMode", true); if (optionOuterBoundsMode === "same") { outerBoundsRect = rawRridRect.clone(); } else if (optionOuterBoundsMode == null || optionOuterBoundsMode === "auto") { outerBoundsRect = getLayoutRect(gridModel.get("outerBounds", true) || OUTER_BOUNDS_DEFAULT, layoutRef.refContainer); } else if (optionOuterBoundsMode !== "none") { if (true) { error("Invalid grid[" + gridModel.componentIndex + "].outerBoundsMode."); } } var optionOuterBoundsContain = gridModel.get("outerBoundsContain", true); var parsedOuterBoundsContain; if (optionOuterBoundsContain == null || optionOuterBoundsContain === "auto") { parsedOuterBoundsContain = "all"; } else if (indexOf(["all", "axisLabel"], optionOuterBoundsContain) < 0) { if (true) { error("Invalid grid[" + gridModel.componentIndex + "].outerBoundsContain."); } parsedOuterBoundsContain = "all"; } else { parsedOuterBoundsContain = optionOuterBoundsContain; } var outerBoundsClamp = [parsePositionSizeOption(retrieve2(gridModel.get("outerBoundsClampWidth", true), OUTER_BOUNDS_CLAMP_DEFAULT[0]), rawRridRect.width), parsePositionSizeOption(retrieve2(gridModel.get("outerBoundsClampHeight", true), OUTER_BOUNDS_CLAMP_DEFAULT[1]), rawRridRect.height)]; return { outerBoundsRect, parsedOuterBoundsContain, outerBoundsClamp }; } var resolveAxisNameOverlapForGrid = function(cfg, ctx, axisModel, nameLayoutInfo, nameMoveDirVec, thisRecord) { var perpendicularDim = axisModel.axis.dim === "x" ? "y" : "x"; resolveAxisNameOverlapDefault(cfg, ctx, axisModel, nameLayoutInfo, nameMoveDirVec, thisRecord); if (!isNameLocationCenter(cfg.nameLocation)) { each(ctx.recordMap[perpendicularDim], function(perpenRecord) { if (perpenRecord && perpenRecord.labelInfoList && perpenRecord.dirVec) { moveIfOverlapByLinearLabels(perpenRecord.labelInfoList, perpenRecord.dirVec, nameLayoutInfo, nameMoveDirVec); } }); } }; var Grid_default = Grid; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axisPointer/modelHelper.js function collect(ecModel, api) { var result = { /** * key: makeKey(axis.model) * value: { * axis, * coordSys, * axisPointerModel, * triggerTooltip, * triggerEmphasis, * involveSeries, * snap, * seriesModels, * seriesDataCount * } */ axesInfo: {}, seriesInvolved: false, /** * key: makeKey(coordSys.model) * value: Object: key makeKey(axis.model), value: axisInfo */ coordSysAxesInfo: {}, coordSysMap: {} }; collectAxesInfo(result, ecModel, api); result.seriesInvolved && collectSeriesInfo(result, ecModel); return result; } function collectAxesInfo(result, ecModel, api) { var globalTooltipModel = ecModel.getComponent("tooltip"); var globalAxisPointerModel = ecModel.getComponent("axisPointer"); var linksOption = globalAxisPointerModel.get("link", true) || []; var linkGroups = []; each(api.getCoordinateSystems(), function(coordSys) { if (!coordSys.axisPointerEnabled) { return; } var coordSysKey = makeKey(coordSys.model); var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {}; result.coordSysMap[coordSysKey] = coordSys; var coordSysModel = coordSys.model; var baseTooltipModel = coordSysModel.getModel("tooltip", globalTooltipModel); each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null)); if (coordSys.getTooltipAxes && globalTooltipModel && baseTooltipModel.get("show")) { var triggerAxis = baseTooltipModel.get("trigger") === "axis"; var cross = baseTooltipModel.get(["axisPointer", "type"]) === "cross"; var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get(["axisPointer", "axis"])); if (triggerAxis || cross) { each(tooltipAxes.baseAxes, curry(saveTooltipAxisInfo, cross ? "cross" : true, triggerAxis)); } if (cross) { each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, "cross", false)); } } function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) { var axisPointerModel = axis.model.getModel("axisPointer", globalAxisPointerModel); var axisPointerShow = axisPointerModel.get("show"); if (!axisPointerShow || axisPointerShow === "auto" && !fromTooltip && !isHandleTrigger(axisPointerModel)) { return; } if (triggerTooltip == null) { triggerTooltip = axisPointerModel.get("triggerTooltip"); } axisPointerModel = fromTooltip ? makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) : axisPointerModel; var snap = axisPointerModel.get("snap"); var triggerEmphasis = axisPointerModel.get("triggerEmphasis"); var axisKey = makeKey(axis.model); var involveSeries = triggerTooltip || snap || axis.type === "category"; var axisInfo = result.axesInfo[axisKey] = { key: axisKey, axis, coordSys, axisPointerModel, triggerTooltip, triggerEmphasis, involveSeries, snap, useHandle: isHandleTrigger(axisPointerModel), seriesModels: [], linkGroup: null }; axesInfoInCoordSys[axisKey] = axisInfo; result.seriesInvolved = result.seriesInvolved || involveSeries; var groupIndex = getLinkGroupIndex(linksOption, axis); if (groupIndex != null) { var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = { axesInfo: {} }); linkGroup.axesInfo[axisKey] = axisInfo; linkGroup.mapper = linksOption[groupIndex].mapper; axisInfo.linkGroup = linkGroup; } } }); } function makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) { var tooltipAxisPointerModel = baseTooltipModel.getModel("axisPointer"); var fields = ["type", "snap", "lineStyle", "shadowStyle", "label", "animation", "animationDurationUpdate", "animationEasingUpdate", "z"]; var volatileOption = {}; each(fields, function(field) { volatileOption[field] = clone(tooltipAxisPointerModel.get(field)); }); volatileOption.snap = axis.type !== "category" && !!triggerTooltip; if (tooltipAxisPointerModel.get("type") === "cross") { volatileOption.type = "line"; } var labelOption = volatileOption.label || (volatileOption.label = {}); labelOption.show == null && (labelOption.show = false); if (fromTooltip === "cross") { var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(["label", "show"]); labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true; if (!triggerTooltip) { var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get("crossStyle"); crossStyle && defaults(labelOption, crossStyle.textStyle); } } return axis.model.getModel("axisPointer", new Model_default(volatileOption, globalAxisPointerModel, ecModel)); } function collectSeriesInfo(result, ecModel) { ecModel.eachSeries(function(seriesModel) { var coordSys = seriesModel.coordinateSystem; var seriesTooltipTrigger = seriesModel.get(["tooltip", "trigger"], true); var seriesTooltipShow = seriesModel.get(["tooltip", "show"], true); if (!coordSys || !coordSys.model || seriesTooltipTrigger === "none" || seriesTooltipTrigger === false || seriesTooltipTrigger === "item" || seriesTooltipShow === false || seriesModel.get(["axisPointer", "show"], true) === false) { return; } each(result.coordSysAxesInfo[makeKey(coordSys.model)], function(axisInfo) { var axis = axisInfo.axis; if (coordSys.getAxis(axis.dim) === axis) { axisInfo.seriesModels.push(seriesModel); axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0); axisInfo.seriesDataCount += seriesModel.getData().count(); } }); }); } function getLinkGroupIndex(linksOption, axis) { var axisModel = axis.model; var dim = axis.dim; for (var i = 0; i < linksOption.length; i++) { var linkOption = linksOption[i] || {}; if (checkPropInLink(linkOption[dim + "AxisId"], axisModel.id) || checkPropInLink(linkOption[dim + "AxisIndex"], axisModel.componentIndex) || checkPropInLink(linkOption[dim + "AxisName"], axisModel.name)) { return i; } } } function checkPropInLink(linkPropValue, axisPropValue) { return linkPropValue === "all" || isArray(linkPropValue) && indexOf(linkPropValue, axisPropValue) >= 0 || linkPropValue === axisPropValue; } function fixValue(axisModel) { var axisInfo = getAxisInfo(axisModel); if (!axisInfo) { return; } var axisPointerModel = axisInfo.axisPointerModel; var scale = axisInfo.axis.scale; var option = axisPointerModel.option; var status = axisPointerModel.get("status"); var value = axisPointerModel.get("value"); if (value != null) { value = scale.parse(value); } var useHandle = isHandleTrigger(axisPointerModel); if (status == null) { option.status = useHandle ? "show" : "hide"; } var extent = scale.getExtent().slice(); extent[0] > extent[1] && extent.reverse(); if ( // Pick a value on axis when initializing. value == null || value > extent[1] ) { value = extent[1]; } if (value < extent[0]) { value = extent[0]; } option.value = value; if (useHandle) { option.status = axisInfo.axis.scale.isBlank() ? "hide" : "show"; } } function getAxisInfo(axisModel) { var coordSysAxesInfo = (axisModel.ecModel.getComponent("axisPointer") || {}).coordSysAxesInfo; return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)]; } function getAxisPointerModel(axisModel) { var axisInfo = getAxisInfo(axisModel); return axisInfo && axisInfo.axisPointerModel; } function isHandleTrigger(axisPointerModel) { return !!axisPointerModel.get(["handle", "show"]); } function makeKey(model) { return model.type + "||" + model.id; } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/AxisView.js var axisPointerClazz = {}; var AxisView = ( /** @class */ function(_super) { __extends(AxisView2, _super); function AxisView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = AxisView2.type; return _this; } AxisView2.prototype.render = function(axisModel, ecModel, api, payload) { this.axisPointerClass && fixValue(axisModel); _super.prototype.render.apply(this, arguments); this._doUpdateAxisPointerClass(axisModel, api, true); }; AxisView2.prototype.updateAxisPointer = function(axisModel, ecModel, api, payload) { this._doUpdateAxisPointerClass(axisModel, api, false); }; AxisView2.prototype.remove = function(ecModel, api) { var axisPointer = this._axisPointer; axisPointer && axisPointer.remove(api); }; AxisView2.prototype.dispose = function(ecModel, api) { this._disposeAxisPointer(api); _super.prototype.dispose.apply(this, arguments); }; AxisView2.prototype._doUpdateAxisPointerClass = function(axisModel, api, forceRender) { var Clazz = AxisView2.getAxisPointerClass(this.axisPointerClass); if (!Clazz) { return; } var axisPointerModel = getAxisPointerModel(axisModel); axisPointerModel ? (this._axisPointer || (this._axisPointer = new Clazz())).render(axisModel, axisPointerModel, api, forceRender) : this._disposeAxisPointer(api); }; AxisView2.prototype._disposeAxisPointer = function(api) { this._axisPointer && this._axisPointer.dispose(api); this._axisPointer = null; }; AxisView2.registerAxisPointerClass = function(type, clazz) { if (true) { if (axisPointerClazz[type]) { throw new Error("axisPointer " + type + " exists"); } } axisPointerClazz[type] = clazz; }; ; AxisView2.getAxisPointerClass = function(type) { return type && axisPointerClazz[type]; }; ; AxisView2.type = "axis"; return AxisView2; }(Component_default2) ); var AxisView_default = AxisView; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/axisSplitHelper.js var inner = makeInner(); function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) { var axis = axisModel.axis; if (axis.scale.isBlank()) { return; } var splitAreaModel = axisModel.getModel("splitArea"); var areaStyleModel = splitAreaModel.getModel("areaStyle"); var areaColors = areaStyleModel.get("color"); var gridRect = gridModel.coordinateSystem.getRect(); var ticksCoords = axis.getTicksCoords({ tickModel: splitAreaModel, clamp: true, breakTicks: "none", pruneByBreak: "preserve_extent_bound" }); if (!ticksCoords.length) { return; } var areaColorsLen = areaColors.length; var lastSplitAreaColors = inner(axisView).splitAreaColors; var newSplitAreaColors = createHashMap(); var colorIndex = 0; if (lastSplitAreaColors) { for (var i = 0; i < ticksCoords.length; i++) { var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue); if (cIndex != null) { colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen; break; } } } var prev = axis.toGlobalCoord(ticksCoords[0].coord); var areaStyle = areaStyleModel.getAreaStyle(); areaColors = isArray(areaColors) ? areaColors : [areaColors]; for (var i = 1; i < ticksCoords.length; i++) { var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord); var x = void 0; var y = void 0; var width = void 0; var height = void 0; if (axis.isHorizontal()) { x = prev; y = gridRect.y; width = tickCoord - x; height = gridRect.height; prev = x + width; } else { x = gridRect.x; y = prev; width = gridRect.width; height = tickCoord - y; prev = y + height; } var tickValue = ticksCoords[i - 1].tickValue; tickValue != null && newSplitAreaColors.set(tickValue, colorIndex); axisGroup.add(new Rect_default({ anid: tickValue != null ? "area_" + tickValue : null, shape: { x, y, width, height }, style: defaults({ fill: areaColors[colorIndex] }, areaStyle), autoBatch: true, silent: true })); colorIndex = (colorIndex + 1) % areaColorsLen; } inner(axisView).splitAreaColors = newSplitAreaColors; } function rectCoordAxisHandleRemove(axisView) { inner(axisView).splitAreaColors = null; } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/axis/CartesianAxisView.js var selfBuilderAttrs = ["splitArea", "splitLine", "minorSplitLine", "breakArea"]; var CartesianAxisView = ( /** @class */ function(_super) { __extends(CartesianAxisView2, _super); function CartesianAxisView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = CartesianAxisView2.type; _this.axisPointerClass = "CartesianAxisPointer"; return _this; } CartesianAxisView2.prototype.render = function(axisModel, ecModel, api, payload) { this.group.removeAll(); var oldAxisGroup = this._axisGroup; this._axisGroup = new Group_default(); this.group.add(this._axisGroup); if (!shouldAxisShow(axisModel)) { return; } this._axisGroup.add(axisModel.axis.axisBuilder.group); each(selfBuilderAttrs, function(name) { if (axisModel.get([name, "show"])) { axisElementBuilders[name](this, this._axisGroup, axisModel, axisModel.getCoordSysModel(), api); } }, this); var isInitialSortFromBarRacing = payload && payload.type === "changeAxisOrder" && payload.isInitSort; if (!isInitialSortFromBarRacing) { groupTransition(oldAxisGroup, this._axisGroup, axisModel); } _super.prototype.render.call(this, axisModel, ecModel, api, payload); }; CartesianAxisView2.prototype.remove = function() { rectCoordAxisHandleRemove(this); }; CartesianAxisView2.type = "cartesianAxis"; return CartesianAxisView2; }(AxisView_default) ); var axisElementBuilders = { splitLine: function(axisView, axisGroup, axisModel, gridModel, api) { var axis = axisModel.axis; if (axis.scale.isBlank()) { return; } var splitLineModel = axisModel.getModel("splitLine"); var lineStyleModel = splitLineModel.getModel("lineStyle"); var lineColors = lineStyleModel.get("color"); var showMinLine = splitLineModel.get("showMinLine") !== false; var showMaxLine = splitLineModel.get("showMaxLine") !== false; lineColors = isArray(lineColors) ? lineColors : [lineColors]; var gridRect = gridModel.coordinateSystem.getRect(); var isHorizontal = axis.isHorizontal(); var lineCount = 0; var ticksCoords = axis.getTicksCoords({ tickModel: splitLineModel, breakTicks: "none", pruneByBreak: "preserve_extent_bound" }); var p1 = []; var p2 = []; var lineStyle = lineStyleModel.getLineStyle(); for (var i = 0; i < ticksCoords.length; i++) { var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord); if (i === 0 && !showMinLine || i === ticksCoords.length - 1 && !showMaxLine) { continue; } var tickValue = ticksCoords[i].tickValue; if (isHorizontal) { p1[0] = tickCoord; p1[1] = gridRect.y; p2[0] = tickCoord; p2[1] = gridRect.y + gridRect.height; } else { p1[0] = gridRect.x; p1[1] = tickCoord; p2[0] = gridRect.x + gridRect.width; p2[1] = tickCoord; } var colorIndex = lineCount++ % lineColors.length; var line = new Line_default({ anid: tickValue != null ? "line_" + tickValue : null, autoBatch: true, shape: { x1: p1[0], y1: p1[1], x2: p2[0], y2: p2[1] }, style: defaults({ stroke: lineColors[colorIndex] }, lineStyle), silent: true }); subPixelOptimizeLine(line.shape, lineStyle.lineWidth); axisGroup.add(line); } }, minorSplitLine: function(axisView, axisGroup, axisModel, gridModel, api) { var axis = axisModel.axis; var minorSplitLineModel = axisModel.getModel("minorSplitLine"); var lineStyleModel = minorSplitLineModel.getModel("lineStyle"); var gridRect = gridModel.coordinateSystem.getRect(); var isHorizontal = axis.isHorizontal(); var minorTicksCoords = axis.getMinorTicksCoords(); if (!minorTicksCoords.length) { return; } var p1 = []; var p2 = []; var lineStyle = lineStyleModel.getLineStyle(); for (var i = 0; i < minorTicksCoords.length; i++) { for (var k = 0; k < minorTicksCoords[i].length; k++) { var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord); if (isHorizontal) { p1[0] = tickCoord; p1[1] = gridRect.y; p2[0] = tickCoord; p2[1] = gridRect.y + gridRect.height; } else { p1[0] = gridRect.x; p1[1] = tickCoord; p2[0] = gridRect.x + gridRect.width; p2[1] = tickCoord; } var line = new Line_default({ anid: "minor_line_" + minorTicksCoords[i][k].tickValue, autoBatch: true, shape: { x1: p1[0], y1: p1[1], x2: p2[0], y2: p2[1] }, style: lineStyle, silent: true }); subPixelOptimizeLine(line.shape, lineStyle.lineWidth); axisGroup.add(line); } } }, splitArea: function(axisView, axisGroup, axisModel, gridModel, api) { rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel); }, breakArea: function(axisView, axisGroup, axisModel, gridModel, api) { var axisBreakHelper = getAxisBreakHelper(); var scale = axisModel.axis.scale; if (axisBreakHelper && scale.type !== "ordinal") { axisBreakHelper.rectCoordBuildBreakAxis(axisGroup, axisView, axisModel, gridModel.coordinateSystem.getRect(), api); } } }; var CartesianXAxisView = ( /** @class */ function(_super) { __extends(CartesianXAxisView2, _super); function CartesianXAxisView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = CartesianXAxisView2.type; return _this; } CartesianXAxisView2.type = "xAxis"; return CartesianXAxisView2; }(CartesianAxisView) ); var CartesianYAxisView = ( /** @class */ function(_super) { __extends(CartesianYAxisView2, _super); function CartesianYAxisView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = CartesianXAxisView.type; return _this; } CartesianYAxisView2.type = "yAxis"; return CartesianYAxisView2; }(CartesianAxisView) ); // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/component/grid/installSimple.js var GridView = ( /** @class */ function(_super) { __extends(GridView2, _super); function GridView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = "grid"; return _this; } GridView2.prototype.render = function(gridModel, ecModel) { this.group.removeAll(); if (gridModel.get("show")) { this.group.add(new Rect_default({ shape: gridModel.coordinateSystem.getRect(), style: defaults({ fill: gridModel.get("backgroundColor") }, gridModel.getItemStyle()), silent: true, z2: -1 })); } }; GridView2.type = "grid"; return GridView2; }(Component_default2) ); var extraOption = { // gridIndex: 0, // gridId: '', offset: 0 }; function install(registers) { registers.registerComponentView(GridView); registers.registerComponentModel(GridModel_default); registers.registerCoordinateSystem("cartesian2d", Grid_default); axisModelCreator(registers, "x", CartesianAxisModel, extraOption); axisModelCreator(registers, "y", CartesianAxisModel, extraOption); registers.registerComponentView(CartesianXAxisView); registers.registerComponentView(CartesianYAxisView); registers.registerPreprocessor(function(option) { if (option.xAxis && option.yAxis && !option.grid) { option.grid = {}; } }); } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/chart/helper/labelHelper.js function getDefaultLabel(data, dataIndex) { var labelDims = data.mapDimensionsAll("defaultedLabel"); var len = labelDims.length; if (len === 1) { var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]); return rawVal != null ? rawVal + "" : null; } else if (len) { var vals = []; for (var i = 0; i < labelDims.length; i++) { vals.push(retrieveRawValue(data, dataIndex, labelDims[i])); } return vals.join(" "); } } function getDefaultInterpolatedLabel(data, interpolatedValue) { var labelDims = data.mapDimensionsAll("defaultedLabel"); if (!isArray(interpolatedValue)) { return interpolatedValue + ""; } var vals = []; for (var i = 0; i < labelDims.length; i++) { var dimIndex = data.getDimensionIndex(labelDims[i]); if (dimIndex >= 0) { vals.push(interpolatedValue[dimIndex]); } } return vals.join(" "); } // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/chart/helper/Symbol.js var Symbol = ( /** @class */ function(_super) { __extends(Symbol2, _super); function Symbol2(data, idx, seriesScope, opts) { var _this = _super.call(this) || this; _this.updateData(data, idx, seriesScope, opts); return _this; } Symbol2.prototype._createSymbol = function(symbolType, data, idx, symbolSize, z2, keepAspect) { this.removeAll(); var symbolPath = createSymbol(symbolType, -1, -1, 2, 2, null, keepAspect); symbolPath.attr({ z2: retrieve2(z2, 100), culling: true, scaleX: symbolSize[0] / 2, scaleY: symbolSize[1] / 2 }); symbolPath.drift = driftSymbol; this._symbolType = symbolType; this.add(symbolPath); }; Symbol2.prototype.stopSymbolAnimation = function(toLastFrame) { this.childAt(0).stopAnimation(null, toLastFrame); }; Symbol2.prototype.getSymbolType = function() { return this._symbolType; }; Symbol2.prototype.getSymbolPath = function() { return this.childAt(0); }; Symbol2.prototype.highlight = function() { enterEmphasis(this.childAt(0)); }; Symbol2.prototype.downplay = function() { leaveEmphasis(this.childAt(0)); }; Symbol2.prototype.setZ = function(zlevel, z) { var symbolPath = this.childAt(0); symbolPath.zlevel = zlevel; symbolPath.z = z; }; Symbol2.prototype.setDraggable = function(draggable, hasCursorOption) { var symbolPath = this.childAt(0); symbolPath.draggable = draggable; symbolPath.cursor = !hasCursorOption && draggable ? "move" : symbolPath.cursor; }; Symbol2.prototype.updateData = function(data, idx, seriesScope, opts) { this.silent = false; var symbolType = data.getItemVisual(idx, "symbol") || "circle"; var seriesModel = data.hostModel; var symbolSize = Symbol2.getSymbolSize(data, idx); var z2 = Symbol2.getSymbolZ2(data, idx); var isInit = symbolType !== this._symbolType; var disableAnimation = opts && opts.disableAnimation; if (isInit) { var keepAspect = data.getItemVisual(idx, "symbolKeepAspect"); this._createSymbol(symbolType, data, idx, symbolSize, z2, keepAspect); } else { var symbolPath = this.childAt(0); symbolPath.silent = false; var target = { scaleX: symbolSize[0] / 2, scaleY: symbolSize[1] / 2 }; disableAnimation ? symbolPath.attr(target) : updateProps(symbolPath, target, seriesModel, idx); saveOldStyle(symbolPath); } this._updateCommon(data, idx, symbolSize, seriesScope, opts); if (isInit) { var symbolPath = this.childAt(0); if (!disableAnimation) { var target = { scaleX: this._sizeX, scaleY: this._sizeY, style: { // Always fadeIn. Because it has fadeOut animation when symbol is removed.. opacity: symbolPath.style.opacity } }; symbolPath.scaleX = symbolPath.scaleY = 0; symbolPath.style.opacity = 0; initProps(symbolPath, target, seriesModel, idx); } } if (disableAnimation) { this.childAt(0).stopAnimation("leave"); } }; Symbol2.prototype._updateCommon = function(data, idx, symbolSize, seriesScope, opts) { var symbolPath = this.childAt(0); var seriesModel = data.hostModel; var emphasisItemStyle; var blurItemStyle; var selectItemStyle; var focus; var blurScope; var emphasisDisabled; var labelStatesModels; var hoverScale; var cursorStyle; if (seriesScope) { emphasisItemStyle = seriesScope.emphasisItemStyle; blurItemStyle = seriesScope.blurItemStyle; selectItemStyle = seriesScope.selectItemStyle; focus = seriesScope.focus; blurScope = seriesScope.blurScope; labelStatesModels = seriesScope.labelStatesModels; hoverScale = seriesScope.hoverScale; cursorStyle = seriesScope.cursorStyle; emphasisDisabled = seriesScope.emphasisDisabled; } if (!seriesScope || data.hasItemOption) { var itemModel = seriesScope && seriesScope.itemModel ? seriesScope.itemModel : data.getItemModel(idx); var emphasisModel = itemModel.getModel("emphasis"); emphasisItemStyle = emphasisModel.getModel("itemStyle").getItemStyle(); selectItemStyle = itemModel.getModel(["select", "itemStyle"]).getItemStyle(); blurItemStyle = itemModel.getModel(["blur", "itemStyle"]).getItemStyle(); focus = emphasisModel.get("focus"); blurScope = emphasisModel.get("blurScope"); emphasisDisabled = emphasisModel.get("disabled"); labelStatesModels = getLabelStatesModels(itemModel); hoverScale = emphasisModel.getShallow("scale"); cursorStyle = itemModel.getShallow("cursor"); } var symbolRotate = data.getItemVisual(idx, "symbolRotate"); symbolPath.attr("rotation", (symbolRotate || 0) * Math.PI / 180 || 0); var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, "symbolOffset"), symbolSize); if (symbolOffset) { symbolPath.x = symbolOffset[0]; symbolPath.y = symbolOffset[1]; } cursorStyle && symbolPath.attr("cursor", cursorStyle); var symbolStyle = data.getItemVisual(idx, "style"); var visualColor = symbolStyle.fill; if (symbolPath instanceof Image_default) { var pathStyle = symbolPath.style; symbolPath.useStyle(extend({ // TODO other properties like x, y ? image: pathStyle.image, x: pathStyle.x, y: pathStyle.y, width: pathStyle.width, height: pathStyle.height }, symbolStyle)); } else { if (symbolPath.__isEmptyBrush) { symbolPath.useStyle(extend({}, symbolStyle)); } else { symbolPath.useStyle(symbolStyle); } symbolPath.style.decal = null; symbolPath.setColor(visualColor, opts && opts.symbolInnerColor); symbolPath.style.strokeNoScale = true; } var liftZ = data.getItemVisual(idx, "liftZ"); var z2Origin = this._z2; if (liftZ != null) { if (z2Origin == null) { this._z2 = symbolPath.z2; symbolPath.z2 += liftZ; } } else if (z2Origin != null) { symbolPath.z2 = z2Origin; this._z2 = null; } var useNameLabel = opts && opts.useNameLabel; setLabelStyle(symbolPath, labelStatesModels, { labelFetcher: seriesModel, labelDataIndex: idx, defaultText: getLabelDefaultText, inheritColor: visualColor, defaultOpacity: symbolStyle.opacity }); function getLabelDefaultText(idx2) { return useNameLabel ? data.getName(idx2) : getDefaultLabel(data, idx2); } this._sizeX = symbolSize[0] / 2; this._sizeY = symbolSize[1] / 2; var emphasisState = symbolPath.ensureState("emphasis"); emphasisState.style = emphasisItemStyle; symbolPath.ensureState("select").style = selectItemStyle; symbolPath.ensureState("blur").style = blurItemStyle; var scaleRatio = hoverScale == null || hoverScale === true ? Math.max(1.1, 3 / this._sizeY) : isFinite(hoverScale) && hoverScale > 0 ? +hoverScale : 1; emphasisState.scaleX = this._sizeX * scaleRatio; emphasisState.scaleY = this._sizeY * scaleRatio; this.setSymbolScale(1); toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled); }; Symbol2.prototype.setSymbolScale = function(scale) { this.scaleX = this.scaleY = scale; }; Symbol2.prototype.fadeOut = function(cb, seriesModel, opt) { var symbolPath = this.childAt(0); var dataIndex = getECData(this).dataIndex; var animationOpt = opt && opt.animation; this.silent = symbolPath.silent = true; if (opt && opt.fadeLabel) { var textContent = symbolPath.getTextContent(); if (textContent) { removeElement(textContent, { style: { opacity: 0 } }, seriesModel, { dataIndex, removeOpt: animationOpt, cb: function() { symbolPath.removeTextContent(); } }); } } else { symbolPath.removeTextContent(); } removeElement(symbolPath, { style: { opacity: 0 }, scaleX: 0, scaleY: 0 }, seriesModel, { dataIndex, cb, removeOpt: animationOpt }); }; Symbol2.getSymbolSize = function(data, idx) { return normalizeSymbolSize(data.getItemVisual(idx, "symbolSize")); }; Symbol2.getSymbolZ2 = function(data, idx) { return data.getItemVisual(idx, "z2"); }; return Symbol2; }(Group_default) ); function driftSymbol(dx, dy) { this.parent.drift(dx, dy); } var Symbol_default = Symbol; // ../node_modules/.pnpm/echarts@6.0.0/node_modules/echarts/lib/chart/helper/SymbolDraw.js function symbolNeedsDraw(data, point, idx, opt) { return point && !isNaN(point[0]) && !isNaN(point[1]) && !(opt.isIgnore && opt.isIgnore(idx)) && !(opt.clipShape && !opt.clipShape.contain(point[0], point[1])) && data.getItemVisual(idx, "symbol") !== "none"; } function normalizeUpdateOpt(opt) { if (opt != null && !isObject(opt)) { opt = { isIgnore: opt }; } return opt || {}; } function makeSeriesScope(data) { var seriesModel = data.hostModel; var emphasisModel = seriesModel.getModel("emphasis"); return { emphasisItemStyle: emphasisModel.getModel("itemStyle").getItemStyle(), blurItemStyle: seriesModel.getModel(["blur", "itemStyle"]).getItemStyle(), selectItemStyle: seriesModel.getModel(["select", "itemStyle"]).getItemStyle(), focus: emphasisModel.get("focus"), blurScope: emphasisModel.get("blurScope"), emphasisDisabled: emphasisModel.get("disabled"), hoverScale: emphasisModel.get("scale"), labelStatesModels: getLabelStatesModels(seriesModel), cursorStyle: seriesModel.get("cursor") }; } var SymbolDraw = ( /** @class */ function() { function SymbolDraw2(SymbolCtor) { this.group = new Group_default(); this._SymbolCtor = SymbolCtor || Symbol_default; } SymbolDraw2.prototype.updateData = function(data, opt) { this._progressiveEls = null; opt = normalizeUpdateOpt(opt); var group = this.group; var seriesModel = data.hostModel; var oldData = this._data; var SymbolCtor = this._SymbolCtor; var disableAnimation = opt.disableAnimation; var seriesScope = makeSeriesScope(data); var symbolUpdateOpt = { disableAnimation }; var getSymbolPoint = opt.getSymbolPoint || function(idx) { return data.getItemLayout(idx); }; if (!oldData) { group.removeAll(); } data.diff(oldData).add(function(newIdx) { var point = getSymbolPoint(newIdx); if (symbolNeedsDraw(data, point, newIdx, opt)) { var symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt); symbolEl.setPosition(point); data.setItemGraphicEl(newIdx, symbolEl); group.add(symbolEl); } }).update(function(newIdx, oldIdx) { var symbolEl = oldData.getItemGraphicEl(oldIdx); var point = getSymbolPoint(newIdx); if (!symbolNeedsDraw(data, point, newIdx, opt)) { group.remove(symbolEl); return; } var newSymbolType = data.getItemVisual(newIdx, "symbol") || "circle"; var oldSymbolType = symbolEl && symbolEl.getSymbolType && symbolEl.getSymbolType(); if (!symbolEl || oldSymbolType && oldSymbolType !== newSymbolType) { group.remove(symbolEl); symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt); symbolEl.setPosition(point); } else { symbolEl.updateData(data, newIdx, seriesScope, symbolUpdateOpt); var target = { x: point[0], y: point[1] }; disableAnimation ? symbolEl.attr(target) : updateProps(symbolEl, target, seriesModel); } group.add(symbolEl); data.setItemGraphicEl(newIdx, symbolEl); }).remove(function(oldIdx) { var el = oldData.getItemGraphicEl(oldIdx); el && el.fadeOut(function() { group.remove(el); }, seriesModel); }).execute(); this._getSymbolPoint = getSymbolPoint; this._data = data; }; ; SymbolDraw2.prototype.updateLayout = function() { var _this = this; var data = this._data; if (data) { data.eachItemGraphicEl(function(el, idx) { var point = _this._getSymbolPoint(idx); el.setPosition(point); el.markRedraw(); }); } }; ; SymbolDraw2.prototype.incrementalPrepareUpdate = function(data) { this._seriesScope = makeSeriesScope(data); this._data = null; this.group.removeAll(); }; ; SymbolDraw2.prototype.incrementalUpdate = function(taskParams, data, opt) { this._progressiveEls = []; opt = normalizeUpdateOpt(opt); function updateIncrementalAndHover(el2) { if (!el2.isGroup) { el2.incremental = true; el2.ensureState("emphasis").hoverLayer = true; } } for (var idx = taskParams.start; idx < taskParams.end; idx++) { var point = data.getItemLayout(idx); if (symbolNeedsDraw(data, point, idx, opt)) { var el = new this._SymbolCtor(data, idx, this._seriesScope); el.traverse(updateIncrementalAndHover); el.setPosition(point); this.group.add(el); data.setItemGraphicEl(idx, el); this._progressiveEls.push(el); } } }; ; SymbolDraw2.prototype.eachRendered = function(cb) { traverseElements(this._progressiveEls || this.group, cb); }; SymbolDraw2.prototype.remove = function(enableAnimation) { var group = this.group; var data = this._data; if (data && enableAnimation) { data.eachItemGraphicEl(function(el) { el.fadeOut(function() { group.remove(el); }, data.hostModel); }); } else { group.removeAll(); } }; ; return SymbolDraw2; }() ); var SymbolDraw_default = SymbolDraw; export { getDefaultLabel, getDefaultInterpolatedLabel, Symbol_default, SymbolDraw_default, axisDefault_default, registerAxisBreakHelperImpl, getAxisBreakHelper, axisModelCreator, Axis2D_default, AXIS_BREAK_EXPAND_ACTION_TYPE, AXIS_BREAK_COLLAPSE_ACTION_TYPE, AXIS_BREAK_TOGGLE_ACTION_TYPE, registerAction, AxisBuilder_default, layout, alignScaleTicks, registerLegacyGridContainLabelImpl, collect, getAxisInfo, makeKey, AxisView_default, rectCoordAxisBuildSplitArea, rectCoordAxisHandleRemove, install }; //# sourceMappingURL=chunk-JZXIWOSK.js.map