1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.Identity = void 0;
|
4 | const util_1 = require("@antv/util");
|
5 | const base_1 = require("./base");
|
6 | const wilkinson_extended_1 = require("../tick-methods/wilkinson-extended");
|
7 | const utils_1 = require("../utils");
|
8 | class Identity extends base_1.Base {
|
9 | |
10 |
|
11 |
|
12 |
|
13 | getDefaultOptions() {
|
14 | return {
|
15 | domain: [0, 1],
|
16 | range: [0, 1],
|
17 | tickCount: 5,
|
18 | unknown: undefined,
|
19 | tickMethod: wilkinson_extended_1.wilkinsonExtended,
|
20 | };
|
21 | }
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 | map(x) {
|
28 | return (0, utils_1.isValid)(x) ? x : this.options.unknown;
|
29 | }
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 | invert(x) {
|
36 | return this.map(x);
|
37 | }
|
38 | |
39 |
|
40 |
|
41 |
|
42 | clone() {
|
43 | return new Identity(this.options);
|
44 | }
|
45 | |
46 |
|
47 |
|
48 |
|
49 | getTicks() {
|
50 | const { domain, tickCount, tickMethod } = this.options;
|
51 | const [min, max] = domain;
|
52 | if (!(0, util_1.isNumber)(min) || !(0, util_1.isNumber)(max))
|
53 | return [];
|
54 | return tickMethod(min, max, tickCount);
|
55 | }
|
56 | }
|
57 | exports.Identity = Identity;
|
58 |
|
\ | No newline at end of file |