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