MCPcopy
hub / github.com/tdewolff/minify / makeAxisPointerModel

Function makeAxisPointerModel

_benchmarks/sample_echarts.js:47620–47654  ·  view source on GitHub ↗
(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip)

Source from the content-addressed store, hash-verified

47618 }
47619
47620 function makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) {
47621 var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer');
47622 var fields = ['type', 'snap', 'lineStyle', 'shadowStyle', 'label', 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z'];
47623 var volatileOption = {};
47624 each(fields, function (field) {
47625 volatileOption[field] = clone(tooltipAxisPointerModel.get(field));
47626 }); // category axis do not auto snap, otherwise some tick that do not
47627 // has value can not be hovered. value/time/log axis default snap if
47628 // triggered from tooltip and trigger tooltip.
47629
47630 volatileOption.snap = axis.type !== 'category' && !!triggerTooltip; // Compatibel with previous behavior, tooltip axis do not show label by default.
47631 // Only these properties can be overrided from tooltip to axisPointer.
47632
47633 if (tooltipAxisPointerModel.get('type') === 'cross') {
47634 volatileOption.type = 'line';
47635 }
47636
47637 var labelOption = volatileOption.label || (volatileOption.label = {}); // Follow the convention, do not show label when triggered by tooltip by default.
47638
47639 labelOption.show == null && (labelOption.show = false);
47640
47641 if (fromTooltip === 'cross') {
47642 // When 'cross', both axes show labels.
47643 var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(['label', 'show']);
47644 labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true; // If triggerTooltip, this is a base axis, which should better not use cross style
47645 // (cross style is dashed by default)
47646
47647 if (!triggerTooltip) {
47648 var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle');
47649 crossStyle && defaults(labelOption, crossStyle.textStyle);
47650 }
47651 }
47652
47653 return axis.model.getModel('axisPointer', new Model(volatileOption, globalAxisPointerModel, ecModel));
47654 }
47655
47656 function collectSeriesInfo(result, ecModel) {
47657 // Prepare data for axis trigger

Callers 1

saveTooltipAxisInfoFunction · 0.85

Calls 3

eachFunction · 0.70
cloneFunction · 0.70
defaultsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…