框架源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
22 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 585);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 124:
  90. /***/ (function(module, exports) {
  91. module.exports = require("echarts");
  92. /***/ }),
  93. /***/ 585:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. // ESM COMPAT FLAG
  97. __webpack_require__.r(__webpack_exports__);
  98. // EXTERNAL MODULE: external "echarts"
  99. var external_echarts_ = __webpack_require__(124);
  100. var external_echarts_default = /*#__PURE__*/__webpack_require__.n(external_echarts_);
  101. // CONCATENATED MODULE: ./packages/c-gantt/main.js
  102. // import _rawData from './raw-data.json';
  103. // let ROOT_PATH = 'https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples';
  104. var HEIGHT_RATIO = 0.5;
  105. var DIM_CATEGORY_INDEX = 0;
  106. var DIM_TIME_ARRIVAL = 1;
  107. var DIM_TIME_DEPARTURE = 2;
  108. var DATA_ZOOM_AUTO_MOVE_THROTTLE = 30;
  109. var DATA_ZOOM_X_INSIDE_INDEX = 1;
  110. var DATA_ZOOM_Y_INSIDE_INDEX = 3;
  111. var DATA_ZOOM_AUTO_MOVE_SPEED = 0.2;
  112. var DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH = 30;
  113. var _draggable = void 0;
  114. var _draggingEl = void 0;
  115. var _dropShadow = void 0;
  116. var _draggingCursorOffset = [0, 0];
  117. var _draggingTimeLength = void 0;
  118. var _draggingRecord = void 0;
  119. var _dropRecord = void 0;
  120. var _cartesianXBounds = [];
  121. var _cartesianYBounds = [];
  122. // let _rawData;
  123. var _autoDataZoomAnimator = void 0;
  124. // $.get(ROOT_PATH + '/data/asset/data/airport-schedule.json', function (rawData) {
  125. // _rawData = rawData;
  126. // this.myChart.setOption(option = makeOption());
  127. // initDrag();
  128. // });
  129. // _rawData = rawData;
  130. /* harmony default export */ var main = ({
  131. name: 've-gantt',
  132. props: {
  133. width: { type: String, default: '100%' },
  134. height: { type: String, default: '100%' },
  135. options: { type: Object, default: null },
  136. data: { type: Object, default: null }
  137. },
  138. data: function data() {
  139. return {
  140. myChart: null
  141. };
  142. },
  143. mounted: function mounted() {
  144. // let chartDom = document.getElementById('main');
  145. this._rawData = this.data;
  146. this.myChart = external_echarts_default.a.init(this.$refs.ganttContainer);
  147. var option = void 0;
  148. this.myChart.setOption(option = this.makeOption());
  149. this.initDrag();
  150. option && this.myChart.setOption(option);
  151. },
  152. methods: {
  153. initDrag: function initDrag() {
  154. var _this = this;
  155. _autoDataZoomAnimator = makeAnimator(dispatchDataZoom);
  156. this.myChart.on('mousedown', function (param) {
  157. if (!_draggable || !param || param.seriesIndex == null) {
  158. return;
  159. }
  160. // Drag start
  161. _draggingRecord = {
  162. dataIndex: param.dataIndex,
  163. categoryIndex: param.value[DIM_CATEGORY_INDEX],
  164. timeArrival: param.value[DIM_TIME_ARRIVAL],
  165. timeDeparture: param.value[DIM_TIME_DEPARTURE]
  166. };
  167. var style = { lineWidth: 2, fill: 'rgba(255,0,0,0.1)', stroke: 'rgba(255,0,0,0.8)', lineDash: [6, 3] };
  168. _draggingEl = addOrUpdateBar(_draggingEl, _draggingRecord, style, 100);
  169. _draggingCursorOffset = [_draggingEl.position[0] - param.event.offsetX, _draggingEl.position[1] - param.event.offsetY];
  170. _draggingTimeLength = _draggingRecord.timeDeparture - _draggingRecord.timeArrival;
  171. });
  172. this.myChart.getZr().on('mousemove', function (event) {
  173. if (!_draggingEl) {
  174. return;
  175. }
  176. var cursorX = event.offsetX;
  177. var cursorY = event.offsetY;
  178. // Move _draggingEl.
  179. _draggingEl.attr('position', [_draggingCursorOffset[0] + cursorX, _draggingCursorOffset[1] + cursorY]);
  180. prepareDrop();
  181. autoDataZoomWhenDraggingOutside(cursorX, cursorY);
  182. });
  183. this.myChart.getZr().on('mouseup', function () {
  184. // Drop
  185. if (_draggingEl && _dropRecord) {
  186. updateRawData() && _this.myChart.setOption({
  187. series: {
  188. id: 'flightData',
  189. data: _this._rawData.items.data
  190. }
  191. });
  192. }
  193. dragRelease();
  194. });
  195. this.myChart.getZr().on('globalout', dragRelease);
  196. function dragRelease() {
  197. _autoDataZoomAnimator.stop();
  198. if (_draggingEl) {
  199. this.myChart.getZr().remove(_draggingEl);
  200. _draggingEl = null;
  201. }
  202. if (_dropShadow) {
  203. this.myChart.getZr().remove(_dropShadow);
  204. _dropShadow = null;
  205. }
  206. _dropRecord = _draggingRecord = null;
  207. }
  208. function addOrUpdateBar(el, itemData, style, z) {
  209. var pointArrival = this.myChart.convertToPixel('grid', [itemData.timeArrival, itemData.categoryIndex]);
  210. var pointDeparture = this.myChart.convertToPixel('grid', [itemData.timeDeparture, itemData.categoryIndex]);
  211. var barLength = pointDeparture[0] - pointArrival[0];
  212. var barHeight = Math.abs(this.myChart.convertToPixel('grid', [0, 0])[1] - this.myChart.convertToPixel('grid', [0, 1])[1]) * HEIGHT_RATIO;
  213. if (!el) {
  214. el = new external_echarts_default.a.graphic.Rect({
  215. shape: { x: 0, y: 0, width: 0, height: 0 },
  216. style: style,
  217. z: z
  218. });
  219. this.myChart.getZr().add(el);
  220. }
  221. el.attr({
  222. shape: { x: 0, y: 0, width: barLength, height: barHeight },
  223. position: [pointArrival[0], pointArrival[1] - barHeight]
  224. });
  225. return el;
  226. }
  227. function prepareDrop() {
  228. // Check droppable place.
  229. var xPixel = _draggingEl.shape.x + _draggingEl.position[0];
  230. var yPixel = _draggingEl.shape.y + _draggingEl.position[1];
  231. var cursorData = this.myChart.convertFromPixel('grid', [xPixel, yPixel]);
  232. if (cursorData) {
  233. // Make drop shadow and _dropRecord
  234. _dropRecord = {
  235. categoryIndex: Math.floor(cursorData[1]),
  236. timeArrival: cursorData[0],
  237. timeDeparture: cursorData[0] + _draggingTimeLength
  238. };
  239. var style = { fill: 'rgba(0,0,0,0.4)' };
  240. _dropShadow = addOrUpdateBar(_dropShadow, _dropRecord, style, 99);
  241. }
  242. }
  243. // This is some business logic, don't care about it.
  244. function updateRawData() {
  245. var flightData = this._rawData.items.data;
  246. var movingItem = flightData[_draggingRecord.dataIndex];
  247. // Check conflict
  248. for (var i = 0; i < flightData.length; i++) {
  249. var dataItem = flightData[i];
  250. if (dataItem !== movingItem && _dropRecord.categoryIndex === dataItem[DIM_CATEGORY_INDEX] && _dropRecord.timeArrival < dataItem[DIM_TIME_DEPARTURE] && _dropRecord.timeDeparture > dataItem[DIM_TIME_ARRIVAL]) {
  251. alert('Conflict! Find a free space to settle the bar!');
  252. return;
  253. }
  254. }
  255. // No conflict.
  256. movingItem[DIM_CATEGORY_INDEX] = _dropRecord.categoryIndex;
  257. movingItem[DIM_TIME_ARRIVAL] = _dropRecord.timeArrival;
  258. movingItem[DIM_TIME_DEPARTURE] = _dropRecord.timeDeparture;
  259. return true;
  260. }
  261. function autoDataZoomWhenDraggingOutside(cursorX, cursorY) {
  262. // When cursor is outside the cartesian and being dragging,
  263. // auto move the dataZooms.
  264. var cursorDistX = getCursorCartesianDist(cursorX, _cartesianXBounds);
  265. var cursorDistY = getCursorCartesianDist(cursorY, _cartesianYBounds);
  266. if (cursorDistX !== 0 || cursorDistY !== 0) {
  267. _autoDataZoomAnimator.start({
  268. cursorDistX: cursorDistX,
  269. cursorDistY: cursorDistY
  270. });
  271. } else {
  272. _autoDataZoomAnimator.stop();
  273. }
  274. }
  275. function dispatchDataZoom(params) {
  276. var option = this.myChart.getOption();
  277. var optionInsideX = option.dataZoom[DATA_ZOOM_X_INSIDE_INDEX];
  278. var optionInsideY = option.dataZoom[DATA_ZOOM_Y_INSIDE_INDEX];
  279. var batch = [];
  280. prepareBatch(batch, 'insideX', optionInsideX.start, optionInsideX.end, params.cursorDistX);
  281. prepareBatch(batch, 'insideY', optionInsideY.start, optionInsideY.end, -params.cursorDistY);
  282. batch.length && this.myChart.dispatchAction({
  283. type: 'dataZoom',
  284. batch: batch
  285. });
  286. function prepareBatch(batch, id, start, end, cursorDist) {
  287. if (cursorDist === 0) {
  288. return;
  289. }
  290. var sign = cursorDist / Math.abs(cursorDist);
  291. var size = end - start;
  292. var delta = DATA_ZOOM_AUTO_MOVE_SPEED * sign;
  293. start += delta;
  294. end += delta;
  295. if (end > 100) {
  296. end = 100;
  297. start = end - size;
  298. }
  299. if (start < 0) {
  300. start = 0;
  301. end = start + size;
  302. }
  303. batch.push({
  304. dataZoomId: id,
  305. start: start,
  306. end: end
  307. });
  308. }
  309. }
  310. function getCursorCartesianDist(cursorXY, bounds) {
  311. var dist0 = cursorXY - (bounds[0] + DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH);
  312. var dist1 = cursorXY - (bounds[1] - DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH);
  313. return dist0 * dist1 <= 0 ? 0 // cursor is in cartesian
  314. : dist0 < 0 ? dist0 // cursor is at left/top of cartesian
  315. : dist1; // cursor is at right/bottom of cartesian
  316. }
  317. function makeAnimator(callback) {
  318. var requestId = void 0;
  319. var callbackParams = void 0;
  320. // Use throttle to prevent from calling dispatchAction frequently.
  321. callback = external_echarts_default.a.throttle(callback, DATA_ZOOM_AUTO_MOVE_THROTTLE);
  322. function onFrame() {
  323. callback(callbackParams);
  324. requestId = requestAnimationFrame(onFrame);
  325. }
  326. return {
  327. start: function start(params) {
  328. callbackParams = params;
  329. if (requestId == null) {
  330. onFrame();
  331. }
  332. },
  333. stop: function stop() {
  334. if (requestId != null) {
  335. cancelAnimationFrame(requestId);
  336. }
  337. requestId = callbackParams = null;
  338. }
  339. };
  340. }
  341. },
  342. onDragSwitchClick: function onDragSwitchClick(model, api, type) {
  343. _draggable = !_draggable;
  344. this.myChart.setOption({
  345. dataZoom: [{
  346. id: 'insideX',
  347. disabled: _draggable
  348. }, {
  349. id: 'insideY',
  350. disabled: _draggable
  351. }]
  352. });
  353. this.model.setIconStatus(type, _draggable ? 'emphasis' : 'normal');
  354. },
  355. clipRectByRect: function clipRectByRect(params, rect) {
  356. return external_echarts_default.a.graphic.clipRectByRect(rect, {
  357. x: params.coordSys.x,
  358. y: params.coordSys.y,
  359. width: params.coordSys.width,
  360. height: params.coordSys.height
  361. });
  362. },
  363. renderAxisLabelItem: function renderAxisLabelItem(params, api) {
  364. var y = api.coord([0, api.value(0)])[1];
  365. if (y < params.coordSys.y + 5) {
  366. return;
  367. }
  368. return {
  369. type: 'group',
  370. position: [10, y],
  371. children: [{
  372. type: 'path',
  373. shape: {
  374. d: 'M0,0 L0,-20 L30,-20 C42,-20 38,-1 50,-1 L70,-1 L70,0 Z',
  375. x: 0,
  376. y: -20,
  377. width: 90,
  378. height: 20,
  379. layout: 'cover'
  380. },
  381. style: {
  382. fill: '#368c6c'
  383. }
  384. }, {
  385. type: 'text',
  386. style: {
  387. x: 24,
  388. y: -3,
  389. text: api.value(1),
  390. textVerticalAlign: 'bottom',
  391. textAlign: 'center',
  392. textFill: '#fff'
  393. }
  394. }, {
  395. type: 'text',
  396. style: {
  397. x: 75,
  398. y: -2,
  399. textVerticalAlign: 'bottom',
  400. textAlign: 'center',
  401. text: api.value(2),
  402. textFill: '#FFF'
  403. }
  404. }]
  405. };
  406. },
  407. renderGanttItem: function renderGanttItem(params, api) {
  408. // console.log('renderGanttItem:', params);
  409. // console.log('api:', api);
  410. var categoryIndex = api.value(DIM_CATEGORY_INDEX);
  411. var timeArrival = api.coord([api.value(DIM_TIME_ARRIVAL), categoryIndex]);
  412. var timeDeparture = api.coord([api.value(DIM_TIME_DEPARTURE), categoryIndex]);
  413. var coordSys = params.coordSys;
  414. _cartesianXBounds[0] = coordSys.x;
  415. _cartesianXBounds[1] = coordSys.x + coordSys.width;
  416. _cartesianYBounds[0] = coordSys.y;
  417. _cartesianYBounds[1] = coordSys.y + coordSys.height;
  418. var barLength = timeDeparture[0] - timeArrival[0];
  419. // Get the heigth corresponds to length 1 on y axis.
  420. var barHeight = api.size([0, 1])[1] * HEIGHT_RATIO;
  421. console.log('barLength:', barLength);
  422. console.log('barHeight:', barHeight);
  423. var x = timeArrival[0];
  424. var y = timeArrival[1] - barHeight;
  425. var flightNumber = api.value(3) + '';
  426. var flightNumberWidth = external_echarts_default.a.format.getTextRect(flightNumber).width;
  427. var text = barLength > flightNumberWidth + 40 && x + barLength >= 180 ? flightNumber : '';
  428. var rectNormal = this.clipRectByRect(params, {
  429. x: x, y: y, width: barLength, height: barHeight
  430. });
  431. var rectVIP = this.clipRectByRect(params, {
  432. x: x, y: y, width: barLength / 2, height: barHeight
  433. });
  434. var rectText = this.clipRectByRect(params, {
  435. x: x, y: y, width: barLength, height: barHeight
  436. });
  437. return {
  438. type: 'group',
  439. children: [{
  440. type: 'rect',
  441. ignore: !rectNormal,
  442. shape: rectNormal,
  443. style: api.style()
  444. }, {
  445. type: 'rect',
  446. ignore: !rectVIP && !api.value(4),
  447. shape: rectVIP,
  448. style: api.style({ fill: '#ddb30b' })
  449. }, {
  450. type: 'rect',
  451. ignore: !rectText,
  452. shape: rectText,
  453. style: api.style({
  454. fill: 'transparent',
  455. stroke: 'transparent',
  456. text: text,
  457. textFill: '#fff'
  458. })
  459. }]
  460. };
  461. },
  462. makeOption: function makeOption() {
  463. console.log('itemes length:', this._rawData.items.data.length);
  464. return {
  465. tooltip: {},
  466. animation: false,
  467. toolbox: {
  468. left: 20,
  469. top: 0,
  470. itemSize: 20,
  471. feature: {
  472. myDrag: {
  473. show: true,
  474. title: 'Make bars\ndraggable',
  475. icon: 'path://M990.55 380.08 q11.69 0 19.88 8.19 q7.02 7.01 7.02 18.71 l0 480.65 q-1.17 43.27 -29.83 71.93 q-28.65 28.65 -71.92 29.82 l-813.96 0 q-43.27 -1.17 -72.5 -30.41 q-28.07 -28.07 -29.24 -71.34 l0 -785.89 q1.17 -43.27 29.24 -72.5 q29.23 -29.24 72.5 -29.24 l522.76 0 q11.7 0 18.71 7.02 q8.19 8.18 8.19 18.71 q0 11.69 -7.6 19.29 q-7.6 7.61 -19.3 7.61 l-518.08 0 q-22.22 1.17 -37.42 16.37 q-15.2 15.2 -15.2 37.42 l0 775.37 q0 23.39 15.2 38.59 q15.2 15.2 37.42 15.2 l804.6 0 q22.22 0 37.43 -15.2 q15.2 -15.2 16.37 -38.59 l0 -474.81 q0 -11.7 7.02 -18.71 q8.18 -8.19 18.71 -8.19 l0 0 ZM493.52 723.91 l-170.74 -170.75 l509.89 -509.89 q23.39 -23.39 56.13 -21.05 q32.75 1.17 59.65 26.9 l47.94 47.95 q25.73 26.89 27.49 59.64 q1.75 32.75 -21.64 57.3 l-508.72 509.9 l0 0 ZM870.09 80.69 l-56.13 56.14 l94.72 95.9 l56.14 -57.31 q8.19 -9.35 8.19 -21.05 q-1.17 -12.86 -10.53 -22.22 l-47.95 -49.12 q-10.52 -9.35 -23.39 -9.35 q-11.69 -1.17 -21.05 7.01 l0 0 ZM867.75 272.49 l-93.56 -95.9 l-380.08 380.08 l94.73 94.73 l378.91 -378.91 l0 0 ZM322.78 553.16 l38.59 39.77 l-33.92 125.13 l125.14 -33.92 l38.59 38.6 l-191.79 52.62 q-5.85 1.17 -12.28 0 q-6.44 -1.17 -11.11 -5.84 q-4.68 -4.68 -5.85 -11.7 q-2.34 -5.85 0 -11.69 l52.63 -192.97 l0 0 Z',
  476. onclick: this.onDragSwitchClick
  477. }
  478. }
  479. },
  480. title: {
  481. text: '甘特图示例',
  482. left: 'center'
  483. },
  484. dataZoom: [{
  485. type: 'slider',
  486. xAxisIndex: 0,
  487. filterMode: 'weakFilter',
  488. height: 20,
  489. bottom: 0,
  490. start: 0,
  491. end: 26,
  492. handleIcon: 'path://M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
  493. handleSize: '80%',
  494. showDetail: false
  495. }, {
  496. type: 'inside',
  497. id: 'insideX',
  498. xAxisIndex: 0,
  499. filterMode: 'weakFilter',
  500. start: 0,
  501. end: 26,
  502. zoomOnMouseWheel: false,
  503. moveOnMouseMove: true
  504. }, {
  505. type: 'slider',
  506. yAxisIndex: 0,
  507. zoomLock: true,
  508. width: 10,
  509. right: 10,
  510. top: 70,
  511. bottom: 20,
  512. start: 95,
  513. end: 100,
  514. handleSize: 0,
  515. showDetail: false
  516. }, {
  517. type: 'inside',
  518. id: 'insideY',
  519. yAxisIndex: 0,
  520. start: 95,
  521. end: 100,
  522. zoomOnMouseWheel: false,
  523. moveOnMouseMove: true,
  524. moveOnMouseWheel: true
  525. }],
  526. grid: {
  527. show: true,
  528. top: 70,
  529. bottom: 20,
  530. left: 100,
  531. right: 20,
  532. backgroundColor: '#fff',
  533. borderWidth: 0
  534. },
  535. xAxis: {
  536. type: 'time',
  537. position: 'top',
  538. splitLine: {
  539. lineStyle: {
  540. color: ['#E9EDFF']
  541. }
  542. },
  543. axisLine: {
  544. show: false
  545. },
  546. axisTick: {
  547. lineStyle: {
  548. color: '#929ABA'
  549. }
  550. },
  551. axisLabel: {
  552. color: '#929ABA',
  553. inside: false,
  554. align: 'center'
  555. }
  556. },
  557. yAxis: {
  558. axisTick: { show: false },
  559. splitLine: { show: false },
  560. axisLine: { show: false },
  561. axisLabel: { show: false },
  562. min: 0,
  563. max: this._rawData.labels.data.length
  564. },
  565. series: [{
  566. id: 'flightData',
  567. type: 'custom',
  568. renderItem: this.renderGanttItem,
  569. dimensions: this._rawData.items.dimensions,
  570. encode: {
  571. x: [DIM_TIME_ARRIVAL, DIM_TIME_DEPARTURE],
  572. y: DIM_CATEGORY_INDEX,
  573. tooltip: [DIM_CATEGORY_INDEX, DIM_TIME_ARRIVAL, DIM_TIME_DEPARTURE]
  574. },
  575. data: this._rawData.items.data
  576. }, {
  577. type: 'custom',
  578. renderItem: this.renderAxisLabelItem,
  579. dimensions: this._rawData.labels.dimensions,
  580. encode: {
  581. x: -1, // Then this series will not controlled by x.
  582. y: 0
  583. },
  584. data: this._rawData.labels.data.map(function (item, index) {
  585. console.log('[index].concat(item);', [index].concat(item));
  586. return [index].concat(item);
  587. })
  588. }]
  589. };
  590. }
  591. },
  592. render: function render() {
  593. var h = arguments[0];
  594. return h(
  595. 'div',
  596. {
  597. attrs: { className: 'c-gantt-wrapper' },
  598. style: { width: this.width, height: this.height } },
  599. [h('div', {
  600. attrs: { className: 'c-gantt-container' },
  601. ref: 'ganttContainer', style: { width: this.width, height: this.height } })]
  602. );
  603. }
  604. });
  605. // CONCATENATED MODULE: ./packages/c-gantt/index.js
  606. /* harmony default export */ var c_gantt = __webpack_exports__["default"] = (main);
  607. /***/ })
  608. /******/ });