axisDefault.js
5.6 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
* 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.
*/
var zrUtil = require("zrender/lib/core/util");
/*
* 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.
*/
var defaultOption = {
show: true,
zlevel: 0,
z: 0,
// Inverse the axis.
inverse: false,
// Axis name displayed.
name: '',
// 'start' | 'middle' | 'end'
nameLocation: 'end',
// By degree. By defualt auto rotate by nameLocation.
nameRotate: null,
nameTruncate: {
maxWidth: null,
ellipsis: '...',
placeholder: '.'
},
// Use global text style by default.
nameTextStyle: {},
// The gap between axisName and axisLine.
nameGap: 15,
// Default `false` to support tooltip.
silent: false,
// Default `false` to avoid legacy user event listener fail.
triggerEvent: false,
tooltip: {
show: false
},
axisPointer: {},
axisLine: {
show: true,
onZero: true,
onZeroAxisIndex: null,
lineStyle: {
color: '#333',
width: 1,
type: 'solid'
},
// The arrow at both ends the the axis.
symbol: ['none', 'none'],
symbolSize: [10, 15]
},
axisTick: {
show: true,
// Whether axisTick is inside the grid or outside the grid.
inside: false,
// The length of axisTick.
length: 5,
lineStyle: {
width: 1
}
},
axisLabel: {
show: true,
// Whether axisLabel is inside the grid or outside the grid.
inside: false,
rotate: 0,
// true | false | null/undefined (auto)
showMinLabel: null,
// true | false | null/undefined (auto)
showMaxLabel: null,
margin: 8,
// formatter: null,
fontSize: 12
},
splitLine: {
show: true,
lineStyle: {
color: ['#ccc'],
width: 1,
type: 'solid'
}
},
splitArea: {
show: false,
areaStyle: {
color: ['rgba(250,250,250,0.3)', 'rgba(200,200,200,0.3)']
}
}
};
var axisDefault = {};
axisDefault.categoryAxis = zrUtil.merge({
// The gap at both ends of the axis. For categoryAxis, boolean.
boundaryGap: true,
// Set false to faster category collection.
// Only usefull in the case like: category is
// ['2012-01-01', '2012-01-02', ...], where the input
// data has been ensured not duplicate and is large data.
// null means "auto":
// if axis.data provided, do not deduplication,
// else do deduplication.
deduplication: null,
// splitArea: {
// show: false
// },
splitLine: {
show: false
},
axisTick: {
// If tick is align with label when boundaryGap is true
alignWithLabel: false,
interval: 'auto'
},
axisLabel: {
interval: 'auto'
}
}, defaultOption);
axisDefault.valueAxis = zrUtil.merge({
// The gap at both ends of the axis. For value axis, [GAP, GAP], where
// `GAP` can be an absolute pixel number (like `35`), or percent (like `'30%'`)
boundaryGap: [0, 0],
// TODO
// min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60]
// Min value of the axis. can be:
// + a number
// + 'dataMin': use the min value in data.
// + null/undefined: auto decide min value (consider pretty look and boundaryGap).
// min: null,
// Max value of the axis. can be:
// + a number
// + 'dataMax': use the max value in data.
// + null/undefined: auto decide max value (consider pretty look and boundaryGap).
// max: null,
// Readonly prop, specifies start value of the range when using data zoom.
// rangeStart: null
// Readonly prop, specifies end value of the range when using data zoom.
// rangeEnd: null
// Optional value can be:
// + `false`: always include value 0.
// + `true`: the extent do not consider value 0.
// scale: false,
// AxisTick and axisLabel and splitLine are caculated based on splitNumber.
splitNumber: 5 // Interval specifies the span of the ticks is mandatorily.
// interval: null
// Specify min interval when auto calculate tick interval.
// minInterval: null
// Specify max interval when auto calculate tick interval.
// maxInterval: null
}, defaultOption);
axisDefault.timeAxis = zrUtil.defaults({
scale: true,
min: 'dataMin',
max: 'dataMax'
}, axisDefault.valueAxis);
axisDefault.logAxis = zrUtil.defaults({
scale: true,
logBase: 10
}, axisDefault.valueAxis);
var _default = axisDefault;
module.exports = _default;