/
layer.ts
53 lines (47 loc) · 1.24 KB
/
layer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as _ from '@antv/util';
import { registerPlotType } from '../../base/global';
import { LayerConfig } from '../../base/layer';
import { ElementOption, timeIntervals } from '../../interface/config';
import BaseBarLayer, { BarViewConfig } from '../bar/layer';
export interface GroupBarViewConfig extends BarViewConfig {
groupField: string;
}
export interface GroupBarLayerConfig extends GroupBarViewConfig, LayerConfig {}
export default class GroupBarLayer extends BaseBarLayer<GroupBarLayerConfig> {
public static getDefaultOptions(): Partial<GroupBarViewConfig> {
return _.deepMix({}, super.getDefaultOptions(), {
xAxis: {
visible: true,
grid: {
visible: true,
},
},
yAxis: {
visible: true,
title: {
visible: false,
},
},
label: {
visible: true,
position: 'right',
offset: 8,
adjustColor: true,
},
legend: {
visible: true,
position: 'right-top',
},
});
}
public type: string = 'groupBar';
protected adjustBar(bar: ElementOption) {
bar.adjust = [
{
type: 'dodge',
marginRatio: 0.1,
},
];
}
}
registerPlotType('groupBar', GroupBarLayer);