1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.MaybeDefaultX = void 0;
|
4 | const util_1 = require("@antv/util");
|
5 | const helper_1 = require("./utils/helper");
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const MaybeDefaultX = () => {
|
11 | return (I, mark) => {
|
12 | const { data } = mark;
|
13 | if (Array.isArray(data) &&
|
14 | (data.every(Array.isArray) || !data.some(helper_1.isObject))) {
|
15 | const extractX = (data, index) => Array.isArray(data[0])
|
16 | ? data.map((item) => item[index])
|
17 | : [data[index]];
|
18 | return [
|
19 | I,
|
20 | (0, util_1.deepMix)({}, mark, {
|
21 | encode: {
|
22 | x: (0, helper_1.column)(extractX(data, 0)),
|
23 | x1: (0, helper_1.column)(extractX(data, 1)),
|
24 | },
|
25 | }),
|
26 | ];
|
27 | }
|
28 | return [I, mark];
|
29 | };
|
30 | };
|
31 | exports.MaybeDefaultX = MaybeDefaultX;
|
32 | exports.MaybeDefaultX.props = {};
|
33 |
|
\ | No newline at end of file |