• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

antvis / L7Plot / 9478568050

12 Jun 2024 07:33AM UTC coverage: 56.968% (-2.6%) from 59.55%
9478568050

push

github

web-flow
chore: type mis (#356)

* chore: type mis

* chore: compiler options target

960 of 2222 branches covered (43.2%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

916 existing lines in 53 files now uncovered.

2768 of 4322 relevant lines covered (64.04%)

234.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/packages/l7plot/src/layers/hexbin-layer/index.ts
1
import { uniqueId } from '@antv/util';
2
import { HeatmapLayer as Heatmap } from '@antv/l7';
135✔
3
import { PlotLayer } from '../../core/layer/plot-layer';
135✔
4
import { mappingLayer } from './adaptor';
135✔
5
import { HexbinLayerOptions } from './types';
135✔
6
import { ILayer } from '../../types';
135✔
7

135✔
8
export type { HexbinLayerOptions };
135✔
9

10
const DEFAULT_OPTIONS: HexbinLayerOptions = {
11
  source: {
12
    data: [],
13
    parser: {
14
      type: 'json',
15
      x: 'x',
16
      y: 'y',
17
    },
18
    aggregation: {
19
      type: 'hexagon',
20
      field: '',
21
      radius: 15000,
22
      method: 'sum',
23
    },
24
  },
25
  shape: 'hexagon',
26
  color: '#5FD3A6',
27
  style: {
28
    coverage: 0.9,
29
    angle: 0,
30
    opacity: 1.0,
31
  },
135✔
32
};
33
const LAYER_OPTIONS_KEYS = ['shape', 'color', 'size', 'style', 'state'];
34

31✔
35
export class HexbinLayer extends PlotLayer<HexbinLayerOptions> {
36
  /**
37
   * 默认配置项
38
   */
31✔
39
  static DefaultOptions = DEFAULT_OPTIONS;
40
  /**
41
   * 图层配置项 Keys
42
   */
31✔
43
  static LayerOptionsKeys = PlotLayer.LayerConfigkeys.concat(LAYER_OPTIONS_KEYS);
31✔
44
  /**
31✔
45
   * 图层名称
31!
46
   */
31✔
47
  public name: string;
31✔
48
  /**
31✔
49
   * 图层实例
50
   */
51
  public layer: ILayer;
52
  /**
53
   * 图层类型
54
   */
31✔
55
  public type = PlotLayer.LayerType.HexbinLayer;
56
  /**
57
   * 图层是否具有交互属性
31✔
58
   */
59
  public interaction = false;
UNCOV
60

×
UNCOV
61
  constructor(options: HexbinLayerOptions) {
×
62
    super(options);
63
    const { name, source } = this.options;
64
    const config = this.pickLayerConfig(this.options);
135✔
65

66
    this.name = name ? name : uniqueId(this.type);
67
    this.layer = new Heatmap({ ...config, name: this.name });
68

135✔
69
    this.mappingLayer(this.layer, this.options);
70
    this.setSource(source);
71
  }
72

135✔
73
  /**
74
   * 获取默认配置
75
   */
76
  public getDefaultOptions(): Partial<HexbinLayerOptions> {
77
    return DEFAULT_OPTIONS;
78
  }
79

80
  protected mappingLayer(layer: ILayer, options: HexbinLayerOptions) {
81
    mappingLayer(layer, options);
82
  }
83

84
  public update(options: Partial<HexbinLayerOptions>) {
85
    super.update(options);
86

87
    this.mappingLayer(this.layer, this.options);
88
  }
89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc