base.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. import { __assign, __extends } from "tslib";
  2. import { ext } from '@antv/matrix-util';
  3. import { each, filter, get, isFunction, isNil, isNumberEqual, mix, size } from '@antv/util';
  4. import GroupComponent from '../abstract/group-component';
  5. import { getMatrixByAngle } from '../util/matrix';
  6. import { getStatesStyle } from '../util/state';
  7. import Theme from '../util/theme';
  8. var AxisBase = /** @class */ (function (_super) {
  9. __extends(AxisBase, _super);
  10. function AxisBase() {
  11. return _super !== null && _super.apply(this, arguments) || this;
  12. }
  13. AxisBase.prototype.getDefaultCfg = function () {
  14. var cfg = _super.prototype.getDefaultCfg.call(this);
  15. return __assign(__assign({}, cfg), { name: 'axis', ticks: [], line: {}, tickLine: {}, subTickLine: null, title: null,
  16. /**
  17. * 文本标签的配置项
  18. */
  19. label: {},
  20. /**
  21. * 垂直于坐标轴方向的因子,决定文本、title、tickLine 在坐标轴的哪一侧
  22. */
  23. verticalFactor: 1,
  24. // 垂直方向限制的长度,对文本自适应有很大影响
  25. verticalLimitLength: null, overlapOrder: ['autoRotate', 'autoEllipsis', 'autoHide'], tickStates: {}, optimize: {}, defaultCfg: {
  26. line: {
  27. // @type {Attrs} 坐标轴线的图形属性,如果设置成null,则不显示轴线
  28. style: {
  29. lineWidth: 1,
  30. stroke: Theme.lineColor,
  31. },
  32. },
  33. tickLine: {
  34. // @type {Attrs} 标注坐标线的图形属性
  35. style: {
  36. lineWidth: 1,
  37. stroke: Theme.lineColor,
  38. },
  39. alignTick: true,
  40. length: 5,
  41. displayWithLabel: true,
  42. },
  43. subTickLine: {
  44. // @type {Attrs} 标注坐标线的图形属性
  45. style: {
  46. lineWidth: 1,
  47. stroke: Theme.lineColor,
  48. },
  49. count: 4,
  50. length: 2,
  51. },
  52. label: {
  53. autoRotate: true,
  54. autoHide: false,
  55. autoEllipsis: false,
  56. style: {
  57. fontSize: 12,
  58. fill: Theme.textColor,
  59. fontFamily: Theme.fontFamily,
  60. fontWeight: 'normal',
  61. },
  62. offset: 10,
  63. offsetX: 0,
  64. offsetY: 0,
  65. },
  66. title: {
  67. autoRotate: true,
  68. spacing: 5,
  69. position: 'center',
  70. style: {
  71. fontSize: 12,
  72. fill: Theme.textColor,
  73. textBaseline: 'middle',
  74. fontFamily: Theme.fontFamily,
  75. textAlign: 'center',
  76. },
  77. iconStyle: {
  78. fill: Theme.descriptionIconFill,
  79. stroke: Theme.descriptionIconStroke,
  80. },
  81. description: ''
  82. },
  83. tickStates: {
  84. active: {
  85. labelStyle: {
  86. fontWeight: 500,
  87. },
  88. tickLineStyle: {
  89. lineWidth: 2,
  90. },
  91. },
  92. inactive: {
  93. labelStyle: {
  94. fill: Theme.uncheckedColor,
  95. },
  96. },
  97. },
  98. // 针对大数据量进行优化配置
  99. optimize: {
  100. enable: true,
  101. threshold: 400,
  102. },
  103. }, theme: {} });
  104. };
  105. /**
  106. * 绘制组件
  107. */
  108. AxisBase.prototype.renderInner = function (group) {
  109. if (this.get('line')) {
  110. this.drawLine(group);
  111. }
  112. // drawTicks 包括 drawLabels 和 drawTickLines
  113. this.drawTicks(group);
  114. if (this.get('title')) {
  115. this.drawTitle(group);
  116. }
  117. };
  118. // 实现 IList 接口
  119. AxisBase.prototype.isList = function () {
  120. return true;
  121. };
  122. /**
  123. * 获取图例项
  124. * @return {ListItem[]} 列表项集合
  125. */
  126. AxisBase.prototype.getItems = function () {
  127. return this.get('ticks');
  128. };
  129. /**
  130. * 设置列表项
  131. * @param {ListItem[]} items 列表项集合
  132. */
  133. AxisBase.prototype.setItems = function (items) {
  134. this.update({
  135. ticks: items,
  136. });
  137. };
  138. /**
  139. * 更新列表项
  140. * @param {ListItem} item 列表项
  141. * @param {object} cfg 列表项
  142. */
  143. AxisBase.prototype.updateItem = function (item, cfg) {
  144. mix(item, cfg);
  145. this.clear(); // 由于单个图例项变化,会引起全局变化,所以全部更新
  146. this.render();
  147. };
  148. /**
  149. * 清空列表
  150. */
  151. AxisBase.prototype.clearItems = function () {
  152. var itemGroup = this.getElementByLocalId('label-group');
  153. itemGroup && itemGroup.clear();
  154. };
  155. /**
  156. * 设置列表项的状态
  157. * @param {ListItem} item 列表项
  158. * @param {string} state 状态名
  159. * @param {boolean} value 状态值, true, false
  160. */
  161. AxisBase.prototype.setItemState = function (item, state, value) {
  162. item[state] = value;
  163. this.updateTickStates(item); // 应用状态样式
  164. };
  165. /**
  166. * 是否存在指定的状态
  167. * @param {ListItem} item 列表项
  168. * @param {boolean} state 状态名
  169. */
  170. AxisBase.prototype.hasState = function (item, state) {
  171. return !!item[state];
  172. };
  173. AxisBase.prototype.getItemStates = function (item) {
  174. var tickStates = this.get('tickStates');
  175. var rst = [];
  176. each(tickStates, function (v, k) {
  177. if (item[k]) {
  178. // item.selected
  179. rst.push(k);
  180. }
  181. });
  182. return rst;
  183. };
  184. /**
  185. * 清楚所有列表项的状态
  186. * @param {string} state 状态值
  187. */
  188. AxisBase.prototype.clearItemsState = function (state) {
  189. var _this = this;
  190. var items = this.getItemsByState(state);
  191. each(items, function (item) {
  192. _this.setItemState(item, state, false);
  193. });
  194. };
  195. /**
  196. * 根据状态获取图例项
  197. * @param {string} state [description]
  198. * @return {ListItem[]} [description]
  199. */
  200. AxisBase.prototype.getItemsByState = function (state) {
  201. var _this = this;
  202. var items = this.getItems();
  203. return filter(items, function (item) {
  204. return _this.hasState(item, state);
  205. });
  206. };
  207. AxisBase.prototype.getSidePoint = function (point, offset) {
  208. var self = this;
  209. var vector = self.getSideVector(offset, point);
  210. return {
  211. x: point.x + vector[0],
  212. y: point.y + vector[1],
  213. };
  214. };
  215. AxisBase.prototype.getTextAnchor = function (vector) {
  216. var align;
  217. if (isNumberEqual(vector[0], 0)) {
  218. align = 'center';
  219. }
  220. else if (vector[0] > 0) {
  221. align = 'start';
  222. }
  223. else if (vector[0] < 0) {
  224. align = 'end';
  225. }
  226. return align;
  227. };
  228. AxisBase.prototype.getTextBaseline = function (vector) {
  229. var base;
  230. if (isNumberEqual(vector[1], 0)) {
  231. base = 'middle';
  232. }
  233. else if (vector[1] > 0) {
  234. base = 'top';
  235. }
  236. else if (vector[1] < 0) {
  237. base = 'bottom';
  238. }
  239. return base;
  240. };
  241. AxisBase.prototype.processOverlap = function (labelGroup) { };
  242. // 绘制坐标轴线
  243. AxisBase.prototype.drawLine = function (group) {
  244. var path = this.getLinePath();
  245. var line = this.get('line'); // line 的判空在调用 drawLine 之前,不在这里判定
  246. this.addShape(group, {
  247. type: 'path',
  248. id: this.getElementId('line'),
  249. name: 'axis-line',
  250. attrs: mix({
  251. path: path,
  252. }, line.style),
  253. });
  254. };
  255. AxisBase.prototype.getTickLineItems = function (ticks) {
  256. var _this = this;
  257. var tickLineItems = [];
  258. var tickLine = this.get('tickLine');
  259. var alignTick = tickLine.alignTick;
  260. var tickLineLength = tickLine.length;
  261. var tickSegment = 1;
  262. var tickCount = ticks.length;
  263. if (tickCount >= 2) {
  264. tickSegment = ticks[1].value - ticks[0].value;
  265. }
  266. each(ticks, function (tick) {
  267. var point = tick.point;
  268. if (!alignTick) {
  269. // tickLine 不同 tick 对齐时需要调整 point
  270. point = _this.getTickPoint(tick.value - tickSegment / 2);
  271. }
  272. var endPoint = _this.getSidePoint(point, tickLineLength);
  273. tickLineItems.push({
  274. startPoint: point,
  275. tickValue: tick.value,
  276. endPoint: endPoint,
  277. tickId: tick.id,
  278. id: "tickline-" + tick.id,
  279. });
  280. });
  281. // 如果 tickLine 不居中对齐,则需要在最后面补充一个 tickLine
  282. // if (!alignTick && tickCount > 0) {
  283. // const tick = ticks[tickCount - 1];
  284. // const point = this.getTickPoint(tick.value + tickSegment / 2);
  285. // }
  286. return tickLineItems;
  287. };
  288. AxisBase.prototype.getSubTickLineItems = function (tickLineItems) {
  289. var subTickLineItems = [];
  290. var subTickLine = this.get('subTickLine');
  291. var subCount = subTickLine.count;
  292. var tickLineCount = tickLineItems.length;
  293. // 刻度线的数量大于 2 时,才绘制子刻度
  294. if (tickLineCount >= 2) {
  295. for (var i = 0; i < tickLineCount - 1; i++) {
  296. var pre = tickLineItems[i];
  297. var next = tickLineItems[i + 1];
  298. for (var j = 0; j < subCount; j++) {
  299. var percent = (j + 1) / (subCount + 1);
  300. var tickValue = (1 - percent) * pre.tickValue + percent * next.tickValue;
  301. var point = this.getTickPoint(tickValue);
  302. var endPoint = this.getSidePoint(point, subTickLine.length);
  303. subTickLineItems.push({
  304. startPoint: point,
  305. endPoint: endPoint,
  306. tickValue: tickValue,
  307. id: "sub-" + pre.id + "-" + j,
  308. });
  309. }
  310. }
  311. }
  312. return subTickLineItems;
  313. };
  314. AxisBase.prototype.getTickLineAttrs = function (tickItem, type, index, tickItems) {
  315. var style = this.get(type).style;
  316. // 保持和 grid 相同的数据结构
  317. var item = {
  318. points: [tickItem.startPoint, tickItem.endPoint],
  319. };
  320. var defaultTickLineStyle = get(this.get('theme'), ['tickLine', 'style'], {});
  321. style = isFunction(style) ? mix({}, defaultTickLineStyle, style(item, index, tickItems)) : style;
  322. var startPoint = tickItem.startPoint, endPoint = tickItem.endPoint;
  323. return __assign({ x1: startPoint.x, y1: startPoint.y, x2: endPoint.x, y2: endPoint.y }, style);
  324. };
  325. // 绘制坐标轴刻度线
  326. AxisBase.prototype.drawTick = function (tickItem, tickLineGroup, type, index, tickItems) {
  327. this.addShape(tickLineGroup, {
  328. type: 'line',
  329. id: this.getElementId(tickItem.id),
  330. name: "axis-" + type,
  331. attrs: this.getTickLineAttrs(tickItem, type, index, tickItems),
  332. });
  333. };
  334. // 绘制坐标轴刻度线,包括子刻度线
  335. AxisBase.prototype.drawTickLines = function (group) {
  336. var _this = this;
  337. var ticks = this.get('ticks');
  338. var subTickLine = this.get('subTickLine');
  339. var tickLineItems = this.getTickLineItems(ticks);
  340. var tickLineGroup = this.addGroup(group, {
  341. name: 'axis-tickline-group',
  342. id: this.getElementId('tickline-group'),
  343. });
  344. var tickCfg = this.get('tickLine');
  345. each(tickLineItems, function (item, index) {
  346. if (tickCfg.displayWithLabel) {
  347. // 如果跟随 label 显示,则检测是否存在对应的 label
  348. var labelId = _this.getElementId("label-" + item.tickId);
  349. if (group.findById(labelId)) {
  350. _this.drawTick(item, tickLineGroup, 'tickLine', index, tickLineItems);
  351. }
  352. }
  353. else {
  354. _this.drawTick(item, tickLineGroup, 'tickLine', index, tickLineItems);
  355. }
  356. });
  357. if (subTickLine) {
  358. var subTickLineItems_1 = this.getSubTickLineItems(tickLineItems);
  359. each(subTickLineItems_1, function (item, index) {
  360. _this.drawTick(item, tickLineGroup, 'subTickLine', index, subTickLineItems_1);
  361. });
  362. }
  363. };
  364. // 预处理 ticks 确定位置和补充 id
  365. AxisBase.prototype.processTicks = function () {
  366. var _this = this;
  367. var ticks = this.get('ticks');
  368. each(ticks, function (tick) {
  369. tick.point = _this.getTickPoint(tick.value);
  370. // 补充 tick 的 id,为动画和更新做准备
  371. if (isNil(tick.id)) {
  372. // 默认使用 tick.name 作为id
  373. tick.id = tick.name;
  374. }
  375. });
  376. };
  377. // 绘制 ticks 包括文本和 tickLine
  378. AxisBase.prototype.drawTicks = function (group) {
  379. var _this = this;
  380. this.optimizeTicks();
  381. this.processTicks();
  382. if (this.get('label')) {
  383. this.drawLabels(group);
  384. }
  385. if (this.get('tickLine')) {
  386. this.drawTickLines(group);
  387. }
  388. var ticks = this.get('ticks');
  389. each(ticks, function (tick) {
  390. _this.applyTickStates(tick, group);
  391. });
  392. };
  393. /**
  394. * 根据 optimize 配置对 ticks 进行抽样,对抽样过后的 ticks 才进行真实的渲染
  395. */
  396. AxisBase.prototype.optimizeTicks = function () {
  397. var optimize = this.get('optimize');
  398. var ticks = this.get('ticks');
  399. if (optimize && optimize.enable && optimize.threshold > 0) {
  400. var len = size(ticks);
  401. if (len > optimize.threshold) {
  402. var page_1 = Math.ceil(len / optimize.threshold);
  403. var optimizedTicks = ticks.filter(function (tick, idx) { return idx % page_1 === 0; });
  404. this.set('ticks', optimizedTicks);
  405. this.set('originalTicks', ticks);
  406. }
  407. }
  408. };
  409. // 获取 label 的配置项
  410. AxisBase.prototype.getLabelAttrs = function (tick, index, ticks) {
  411. var labelCfg = this.get('label');
  412. var offset = labelCfg.offset, offsetX = labelCfg.offsetX, offsetY = labelCfg.offsetY, rotate = labelCfg.rotate, formatter = labelCfg.formatter;
  413. var point = this.getSidePoint(tick.point, offset);
  414. var vector = this.getSideVector(offset, point);
  415. var text = formatter ? formatter(tick.name, tick, index) : tick.name;
  416. var style = labelCfg.style;
  417. style = isFunction(style) ? get(this.get('theme'), ['label', 'style'], {}) : style;
  418. var attrs = mix({
  419. x: point.x + offsetX,
  420. y: point.y + offsetY,
  421. text: text,
  422. textAlign: this.getTextAnchor(vector),
  423. textBaseline: this.getTextBaseline(vector),
  424. }, style);
  425. if (rotate) {
  426. attrs.matrix = getMatrixByAngle(point, rotate);
  427. }
  428. return attrs;
  429. };
  430. // 绘制文本
  431. AxisBase.prototype.drawLabels = function (group) {
  432. var _this = this;
  433. var ticks = this.get('ticks');
  434. var labelGroup = this.addGroup(group, {
  435. name: 'axis-label-group',
  436. id: this.getElementId('label-group'),
  437. });
  438. each(ticks, function (tick, index) {
  439. _this.addShape(labelGroup, {
  440. type: 'text',
  441. name: 'axis-label',
  442. id: _this.getElementId("label-" + tick.id),
  443. attrs: _this.getLabelAttrs(tick, index, ticks),
  444. delegateObject: {
  445. tick: tick,
  446. item: tick,
  447. index: index,
  448. },
  449. });
  450. });
  451. this.processOverlap(labelGroup);
  452. // 处理完后再进行 style 回调处理
  453. var labels = labelGroup.getChildren();
  454. var defaultLabelStyle = get(this.get('theme'), ['label', 'style'], {});
  455. var _a = this.get('label'), style = _a.style, formatter = _a.formatter;
  456. if (isFunction(style)) {
  457. var afterProcessTicks_1 = labels.map(function (label) { return get(label.get('delegateObject'), 'tick'); });
  458. each(labels, function (label, index) {
  459. var tick = label.get('delegateObject').tick;
  460. var text = formatter ? formatter(tick.name, tick, index) : tick.name;
  461. var newStyle = mix({}, defaultLabelStyle, style(text, index, afterProcessTicks_1));
  462. label.attr(newStyle);
  463. });
  464. }
  465. };
  466. // 标题的属性
  467. AxisBase.prototype.getTitleAttrs = function () {
  468. var titleCfg = this.get('title');
  469. var style = titleCfg.style, position = titleCfg.position, offset = titleCfg.offset, _a = titleCfg.spacing, spacing = _a === void 0 ? 0 : _a, autoRotate = titleCfg.autoRotate;
  470. var titleHeight = style.fontSize;
  471. var percent = 0.5;
  472. if (position === 'start') {
  473. percent = 0;
  474. }
  475. else if (position === 'end') {
  476. percent = 1;
  477. }
  478. var point = this.getTickPoint(percent); // 标题对应的坐标轴上的点
  479. // 如果没有指定 titleOffset 也没有渲染 label,这里需要自动计算 offset
  480. var titlePoint = this.getSidePoint(point, offset || spacing + titleHeight / 2); // 标题的点
  481. var attrs = mix({
  482. x: titlePoint.x,
  483. y: titlePoint.y,
  484. text: titleCfg.text,
  485. }, style);
  486. var rotate = titleCfg.rotate; // rotate 是角度值
  487. var angle = rotate;
  488. if (isNil(rotate) && autoRotate) {
  489. // 用户没有设定旋转角度,同时设置自动旋转
  490. var vector = this.getAxisVector(point);
  491. var v1 = [1, 0]; // 水平方向的向量
  492. angle = ext.angleTo(vector, v1, true);
  493. }
  494. if (angle) {
  495. var matrix = getMatrixByAngle(titlePoint, angle);
  496. attrs.matrix = matrix;
  497. }
  498. return attrs;
  499. };
  500. // 绘制标题
  501. AxisBase.prototype.drawTitle = function (group) {
  502. var _a;
  503. var titleAttrs = this.getTitleAttrs();
  504. var titleShape = this.addShape(group, {
  505. type: 'text',
  506. id: this.getElementId('title'),
  507. name: 'axis-title',
  508. attrs: titleAttrs
  509. });
  510. // description字段存在时,显示icon
  511. if ((_a = this.get('title')) === null || _a === void 0 ? void 0 : _a.description) {
  512. this.drawDescriptionIcon(group, titleShape, titleAttrs.matrix);
  513. }
  514. };
  515. AxisBase.prototype.drawDescriptionIcon = function (group, titleShape, matrix) {
  516. var descriptionShape = this.addGroup(group, {
  517. name: 'axis-description',
  518. id: this.getElementById('description')
  519. });
  520. var _a = titleShape.getBBox(), maxX = _a.maxX, maxY = _a.maxY, height = _a.height;
  521. var iconStyle = this.get('title').iconStyle;
  522. var spacing = 4; // 设置icon与文本之间距离
  523. var r = height / 2;
  524. var lineWidth = r / 6;
  525. var startX = maxX + spacing;
  526. var startY = maxY - height / 2;
  527. // 绘制 information icon 路径
  528. // 外圆环path
  529. var _b = [startX + r, startY - r], x0 = _b[0], y0 = _b[1];
  530. var _c = [x0 + r, y0 + r], x1 = _c[0], y1 = _c[1];
  531. var _d = [x0, y1 + r], x2 = _d[0], y2 = _d[1];
  532. var _e = [startX, y0 + r], x3 = _e[0], y3 = _e[1];
  533. // i path
  534. var _f = [startX + r, startY - height / 4], x4 = _f[0], y4 = _f[1];
  535. var _g = [x4, y4 + lineWidth], x5 = _g[0], y5 = _g[1];
  536. var _h = [x5, y5 + lineWidth], x6 = _h[0], y6 = _h[1];
  537. var _j = [x6, y6 + r * 3 / 4], x7 = _j[0], y7 = _j[1];
  538. this.addShape(descriptionShape, {
  539. type: 'path',
  540. id: this.getElementId('title-description-icon'),
  541. name: 'axis-title-description-icon',
  542. attrs: __assign({ path: [
  543. ['M', x0, y0],
  544. ['A', r, r, 0, 0, 1, x1, y1],
  545. ['A', r, r, 0, 0, 1, x2, y2],
  546. ['A', r, r, 0, 0, 1, x3, y3],
  547. ['A', r, r, 0, 0, 1, x0, y0],
  548. ['M', x4, y4],
  549. ['L', x5, y5],
  550. ['M', x6, y6],
  551. ['L', x7, y7]
  552. ], lineWidth: lineWidth,
  553. matrix: matrix }, iconStyle),
  554. });
  555. // 点击热区,设置透明矩形
  556. this.addShape(descriptionShape, {
  557. type: 'rect',
  558. id: this.getElementId('title-description-rect'),
  559. name: 'axis-title-description-rect',
  560. attrs: {
  561. x: startX,
  562. y: startY - height / 2,
  563. width: height,
  564. height: height,
  565. stroke: '#000',
  566. fill: '#000',
  567. opacity: 0,
  568. matrix: matrix,
  569. cursor: 'pointer'
  570. }
  571. });
  572. };
  573. AxisBase.prototype.applyTickStates = function (tick, group) {
  574. var states = this.getItemStates(tick);
  575. if (states.length) {
  576. var tickStates = this.get('tickStates');
  577. // 分别更新 label 和 tickLine
  578. var labelId = this.getElementId("label-" + tick.id);
  579. var labelShape = group.findById(labelId);
  580. if (labelShape) {
  581. var labelStateStyle = getStatesStyle(tick, 'label', tickStates);
  582. labelStateStyle && labelShape.attr(labelStateStyle);
  583. }
  584. var tickLineId = this.getElementId("tickline-" + tick.id);
  585. var tickLineShape = group.findById(tickLineId);
  586. if (tickLineShape) {
  587. var tickLineStateStyle = getStatesStyle(tick, 'tickLine', tickStates);
  588. tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
  589. }
  590. }
  591. };
  592. AxisBase.prototype.updateTickStates = function (tick) {
  593. var states = this.getItemStates(tick);
  594. var tickStates = this.get('tickStates');
  595. var labelCfg = this.get('label');
  596. var labelShape = this.getElementByLocalId("label-" + tick.id);
  597. var tickLineCfg = this.get('tickLine');
  598. var tickLineShape = this.getElementByLocalId("tickline-" + tick.id);
  599. if (states.length) {
  600. if (labelShape) {
  601. var labelStateStyle = getStatesStyle(tick, 'label', tickStates);
  602. labelStateStyle && labelShape.attr(labelStateStyle);
  603. }
  604. if (tickLineShape) {
  605. var tickLineStateStyle = getStatesStyle(tick, 'tickLine', tickStates);
  606. tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
  607. }
  608. }
  609. else {
  610. if (labelShape) {
  611. labelShape.attr(labelCfg.style);
  612. }
  613. if (tickLineShape) {
  614. tickLineShape.attr(tickLineCfg.style);
  615. }
  616. }
  617. };
  618. return AxisBase;
  619. }(GroupComponent));
  620. export default AxisBase;
  621. //# sourceMappingURL=base.js.map