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

Function axisLine

src/component/axis/AxisBuilder.ts:672–786  ·  view source on GitHub ↗
(cfg, local, shared, axisModel, group, transformGroup, api)

Source from the content-addressed store, hash-verified

670const builders: Record<AxisBuilderAxisPartName, AxisElementsBuilder> = {
671
672 axisLine(cfg, local, shared, axisModel, group, transformGroup, api) {
673 if (__DEV__) {
674 const ready = shared.ensureRecord(axisModel).ready;
675 assert(!ready.axisLine);
676 ready.axisLine = true;
677 }
678
679 let shown = axisModel.get(['axisLine', 'show']);
680 if (shown === 'auto') {
681 shown = true;
682 if (cfg.raw.axisLineAutoShow != null) {
683 shown = !!cfg.raw.axisLineAutoShow;
684 }
685 }
686 if (!shown) {
687 return;
688 }
689
690 const extent = axisModel.axis.getExtent();
691
692 const matrix = transformGroup.transform;
693 const pt1 = [extent[0], 0];
694 const pt2 = [extent[1], 0];
695 const inverse = pt1[0] > pt2[0];
696 if (matrix) {
697 v2ApplyTransform(pt1, pt1, matrix);
698 v2ApplyTransform(pt2, pt2, matrix);
699 }
700
701 const lineStyle = extend(
702 {
703 lineCap: 'round'
704 },
705 axisModel.getModel(['axisLine', 'lineStyle']).getLineStyle()
706 );
707 const pathBaseProp: PathProps = {
708 strokeContainThreshold: cfg.raw.strokeContainThreshold || 5,
709 silent: true,
710 z2: 1,
711 style: lineStyle,
712 };
713
714 if (axisModel.get(['axisLine', 'breakLine']) && hasBreaks(axisModel.axis.scale)) {
715 getAxisBreakHelper()!.buildAxisBreakLine(axisModel, group, transformGroup, pathBaseProp);
716 }
717 else {
718 const line = new graphic.Line(extend({
719 shape: {
720 x1: pt1[0],
721 y1: pt1[1],
722 x2: pt2[0],
723 y2: pt2[1]
724 },
725 }, pathBaseProp));
726 graphic.subPixelOptimizeLine(line.shape, line.style.lineWidth);
727 line.anid = 'line';
728 group.add(line);
729 }

Callers

nothing calls this directly

Calls 14

hasBreaksFunction · 0.90
getAxisBreakHelperFunction · 0.90
normalizeSymbolOffsetFunction · 0.90
createSymbolFunction · 0.90
extendFunction · 0.85
isNumberFunction · 0.85
ensureRecordMethod · 0.80
getLineStyleMethod · 0.80
getExtentMethod · 0.65
assertFunction · 0.50
eachFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…