AxisBuilder.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. var _util = require("zrender/lib/core/util");
  2. var retrieve = _util.retrieve;
  3. var defaults = _util.defaults;
  4. var extend = _util.extend;
  5. var each = _util.each;
  6. var formatUtil = require("../../util/format");
  7. var graphic = require("../../util/graphic");
  8. var Model = require("../../model/Model");
  9. var _number = require("../../util/number");
  10. var isRadianAroundZero = _number.isRadianAroundZero;
  11. var remRadian = _number.remRadian;
  12. var _symbol = require("../../util/symbol");
  13. var createSymbol = _symbol.createSymbol;
  14. var matrixUtil = require("zrender/lib/core/matrix");
  15. var _vector = require("zrender/lib/core/vector");
  16. var v2ApplyTransform = _vector.applyTransform;
  17. var PI = Math.PI;
  18. function makeAxisEventDataBase(axisModel) {
  19. var eventData = {
  20. componentType: axisModel.mainType
  21. };
  22. eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex;
  23. return eventData;
  24. }
  25. /**
  26. * A final axis is translated and rotated from a "standard axis".
  27. * So opt.position and opt.rotation is required.
  28. *
  29. * A standard axis is and axis from [0, 0] to [0, axisExtent[1]],
  30. * for example: (0, 0) ------------> (0, 50)
  31. *
  32. * nameDirection or tickDirection or labelDirection is 1 means tick
  33. * or label is below the standard axis, whereas is -1 means above
  34. * the standard axis. labelOffset means offset between label and axis,
  35. * which is useful when 'onZero', where axisLabel is in the grid and
  36. * label in outside grid.
  37. *
  38. * Tips: like always,
  39. * positive rotation represents anticlockwise, and negative rotation
  40. * represents clockwise.
  41. * The direction of position coordinate is the same as the direction
  42. * of screen coordinate.
  43. *
  44. * Do not need to consider axis 'inverse', which is auto processed by
  45. * axis extent.
  46. *
  47. * @param {module:zrender/container/Group} group
  48. * @param {Object} axisModel
  49. * @param {Object} opt Standard axis parameters.
  50. * @param {Array.<number>} opt.position [x, y]
  51. * @param {number} opt.rotation by radian
  52. * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle' or 'center'.
  53. * @param {number} [opt.tickDirection=1] 1 or -1
  54. * @param {number} [opt.labelDirection=1] 1 or -1
  55. * @param {number} [opt.labelOffset=0] Usefull when onZero.
  56. * @param {string} [opt.axisLabelShow] default get from axisModel.
  57. * @param {string} [opt.axisName] default get from axisModel.
  58. * @param {number} [opt.axisNameAvailableWidth]
  59. * @param {number} [opt.labelRotate] by degree, default get from axisModel.
  60. * @param {number} [opt.labelInterval] Default label interval when label
  61. * interval from model is null or 'auto'.
  62. * @param {number} [opt.strokeContainThreshold] Default label interval when label
  63. * @param {number} [opt.nameTruncateMaxWidth]
  64. */
  65. var AxisBuilder = function (axisModel, opt) {
  66. /**
  67. * @readOnly
  68. */
  69. this.opt = opt;
  70. /**
  71. * @readOnly
  72. */
  73. this.axisModel = axisModel; // Default value
  74. defaults(opt, {
  75. labelOffset: 0,
  76. nameDirection: 1,
  77. tickDirection: 1,
  78. labelDirection: 1,
  79. silent: true
  80. });
  81. /**
  82. * @readOnly
  83. */
  84. this.group = new graphic.Group(); // FIXME Not use a seperate text group?
  85. var dumbGroup = new graphic.Group({
  86. position: opt.position.slice(),
  87. rotation: opt.rotation
  88. }); // this.group.add(dumbGroup);
  89. // this._dumbGroup = dumbGroup;
  90. dumbGroup.updateTransform();
  91. this._transform = dumbGroup.transform;
  92. this._dumbGroup = dumbGroup;
  93. };
  94. AxisBuilder.prototype = {
  95. constructor: AxisBuilder,
  96. hasBuilder: function (name) {
  97. return !!builders[name];
  98. },
  99. add: function (name) {
  100. builders[name].call(this);
  101. },
  102. getGroup: function () {
  103. return this.group;
  104. }
  105. };
  106. var builders = {
  107. /**
  108. * @private
  109. */
  110. axisLine: function () {
  111. var opt = this.opt;
  112. var axisModel = this.axisModel;
  113. if (!axisModel.get('axisLine.show')) {
  114. return;
  115. }
  116. var extent = this.axisModel.axis.getExtent();
  117. var matrix = this._transform;
  118. var pt1 = [extent[0], 0];
  119. var pt2 = [extent[1], 0];
  120. if (matrix) {
  121. v2ApplyTransform(pt1, pt1, matrix);
  122. v2ApplyTransform(pt2, pt2, matrix);
  123. }
  124. var lineStyle = extend({
  125. lineCap: 'round'
  126. }, axisModel.getModel('axisLine.lineStyle').getLineStyle());
  127. this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({
  128. // Id for animation
  129. anid: 'line',
  130. shape: {
  131. x1: pt1[0],
  132. y1: pt1[1],
  133. x2: pt2[0],
  134. y2: pt2[1]
  135. },
  136. style: lineStyle,
  137. strokeContainThreshold: opt.strokeContainThreshold || 5,
  138. silent: true,
  139. z2: 1
  140. })));
  141. var arrows = axisModel.get('axisLine.symbol');
  142. var arrowSize = axisModel.get('axisLine.symbolSize');
  143. if (arrows != null) {
  144. if (typeof arrows === 'string') {
  145. // Use the same arrow for start and end point
  146. arrows = [arrows, arrows];
  147. }
  148. if (typeof arrowSize === 'string' || typeof arrowSize === 'number') {
  149. // Use the same size for width and height
  150. arrowSize = [arrowSize, arrowSize];
  151. }
  152. var symbolWidth = arrowSize[0];
  153. var symbolHeight = arrowSize[1];
  154. each([[opt.rotation + Math.PI / 2, pt1], [opt.rotation - Math.PI / 2, pt2]], function (item, index) {
  155. if (arrows[index] !== 'none' && arrows[index] != null) {
  156. var symbol = createSymbol(arrows[index], -symbolWidth / 2, -symbolHeight / 2, symbolWidth, symbolHeight, lineStyle.stroke, true);
  157. symbol.attr({
  158. rotation: item[0],
  159. position: item[1],
  160. silent: true
  161. });
  162. this.group.add(symbol);
  163. }
  164. }, this);
  165. }
  166. },
  167. /**
  168. * @private
  169. */
  170. axisTickLabel: function () {
  171. var axisModel = this.axisModel;
  172. var opt = this.opt;
  173. var tickEls = buildAxisTick(this, axisModel, opt);
  174. var labelEls = buildAxisLabel(this, axisModel, opt);
  175. fixMinMaxLabelShow(axisModel, labelEls, tickEls);
  176. },
  177. /**
  178. * @private
  179. */
  180. axisName: function () {
  181. var opt = this.opt;
  182. var axisModel = this.axisModel;
  183. var name = retrieve(opt.axisName, axisModel.get('name'));
  184. if (!name) {
  185. return;
  186. }
  187. var nameLocation = axisModel.get('nameLocation');
  188. var nameDirection = opt.nameDirection;
  189. var textStyleModel = axisModel.getModel('nameTextStyle');
  190. var gap = axisModel.get('nameGap') || 0;
  191. var extent = this.axisModel.axis.getExtent();
  192. var gapSignal = extent[0] > extent[1] ? -1 : 1;
  193. var pos = [nameLocation === 'start' ? extent[0] - gapSignal * gap : nameLocation === 'end' ? extent[1] + gapSignal * gap : (extent[0] + extent[1]) / 2, // 'middle'
  194. // Reuse labelOffset.
  195. isNameLocationCenter(nameLocation) ? opt.labelOffset + nameDirection * gap : 0];
  196. var labelLayout;
  197. var nameRotation = axisModel.get('nameRotate');
  198. if (nameRotation != null) {
  199. nameRotation = nameRotation * PI / 180; // To radian.
  200. }
  201. var axisNameAvailableWidth;
  202. if (isNameLocationCenter(nameLocation)) {
  203. labelLayout = innerTextLayout(opt.rotation, nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis.
  204. nameDirection);
  205. } else {
  206. labelLayout = endTextLayout(opt, nameLocation, nameRotation || 0, extent);
  207. axisNameAvailableWidth = opt.axisNameAvailableWidth;
  208. if (axisNameAvailableWidth != null) {
  209. axisNameAvailableWidth = Math.abs(axisNameAvailableWidth / Math.sin(labelLayout.rotation));
  210. !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null);
  211. }
  212. }
  213. var textFont = textStyleModel.getFont();
  214. var truncateOpt = axisModel.get('nameTruncate', true) || {};
  215. var ellipsis = truncateOpt.ellipsis;
  216. var maxWidth = retrieve(opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth); // FIXME
  217. // truncate rich text? (consider performance)
  218. var truncatedText = ellipsis != null && maxWidth != null ? formatUtil.truncateText(name, maxWidth, textFont, ellipsis, {
  219. minChar: 2,
  220. placeholder: truncateOpt.placeholder
  221. }) : name;
  222. var tooltipOpt = axisModel.get('tooltip', true);
  223. var mainType = axisModel.mainType;
  224. var formatterParams = {
  225. componentType: mainType,
  226. name: name,
  227. $vars: ['name']
  228. };
  229. formatterParams[mainType + 'Index'] = axisModel.componentIndex;
  230. var textEl = new graphic.Text({
  231. // Id for animation
  232. anid: 'name',
  233. __fullText: name,
  234. __truncatedText: truncatedText,
  235. position: pos,
  236. rotation: labelLayout.rotation,
  237. silent: isSilent(axisModel),
  238. z2: 1,
  239. tooltip: tooltipOpt && tooltipOpt.show ? extend({
  240. content: name,
  241. formatter: function () {
  242. return name;
  243. },
  244. formatterParams: formatterParams
  245. }, tooltipOpt) : null
  246. });
  247. graphic.setTextStyle(textEl.style, textStyleModel, {
  248. text: truncatedText,
  249. textFont: textFont,
  250. textFill: textStyleModel.getTextColor() || axisModel.get('axisLine.lineStyle.color'),
  251. textAlign: labelLayout.textAlign,
  252. textVerticalAlign: labelLayout.textVerticalAlign
  253. });
  254. if (axisModel.get('triggerEvent')) {
  255. textEl.eventData = makeAxisEventDataBase(axisModel);
  256. textEl.eventData.targetType = 'axisName';
  257. textEl.eventData.name = name;
  258. } // FIXME
  259. this._dumbGroup.add(textEl);
  260. textEl.updateTransform();
  261. this.group.add(textEl);
  262. textEl.decomposeTransform();
  263. }
  264. };
  265. /**
  266. * @public
  267. * @static
  268. * @param {Object} opt
  269. * @param {number} axisRotation in radian
  270. * @param {number} textRotation in radian
  271. * @param {number} direction
  272. * @return {Object} {
  273. * rotation, // according to axis
  274. * textAlign,
  275. * textVerticalAlign
  276. * }
  277. */
  278. var innerTextLayout = AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) {
  279. var rotationDiff = remRadian(textRotation - axisRotation);
  280. var textAlign;
  281. var textVerticalAlign;
  282. if (isRadianAroundZero(rotationDiff)) {
  283. // Label is parallel with axis line.
  284. textVerticalAlign = direction > 0 ? 'top' : 'bottom';
  285. textAlign = 'center';
  286. } else if (isRadianAroundZero(rotationDiff - PI)) {
  287. // Label is inverse parallel with axis line.
  288. textVerticalAlign = direction > 0 ? 'bottom' : 'top';
  289. textAlign = 'center';
  290. } else {
  291. textVerticalAlign = 'middle';
  292. if (rotationDiff > 0 && rotationDiff < PI) {
  293. textAlign = direction > 0 ? 'right' : 'left';
  294. } else {
  295. textAlign = direction > 0 ? 'left' : 'right';
  296. }
  297. }
  298. return {
  299. rotation: rotationDiff,
  300. textAlign: textAlign,
  301. textVerticalAlign: textVerticalAlign
  302. };
  303. };
  304. function endTextLayout(opt, textPosition, textRotate, extent) {
  305. var rotationDiff = remRadian(textRotate - opt.rotation);
  306. var textAlign;
  307. var textVerticalAlign;
  308. var inverse = extent[0] > extent[1];
  309. var onLeft = textPosition === 'start' && !inverse || textPosition !== 'start' && inverse;
  310. if (isRadianAroundZero(rotationDiff - PI / 2)) {
  311. textVerticalAlign = onLeft ? 'bottom' : 'top';
  312. textAlign = 'center';
  313. } else if (isRadianAroundZero(rotationDiff - PI * 1.5)) {
  314. textVerticalAlign = onLeft ? 'top' : 'bottom';
  315. textAlign = 'center';
  316. } else {
  317. textVerticalAlign = 'middle';
  318. if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) {
  319. textAlign = onLeft ? 'left' : 'right';
  320. } else {
  321. textAlign = onLeft ? 'right' : 'left';
  322. }
  323. }
  324. return {
  325. rotation: rotationDiff,
  326. textAlign: textAlign,
  327. textVerticalAlign: textVerticalAlign
  328. };
  329. }
  330. function isSilent(axisModel) {
  331. var tooltipOpt = axisModel.get('tooltip');
  332. return axisModel.get('silent') // Consider mouse cursor, add these restrictions.
  333. || !(axisModel.get('triggerEvent') || tooltipOpt && tooltipOpt.show);
  334. }
  335. function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
  336. // If min or max are user set, we need to check
  337. // If the tick on min(max) are overlap on their neighbour tick
  338. // If they are overlapped, we need to hide the min(max) tick label
  339. var showMinLabel = axisModel.get('axisLabel.showMinLabel');
  340. var showMaxLabel = axisModel.get('axisLabel.showMaxLabel'); // FIXME
  341. // Have not consider onBand yet, where tick els is more than label els.
  342. labelEls = labelEls || [];
  343. tickEls = tickEls || [];
  344. var firstLabel = labelEls[0];
  345. var nextLabel = labelEls[1];
  346. var lastLabel = labelEls[labelEls.length - 1];
  347. var prevLabel = labelEls[labelEls.length - 2];
  348. var firstTick = tickEls[0];
  349. var nextTick = tickEls[1];
  350. var lastTick = tickEls[tickEls.length - 1];
  351. var prevTick = tickEls[tickEls.length - 2];
  352. if (showMinLabel === false) {
  353. ignoreEl(firstLabel);
  354. ignoreEl(firstTick);
  355. } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
  356. if (showMinLabel) {
  357. ignoreEl(nextLabel);
  358. ignoreEl(nextTick);
  359. } else {
  360. ignoreEl(firstLabel);
  361. ignoreEl(firstTick);
  362. }
  363. }
  364. if (showMaxLabel === false) {
  365. ignoreEl(lastLabel);
  366. ignoreEl(lastTick);
  367. } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
  368. if (showMaxLabel) {
  369. ignoreEl(prevLabel);
  370. ignoreEl(prevTick);
  371. } else {
  372. ignoreEl(lastLabel);
  373. ignoreEl(lastTick);
  374. }
  375. }
  376. }
  377. function ignoreEl(el) {
  378. el && (el.ignore = true);
  379. }
  380. function isTwoLabelOverlapped(current, next, labelLayout) {
  381. // current and next has the same rotation.
  382. var firstRect = current && current.getBoundingRect().clone();
  383. var nextRect = next && next.getBoundingRect().clone();
  384. if (!firstRect || !nextRect) {
  385. return;
  386. } // When checking intersect of two rotated labels, we use mRotationBack
  387. // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.
  388. var mRotationBack = matrixUtil.identity([]);
  389. matrixUtil.rotate(mRotationBack, mRotationBack, -current.rotation);
  390. firstRect.applyTransform(matrixUtil.mul([], mRotationBack, current.getLocalTransform()));
  391. nextRect.applyTransform(matrixUtil.mul([], mRotationBack, next.getLocalTransform()));
  392. return firstRect.intersect(nextRect);
  393. }
  394. function isNameLocationCenter(nameLocation) {
  395. return nameLocation === 'middle' || nameLocation === 'center';
  396. }
  397. /**
  398. * @static
  399. */
  400. var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval, ticksCnt, showMinLabel, showMaxLabel) {
  401. if (i === 0 && showMinLabel || i === ticksCnt - 1 && showMaxLabel) {
  402. return false;
  403. } // FIXME
  404. // Have not consider label overlap (if label is too long) yet.
  405. var rawTick;
  406. var scale = axis.scale;
  407. return scale.type === 'ordinal' && (typeof interval === 'function' ? (rawTick = scale.getTicks()[i], !interval(rawTick, scale.getLabel(rawTick))) : i % (interval + 1));
  408. };
  409. /**
  410. * @static
  411. */
  412. var getInterval = AxisBuilder.getInterval = function (model, labelInterval) {
  413. var interval = model.get('interval');
  414. if (interval == null || interval == 'auto') {
  415. interval = labelInterval;
  416. }
  417. return interval;
  418. };
  419. function buildAxisTick(axisBuilder, axisModel, opt) {
  420. var axis = axisModel.axis;
  421. if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) {
  422. return;
  423. }
  424. var tickModel = axisModel.getModel('axisTick');
  425. var lineStyleModel = tickModel.getModel('lineStyle');
  426. var tickLen = tickModel.get('length');
  427. var tickInterval = getInterval(tickModel, opt.labelInterval);
  428. var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel')); // FIXME
  429. // Corresponds to ticksCoords ?
  430. var ticks = axis.scale.getTicks();
  431. var showMinLabel = axisModel.get('axisLabel.showMinLabel');
  432. var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
  433. var pt1 = [];
  434. var pt2 = [];
  435. var matrix = axisBuilder._transform;
  436. var tickEls = [];
  437. var ticksCnt = ticksCoords.length;
  438. for (var i = 0; i < ticksCnt; i++) {
  439. // Only ordinal scale support tick interval
  440. if (ifIgnoreOnTick(axis, i, tickInterval, ticksCnt, showMinLabel, showMaxLabel)) {
  441. continue;
  442. }
  443. var tickCoord = ticksCoords[i];
  444. pt1[0] = tickCoord;
  445. pt1[1] = 0;
  446. pt2[0] = tickCoord;
  447. pt2[1] = opt.tickDirection * tickLen;
  448. if (matrix) {
  449. v2ApplyTransform(pt1, pt1, matrix);
  450. v2ApplyTransform(pt2, pt2, matrix);
  451. } // Tick line, Not use group transform to have better line draw
  452. var tickEl = new graphic.Line(graphic.subPixelOptimizeLine({
  453. // Id for animation
  454. anid: 'tick_' + ticks[i],
  455. shape: {
  456. x1: pt1[0],
  457. y1: pt1[1],
  458. x2: pt2[0],
  459. y2: pt2[1]
  460. },
  461. style: defaults(lineStyleModel.getLineStyle(), {
  462. stroke: axisModel.get('axisLine.lineStyle.color')
  463. }),
  464. z2: 2,
  465. silent: true
  466. }));
  467. axisBuilder.group.add(tickEl);
  468. tickEls.push(tickEl);
  469. }
  470. return tickEls;
  471. }
  472. function buildAxisLabel(axisBuilder, axisModel, opt) {
  473. var axis = axisModel.axis;
  474. var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show'));
  475. if (!show || axis.scale.isBlank()) {
  476. return;
  477. }
  478. var labelModel = axisModel.getModel('axisLabel');
  479. var labelMargin = labelModel.get('margin');
  480. var ticks = axis.scale.getTicks();
  481. var labels = axisModel.getFormattedLabels(); // Special label rotate.
  482. var labelRotation = (retrieve(opt.labelRotate, labelModel.get('rotate')) || 0) * PI / 180;
  483. var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);
  484. var categoryData = axisModel.get('data');
  485. var labelEls = [];
  486. var silent = isSilent(axisModel);
  487. var triggerEvent = axisModel.get('triggerEvent');
  488. var showMinLabel = axisModel.get('axisLabel.showMinLabel');
  489. var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
  490. each(ticks, function (tickVal, index) {
  491. if (ifIgnoreOnTick(axis, index, opt.labelInterval, ticks.length, showMinLabel, showMaxLabel)) {
  492. return;
  493. }
  494. var itemLabelModel = labelModel;
  495. if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) {
  496. itemLabelModel = new Model(categoryData[tickVal].textStyle, labelModel, axisModel.ecModel);
  497. }
  498. var textColor = itemLabelModel.getTextColor() || axisModel.get('axisLine.lineStyle.color');
  499. var tickCoord = axis.dataToCoord(tickVal);
  500. var pos = [tickCoord, opt.labelOffset + opt.labelDirection * labelMargin];
  501. var labelStr = axis.scale.getLabel(tickVal);
  502. var textEl = new graphic.Text({
  503. // Id for animation
  504. anid: 'label_' + tickVal,
  505. position: pos,
  506. rotation: labelLayout.rotation,
  507. silent: silent,
  508. z2: 10
  509. });
  510. graphic.setTextStyle(textEl.style, itemLabelModel, {
  511. text: labels[index],
  512. textAlign: itemLabelModel.getShallow('align', true) || labelLayout.textAlign,
  513. textVerticalAlign: itemLabelModel.getShallow('verticalAlign', true) || itemLabelModel.getShallow('baseline', true) || labelLayout.textVerticalAlign,
  514. textFill: typeof textColor === 'function' ? textColor( // (1) In category axis with data zoom, tick is not the original
  515. // index of axis.data. So tick should not be exposed to user
  516. // in category axis.
  517. // (2) Compatible with previous version, which always returns labelStr.
  518. // But in interval scale labelStr is like '223,445', which maked
  519. // user repalce ','. So we modify it to return original val but remain
  520. // it as 'string' to avoid error in replacing.
  521. axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal, index) : textColor
  522. }); // Pack data for mouse event
  523. if (triggerEvent) {
  524. textEl.eventData = makeAxisEventDataBase(axisModel);
  525. textEl.eventData.targetType = 'axisLabel';
  526. textEl.eventData.value = labelStr;
  527. } // FIXME
  528. axisBuilder._dumbGroup.add(textEl);
  529. textEl.updateTransform();
  530. labelEls.push(textEl);
  531. axisBuilder.group.add(textEl);
  532. textEl.decomposeTransform();
  533. });
  534. return labelEls;
  535. }
  536. var _default = AxisBuilder;
  537. module.exports = _default;