GridModel.ts 2.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

L
lang 已提交
20

S
sushuang 已提交
21 22
import './AxisModel';
import ComponentModel from '../../model/Component';
1
100pah 已提交
23 24 25 26
import { ComponentOption, BoxLayoutOptionMixin, ZRColor, ShadowOptionMixin } from '../../util/types';
import Grid from './Grid';
import { CoordinateSystemHostModel } from '../CoordinateSystem';

P
pissang 已提交
27
export interface GridOption extends ComponentOption, BoxLayoutOptionMixin, ShadowOptionMixin {
1
100pah 已提交
28 29 30 31
    show?: boolean;

    // Whether grid size contain label.
    containLabel?: boolean;
L
lang 已提交
32

1
100pah 已提交
33 34 35
    backgroundColor?: ZRColor;
    borderWidth?: number;
    borderColor?: ZRColor;
L
lang 已提交
36

37
    tooltip?: any; // FIXME:TS add this tooltip type
1
100pah 已提交
38
}
L
lang 已提交
39

1
100pah 已提交
40
class GridModel extends ComponentModel<GridOption> implements CoordinateSystemHostModel {
L
lang 已提交
41

1
100pah 已提交
42
    static type = 'grid';
L
lang 已提交
43

1
100pah 已提交
44
    static dependencies = ['xAxis', 'yAxis'];
45

1
100pah 已提交
46 47 48 49 50
    static layoutMode = 'box' as const;

    coordinateSystem: Grid;

    static defaultOption: GridOption = {
S
sushuang 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64
        show: false,
        zlevel: 0,
        z: 0,
        left: '10%',
        top: 60,
        right: '10%',
        bottom: 60,
        // If grid size contain label
        containLabel: false,
        // width: {totalWidth} - left - right,
        // height: {totalHeight} - top - bottom,
        backgroundColor: 'rgba(0,0,0,0)',
        borderWidth: 1,
        borderColor: '#ccc'
1
100pah 已提交
65
    };
1
100pah 已提交
66 67 68
}

export default GridModel;