completeDimensions.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. describe('completeDimensions', function () {
  2. var utHelper = window.utHelper;
  3. var testCase = utHelper.prepare(['echarts/src/data/helper/completeDimensions']);
  4. function doCompleteDimensions(completeDimensions, sysDims, data, opt) {
  5. var result = completeDimensions(sysDims, data, opt);
  6. if (result) {
  7. for (var i = 0; i < result.length; i++) {
  8. var item = result[i];
  9. if (item && item.hasOwnProperty('dimsDef') && item.dimsDef == null) {
  10. delete item.dimsDef;
  11. }
  12. }
  13. }
  14. return result;
  15. }
  16. testCase('differentData', function (completeDimensions) {
  17. function doTest(sysDims, data, opt, result) {
  18. expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
  19. }
  20. // test dimcount
  21. doTest(['x', 'y'], [], null, [
  22. {
  23. 'otherDims': {},
  24. 'coordDim': 'x',
  25. 'coordDimIndex': 0,
  26. 'name': 'x'
  27. },
  28. {
  29. 'otherDims': {},
  30. 'coordDim': 'y',
  31. 'coordDimIndex': 0,
  32. 'name': 'y'
  33. }
  34. ]);
  35. doTest(['x', 'y'], [12], null, [
  36. {
  37. 'otherDims': {},
  38. 'coordDim': 'x',
  39. 'coordDimIndex': 0,
  40. 'name': 'x'
  41. },
  42. {
  43. 'otherDims': {},
  44. 'coordDim': 'y',
  45. 'coordDimIndex': 0,
  46. 'name': 'y'
  47. }
  48. ]);
  49. doTest(['x', 'y'], [12, 4], null, [
  50. {
  51. 'otherDims': {},
  52. 'coordDim': 'x',
  53. 'coordDimIndex': 0,
  54. 'name': 'x'
  55. },
  56. {
  57. 'otherDims': {},
  58. 'coordDim': 'y',
  59. 'coordDimIndex': 0,
  60. 'name': 'y'
  61. }
  62. ]);
  63. doTest(['x'], [[32, 55]], null, [
  64. {
  65. 'otherDims': {},
  66. 'coordDim': 'x',
  67. 'coordDimIndex': 0,
  68. 'name': 'x'
  69. },
  70. {
  71. 'otherDims': {},
  72. 'coordDim': 'value',
  73. 'coordDimIndex': 0,
  74. 'isExtraCoord': true,
  75. 'name': 'value'
  76. }
  77. ]);
  78. doTest(['x', 'y', 'z'], [[32, 55]], null, [
  79. {
  80. 'otherDims': {},
  81. 'coordDim': 'x',
  82. 'coordDimIndex': 0,
  83. 'name': 'x'
  84. },
  85. {
  86. 'otherDims': {},
  87. 'coordDim': 'y',
  88. 'coordDimIndex': 0,
  89. 'name': 'y'
  90. },
  91. {
  92. 'otherDims': {},
  93. 'coordDim': 'z',
  94. 'coordDimIndex': 0,
  95. 'name': 'z'
  96. }
  97. ]);
  98. doTest(['x'], [[32, 55], [99, 11]], null, [
  99. {
  100. 'otherDims': {},
  101. 'coordDim': 'x',
  102. 'coordDimIndex': 0,
  103. 'name': 'x'
  104. },
  105. {
  106. 'otherDims': {},
  107. 'coordDim': 'value',
  108. 'coordDimIndex': 0,
  109. 'isExtraCoord': true,
  110. 'name': 'value'
  111. }
  112. ]);
  113. doTest(['x', 'y'], [[32, 55], [99, 11]], {dimCount: 4}, [
  114. {
  115. 'otherDims': {},
  116. 'coordDim': 'x',
  117. 'coordDimIndex': 0,
  118. 'name': 'x'
  119. },
  120. {
  121. 'otherDims': {},
  122. 'coordDim': 'y',
  123. 'coordDimIndex': 0,
  124. 'name': 'y'
  125. },
  126. {
  127. 'otherDims': {},
  128. 'coordDim': 'value',
  129. 'coordDimIndex': 0,
  130. 'isExtraCoord': true,
  131. 'name': 'value'
  132. },
  133. {
  134. 'otherDims': {},
  135. 'coordDim': 'value0',
  136. 'coordDimIndex': 0,
  137. 'isExtraCoord': true,
  138. 'name': 'value0'
  139. }
  140. ]);
  141. });
  142. testCase('differentSysDims', function (completeDimensions) {
  143. function doTest(sysDims, data, opt, result) {
  144. expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
  145. }
  146. var data = [
  147. ['iw', 332, 4434, 323, 59],
  148. ['vrr', 44, 11, 144, 55]
  149. ];
  150. doTest(
  151. ['x', 'y'], data, null,
  152. [
  153. {
  154. 'otherDims': {},
  155. 'coordDim': 'x',
  156. 'coordDimIndex': 0,
  157. 'name': 'x',
  158. 'type': 'ordinal'
  159. },
  160. {
  161. 'otherDims': {},
  162. 'coordDim': 'y',
  163. 'coordDimIndex': 0,
  164. 'name': 'y'
  165. },
  166. {
  167. 'otherDims': {},
  168. 'coordDim': 'value',
  169. 'coordDimIndex': 0,
  170. 'isExtraCoord': true,
  171. 'name': 'value'
  172. },
  173. {
  174. 'otherDims': {},
  175. 'coordDim': 'value0',
  176. 'coordDimIndex': 0,
  177. 'isExtraCoord': true,
  178. 'name': 'value0'
  179. },
  180. {
  181. 'otherDims': {},
  182. 'coordDim': 'value1',
  183. 'coordDimIndex': 0,
  184. 'isExtraCoord': true,
  185. 'name': 'value1'
  186. }
  187. ]
  188. );
  189. doTest(
  190. ['value'], data, null,
  191. [
  192. {
  193. 'otherDims': {},
  194. 'coordDim': 'value',
  195. 'coordDimIndex': 0,
  196. 'name': 'value',
  197. 'type': 'ordinal'
  198. },
  199. {
  200. 'otherDims': {},
  201. 'coordDim': 'value0',
  202. 'coordDimIndex': 0,
  203. 'isExtraCoord': true,
  204. 'name': 'value0'
  205. },
  206. {
  207. 'otherDims': {},
  208. 'coordDim': 'value1',
  209. 'coordDimIndex': 0,
  210. 'isExtraCoord': true,
  211. 'name': 'value1'
  212. },
  213. {
  214. 'otherDims': {},
  215. 'coordDim': 'value2',
  216. 'coordDimIndex': 0,
  217. 'isExtraCoord': true,
  218. 'name': 'value2'
  219. },
  220. {
  221. 'otherDims': {},
  222. 'coordDim': 'value3',
  223. 'coordDimIndex': 0,
  224. 'isExtraCoord': true,
  225. 'name': 'value3'
  226. }
  227. ]
  228. );
  229. doTest(
  230. [{name: 'time', type: 'time', stackable: false}, 'value'], data, null,
  231. [
  232. {
  233. 'otherDims': {},
  234. 'name': 'time',
  235. 'type': 'time',
  236. 'stackable': false,
  237. 'coordDimIndex': 0,
  238. 'coordDim': 'time'
  239. },
  240. {
  241. 'otherDims': {},
  242. 'coordDim': 'value',
  243. 'coordDimIndex': 0,
  244. 'name': 'value'
  245. },
  246. {
  247. 'otherDims': {},
  248. 'coordDim': 'value0',
  249. 'coordDimIndex': 0,
  250. 'isExtraCoord': true,
  251. 'name': 'value0'
  252. },
  253. {
  254. 'otherDims': {},
  255. 'coordDim': 'value1',
  256. 'coordDimIndex': 0,
  257. 'isExtraCoord': true,
  258. 'name': 'value1'
  259. },
  260. {
  261. 'otherDims': {},
  262. 'coordDim': 'value2',
  263. 'coordDimIndex': 0,
  264. 'isExtraCoord': true,
  265. 'name': 'value2'
  266. }
  267. ]
  268. );
  269. doTest(
  270. [{
  271. name: 'y',
  272. otherDims: {
  273. tooltip: false
  274. },
  275. dimsDef: ['base']
  276. }, {
  277. name: 'x',
  278. dimsDef: ['open', 'close']
  279. }], data, {},
  280. [
  281. {
  282. 'otherDims': {
  283. 'tooltip': false
  284. },
  285. 'name': 'base',
  286. 'tooltipName': 'base',
  287. 'coordDimIndex': 0,
  288. 'coordDim': 'y',
  289. 'type': 'ordinal'
  290. },
  291. {
  292. 'otherDims': {},
  293. 'name': 'open',
  294. 'tooltipName': 'open',
  295. 'coordDimIndex': 0,
  296. 'coordDim': 'x'
  297. },
  298. {
  299. 'otherDims': {},
  300. 'name': 'close',
  301. 'tooltipName': 'close',
  302. 'coordDimIndex': 1,
  303. 'coordDim': 'x'
  304. },
  305. {
  306. 'otherDims': {},
  307. 'coordDim': 'value',
  308. 'coordDimIndex': 0,
  309. 'isExtraCoord': true,
  310. 'name': 'value'
  311. },
  312. {
  313. 'otherDims': {},
  314. 'coordDim': 'value0',
  315. 'coordDimIndex': 0,
  316. 'isExtraCoord': true,
  317. 'name': 'value0'
  318. }
  319. ]
  320. );
  321. doTest(
  322. [{
  323. name: 'y',
  324. otherDims: {
  325. tooltip: false
  326. },
  327. dimsDef: ['base']
  328. }, {
  329. name: 'x',
  330. dimsDef: ['open', 'close']
  331. }], data, {
  332. dimsDef: ['基础', '打开', '关闭'],
  333. encodeDef: {
  334. tooltip: [1, 2, 0]
  335. }
  336. },
  337. [
  338. {
  339. 'otherDims': {
  340. 'tooltip': 2
  341. },
  342. 'name': '基础',
  343. 'tooltipName': '基础',
  344. 'coordDimIndex': 0,
  345. 'coordDim': 'y',
  346. 'type': 'ordinal'
  347. },
  348. {
  349. 'otherDims': {
  350. 'tooltip': 0
  351. },
  352. 'name': '打开',
  353. 'tooltipName': '打开',
  354. 'coordDimIndex': 0,
  355. 'coordDim': 'x'
  356. },
  357. {
  358. 'otherDims': {
  359. 'tooltip': 1
  360. },
  361. 'name': '关闭',
  362. 'tooltipName': '关闭',
  363. 'coordDimIndex': 1,
  364. 'coordDim': 'x'
  365. },
  366. {
  367. 'otherDims': {},
  368. 'coordDim': 'value',
  369. 'coordDimIndex': 0,
  370. 'isExtraCoord': true,
  371. 'name': 'value'
  372. },
  373. {
  374. 'otherDims': {},
  375. 'coordDim': 'value0',
  376. 'coordDimIndex': 0,
  377. 'isExtraCoord': true,
  378. 'name': 'value0'
  379. }
  380. ]
  381. );
  382. doTest(
  383. [{
  384. name: 'y',
  385. otherDims: {
  386. tooltip: false
  387. },
  388. dimsDef: ['base']
  389. }, {
  390. name: 'x',
  391. dimsDef: ['open', 'close']
  392. }], data, {
  393. dimsDef: ['基础', null, '关闭'],
  394. encodeDef: {
  395. x: [0, 4]
  396. }
  397. },
  398. [
  399. {
  400. 'otherDims': {},
  401. 'name': '基础',
  402. 'tooltipName': '基础',
  403. 'coordDimIndex': 0,
  404. 'coordDim': 'x',
  405. 'type': 'ordinal'
  406. },
  407. {
  408. 'otherDims': {
  409. 'tooltip': false
  410. },
  411. 'name': 'base',
  412. 'tooltipName': 'base',
  413. 'coordDimIndex': 0,
  414. 'coordDim': 'y'
  415. },
  416. {
  417. 'otherDims': {},
  418. 'name': '关闭',
  419. 'tooltipName': '关闭',
  420. 'coordDimIndex': 0,
  421. 'isExtraCoord': true,
  422. 'coordDim': 'value'
  423. },
  424. {
  425. 'otherDims': {},
  426. 'coordDim': 'value0',
  427. 'coordDimIndex': 0,
  428. 'isExtraCoord': true,
  429. 'name': 'value0'
  430. },
  431. {
  432. 'otherDims': {},
  433. 'coordDim': 'x',
  434. 'coordDimIndex': 1,
  435. 'name': 'close',
  436. 'tooltipName': 'close'
  437. }
  438. ]
  439. );
  440. });
  441. testCase('dimsDef', function (completeDimensions) {
  442. function doTest(sysDims, data, opt, result) {
  443. expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
  444. }
  445. var data = [['iw', 332, 4434, 323, 59], ['vrr', 44, 11, 144, 55]];
  446. doTest(
  447. ['x', 'y', 'value'], data,
  448. {dimsDef: ['挨克思', null, '歪溜']},
  449. [
  450. {
  451. 'otherDims': {},
  452. 'tooltipName': '挨克思',
  453. 'name': '挨克思',
  454. 'type': 'ordinal',
  455. 'coordDim': 'x',
  456. 'coordDimIndex': 0
  457. },
  458. {
  459. 'otherDims': {},
  460. 'coordDim': 'y',
  461. 'coordDimIndex': 0,
  462. 'name': 'y'
  463. },
  464. {
  465. 'otherDims': {},
  466. 'tooltipName': '歪溜',
  467. 'name': '歪溜',
  468. 'coordDim': 'value',
  469. 'coordDimIndex': 0
  470. },
  471. {
  472. 'otherDims': {},
  473. 'coordDim': 'value0',
  474. 'coordDimIndex': 0,
  475. 'isExtraCoord': true,
  476. 'name': 'value0'
  477. },
  478. {
  479. 'otherDims': {},
  480. 'coordDim': 'value1',
  481. 'coordDimIndex': 0,
  482. 'isExtraCoord': true,
  483. 'name': 'value1'
  484. }
  485. ]
  486. );
  487. doTest(
  488. ['x', 'y', 'value'], data,
  489. {dimsDef: ['挨克思', null, {type: 'ordinal'}]}, // no name but only type
  490. [
  491. {
  492. 'otherDims': {},
  493. 'tooltipName': '挨克思',
  494. 'name': '挨克思',
  495. 'type': 'ordinal',
  496. 'coordDim': 'x',
  497. 'coordDimIndex': 0
  498. },
  499. {
  500. 'otherDims': {},
  501. 'coordDim': 'y',
  502. 'coordDimIndex': 0,
  503. 'name': 'y'
  504. },
  505. {
  506. 'otherDims': {},
  507. 'name': 'value',
  508. 'coordDim': 'value',
  509. 'type': 'ordinal',
  510. 'coordDimIndex': 0
  511. },
  512. {
  513. 'otherDims': {},
  514. 'coordDim': 'value0',
  515. 'coordDimIndex': 0,
  516. 'isExtraCoord': true,
  517. 'name': 'value0'
  518. },
  519. {
  520. 'otherDims': {},
  521. 'coordDim': 'value1',
  522. 'coordDimIndex': 0,
  523. 'isExtraCoord': true,
  524. 'name': 'value1'
  525. }
  526. ]
  527. );
  528. doTest(
  529. [{name: 'time', type: 'time', stackable: false}, 'value'], data,
  530. {dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}]},
  531. [
  532. {
  533. 'otherDims': {},
  534. 'tooltipName': '泰亩',
  535. 'name': '泰亩',
  536. 'type': 'ordinal',
  537. 'stackable': false,
  538. 'coordDimIndex': 0,
  539. 'coordDim': 'time'
  540. },
  541. {
  542. 'otherDims': {},
  543. 'tooltipName': '歪溜',
  544. 'name': '歪溜',
  545. 'type': 'float',
  546. 'coordDim': 'value',
  547. 'coordDimIndex': 0
  548. },
  549. {
  550. 'otherDims': {},
  551. 'coordDim': 'value0',
  552. 'coordDimIndex': 0,
  553. 'isExtraCoord': true,
  554. 'name': 'value0'
  555. },
  556. {
  557. 'otherDims': {},
  558. 'coordDim': 'value1',
  559. 'coordDimIndex': 0,
  560. 'isExtraCoord': true,
  561. 'name': 'value1'
  562. },
  563. {
  564. 'otherDims': {},
  565. 'coordDim': 'value2',
  566. 'coordDimIndex': 0,
  567. 'isExtraCoord': true,
  568. 'name': 'value2'
  569. }
  570. ]
  571. );
  572. });
  573. testCase('encodeDef', function (completeDimensions) {
  574. function doTest(sysDims, data, opt, result) {
  575. expect(doCompleteDimensions(completeDimensions, sysDims, data, opt)).toEqual(result);
  576. }
  577. var data = [['iw', 332, 4434, 323, 'd8', 59], ['vrr', 44, 11, 144, '-', 55]];
  578. doTest(
  579. null, data,
  580. {
  581. encodeDef: {
  582. x: 2,
  583. y: [1, 4],
  584. tooltip: 2,
  585. label: [3, 5]
  586. }
  587. },
  588. [
  589. {
  590. 'otherDims': {},
  591. 'coordDim': 'value',
  592. 'coordDimIndex': 0,
  593. 'name': 'value',
  594. 'isExtraCoord': true,
  595. 'type': 'ordinal'
  596. },
  597. {
  598. 'otherDims': {},
  599. 'coordDim': 'y',
  600. 'coordDimIndex': 0,
  601. 'name': 'y'
  602. },
  603. {
  604. 'otherDims': {
  605. 'tooltip': 0
  606. },
  607. 'coordDim': 'x',
  608. 'coordDimIndex': 0,
  609. 'name': 'x'
  610. },
  611. {
  612. 'otherDims': {
  613. 'label': 0
  614. },
  615. 'coordDim': 'value0',
  616. 'coordDimIndex': 0,
  617. 'isExtraCoord': true,
  618. 'name': 'value0'
  619. },
  620. {
  621. 'otherDims': {},
  622. 'coordDim': 'y',
  623. 'coordDimIndex': 1,
  624. 'name': 'y0',
  625. 'type': 'ordinal'
  626. },
  627. {
  628. 'otherDims': {
  629. 'label': 1
  630. },
  631. 'coordDim': 'value1',
  632. 'coordDimIndex': 0,
  633. 'isExtraCoord': true,
  634. 'name': 'value1'
  635. }
  636. ]
  637. );
  638. doTest(
  639. null, data,
  640. {
  641. dimsDef: ['挨克思', null, '歪溜'],
  642. encodeDef: {
  643. x: 2,
  644. y: [1, 4],
  645. tooltip: 2,
  646. label: [3, 5]
  647. }
  648. },
  649. [
  650. {
  651. 'otherDims': {},
  652. 'tooltipName': '挨克思',
  653. 'name': '挨克思',
  654. 'type': 'ordinal',
  655. 'coordDim': 'value',
  656. 'coordDimIndex': 0,
  657. 'isExtraCoord': true
  658. },
  659. {
  660. 'otherDims': {},
  661. 'coordDim': 'y',
  662. 'coordDimIndex': 0,
  663. 'name': 'y'
  664. },
  665. {
  666. 'otherDims': {
  667. 'tooltip': 0
  668. },
  669. 'tooltipName': '歪溜',
  670. 'name': '歪溜',
  671. 'coordDim': 'x',
  672. 'coordDimIndex': 0
  673. },
  674. {
  675. 'otherDims': {
  676. 'label': 0
  677. },
  678. 'coordDim': 'value0',
  679. 'coordDimIndex': 0,
  680. 'isExtraCoord': true,
  681. 'name': 'value0'
  682. },
  683. {
  684. 'otherDims': {},
  685. 'coordDim': 'y',
  686. 'coordDimIndex': 1,
  687. 'name': 'y0',
  688. 'type': 'ordinal'
  689. },
  690. {
  691. 'otherDims': {
  692. 'label': 1
  693. },
  694. 'coordDim': 'value1',
  695. 'coordDimIndex': 0,
  696. 'isExtraCoord': true,
  697. 'name': 'value1'
  698. }
  699. ]
  700. );
  701. doTest(
  702. ['x', {name: 'y', type: 'time', stackable: false}, 'z'], data,
  703. {
  704. dimsDef: ['挨克思', null, '歪溜'],
  705. encodeDef: {
  706. x: 2,
  707. y: [1, 4],
  708. tooltip: 2,
  709. label: [3, 5]
  710. }
  711. },
  712. [
  713. {
  714. 'otherDims': {},
  715. 'tooltipName': '挨克思',
  716. 'name': '挨克思',
  717. 'type': 'ordinal',
  718. 'coordDim': 'z',
  719. 'coordDimIndex': 0
  720. },
  721. {
  722. 'otherDims': {},
  723. 'coordDim': 'y',
  724. 'coordDimIndex': 0,
  725. 'name': 'y',
  726. 'type': 'time',
  727. 'stackable': false
  728. },
  729. {
  730. 'otherDims': {
  731. 'tooltip': 0
  732. },
  733. 'tooltipName': '歪溜',
  734. 'name': '歪溜',
  735. 'coordDim': 'x',
  736. 'coordDimIndex': 0
  737. },
  738. {
  739. 'otherDims': {
  740. 'label': 0
  741. },
  742. 'coordDim': 'value',
  743. 'coordDimIndex': 0,
  744. 'isExtraCoord': true,
  745. 'name': 'value'
  746. },
  747. {
  748. 'otherDims': {},
  749. 'coordDim': 'y',
  750. 'coordDimIndex': 1,
  751. 'name': 'y0',
  752. 'type': 'time',
  753. 'stackable': false
  754. },
  755. {
  756. 'otherDims': {
  757. 'label': 1
  758. },
  759. 'coordDim': 'value0',
  760. 'coordDimIndex': 0,
  761. 'isExtraCoord': true,
  762. 'name': 'value0'
  763. }
  764. ]
  765. );
  766. doTest(
  767. [{name: 'time', type: 'time', stackable: false}, 'value'], data,
  768. {
  769. // dimsDef type 'ordinal' has higher priority then sysDims type 'time'.
  770. dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}],
  771. encodeDef: {
  772. tooltip: 2
  773. },
  774. extraPrefix: 'aaa'
  775. },
  776. [
  777. {
  778. 'otherDims': {},
  779. 'tooltipName': '泰亩',
  780. 'name': '泰亩',
  781. 'type': 'ordinal',
  782. 'stackable': false,
  783. 'coordDimIndex': 0,
  784. 'coordDim': 'time'
  785. },
  786. {
  787. 'otherDims': {},
  788. 'tooltipName': '歪溜',
  789. 'name': '歪溜',
  790. 'type': 'float',
  791. 'coordDim': 'value',
  792. 'coordDimIndex': 0
  793. },
  794. {
  795. 'otherDims': {
  796. 'tooltip': 0
  797. },
  798. 'coordDim': 'aaa',
  799. 'coordDimIndex': 0,
  800. 'isExtraCoord': true,
  801. 'name': 'aaa'
  802. },
  803. {
  804. 'otherDims': {},
  805. 'coordDim': 'aaa0',
  806. 'coordDimIndex': 0,
  807. 'isExtraCoord': true,
  808. 'name': 'aaa0'
  809. },
  810. {
  811. 'otherDims': {},
  812. 'coordDim': 'aaa1',
  813. 'coordDimIndex': 0,
  814. 'isExtraCoord': true,
  815. 'name': 'aaa1',
  816. 'type': 'ordinal'
  817. },
  818. {
  819. 'otherDims': {},
  820. 'coordDim': 'aaa2',
  821. 'coordDimIndex': 0,
  822. 'isExtraCoord': true,
  823. 'name': 'aaa2'
  824. }
  825. ]
  826. );
  827. doTest(
  828. [{name: 'time', type: 'time', stackable: false}, 'value'], data,
  829. {
  830. // dimsDef type 'ordinal' has higher priority then sysDims type 'time'.
  831. dimsDef: [{name: '泰亩', type: 'ordinal'}, {name: '歪溜', type: 'float'}],
  832. encodeDef: {
  833. tooltip: 2
  834. },
  835. extraPrefix: 'aaa',
  836. extraFromZero: true
  837. },
  838. [
  839. {
  840. 'otherDims': {},
  841. 'tooltipName': '泰亩',
  842. 'name': '泰亩',
  843. 'type': 'ordinal',
  844. 'stackable': false,
  845. 'coordDimIndex': 0,
  846. 'coordDim': 'time'
  847. },
  848. {
  849. 'otherDims': {},
  850. 'tooltipName': '歪溜',
  851. 'name': '歪溜',
  852. 'type': 'float',
  853. 'coordDim': 'value',
  854. 'coordDimIndex': 0
  855. },
  856. {
  857. 'otherDims': {
  858. 'tooltip': 0
  859. },
  860. 'coordDim': 'aaa0',
  861. 'coordDimIndex': 0,
  862. 'isExtraCoord': true,
  863. 'name': 'aaa0'
  864. },
  865. {
  866. 'otherDims': {},
  867. 'coordDim': 'aaa1',
  868. 'coordDimIndex': 0,
  869. 'isExtraCoord': true,
  870. 'name': 'aaa1'
  871. },
  872. {
  873. 'otherDims': {},
  874. 'coordDim': 'aaa2',
  875. 'coordDimIndex': 0,
  876. 'isExtraCoord': true,
  877. 'name': 'aaa2',
  878. 'type': 'ordinal'
  879. },
  880. {
  881. 'otherDims': {},
  882. 'coordDim': 'aaa3',
  883. 'coordDimIndex': 0,
  884. 'isExtraCoord': true,
  885. 'name': 'aaa3'
  886. }
  887. ]
  888. );
  889. });
  890. });