@progress/kendo-charts 1.20.0-dev.202111081615 → 1.20.0-dev.202111111633
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/core/axis.js +14 -2
- package/dist/es/core/category-axis.js +39 -3
- package/dist/es/core/date-value-axis.js +5 -7
- package/dist/es/core/logarithmic-axis.js +32 -61
- package/dist/es/core/numeric-axis.js +33 -61
- package/dist/es2015/core/axis.js +13 -2
- package/dist/es2015/core/category-axis.js +35 -3
- package/dist/es2015/core/date-value-axis.js +2 -7
- package/dist/es2015/core/logarithmic-axis.js +23 -57
- package/dist/es2015/core/numeric-axis.js +23 -58
- package/dist/npm/main.js +118 -129
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ import Axis from './axis';
|
|
|
3
3
|
import AxisLabel from './axis-label';
|
|
4
4
|
import Box from './box';
|
|
5
5
|
|
|
6
|
-
import { BLACK, DEFAULT_PRECISION, COORD_PRECISION
|
|
7
|
-
import { deepExtend, defined, limitValue, round, setDefaultOptions } from '../common';
|
|
6
|
+
import { BLACK, DEFAULT_PRECISION, COORD_PRECISION } from '../common/constants';
|
|
7
|
+
import { deepExtend, defined, limitValue, round, setDefaultOptions, valueOrDefault } from '../common';
|
|
8
8
|
|
|
9
9
|
import autoMajorUnit from './utils/auto-major-unit';
|
|
10
10
|
import autoAxisMin from './utils/auto-axis-min';
|
|
@@ -70,17 +70,13 @@ class NumericAxis extends Axis {
|
|
|
70
70
|
|
|
71
71
|
getTickPositions(unit, skipUnit) {
|
|
72
72
|
const options = this.options;
|
|
73
|
-
const {
|
|
74
|
-
const lineBox = this.lineBox();
|
|
75
|
-
const lineSize = vertical ? lineBox.height() : lineBox.width();
|
|
73
|
+
const { axisDir, axisOrigin, lineBox, lineSize } = this.lineInfo();
|
|
76
74
|
const range = options.max - options.min;
|
|
77
75
|
const scale = lineSize / range;
|
|
78
76
|
const step = unit * scale;
|
|
79
77
|
const divisions = this.getDivisions(unit);
|
|
80
|
-
const dir = (vertical ? -1 : 1) * (reverse ? -1 : 1);
|
|
81
|
-
const startEdge = dir === 1 ? 1 : 2;
|
|
82
78
|
const positions = [];
|
|
83
|
-
let pos = lineBox[
|
|
79
|
+
let pos = lineBox[axisOrigin];
|
|
84
80
|
let skipStep = 0;
|
|
85
81
|
|
|
86
82
|
if (skipUnit) {
|
|
@@ -92,7 +88,7 @@ class NumericAxis extends Axis {
|
|
|
92
88
|
positions.push(round(pos, COORD_PRECISION));
|
|
93
89
|
}
|
|
94
90
|
|
|
95
|
-
pos = pos + step *
|
|
91
|
+
pos = pos + step * axisDir;
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
return positions;
|
|
@@ -108,79 +104,48 @@ class NumericAxis extends Axis {
|
|
|
108
104
|
|
|
109
105
|
getSlot(a, b, limit = false) {
|
|
110
106
|
const options = this.options;
|
|
111
|
-
const {
|
|
112
|
-
const
|
|
113
|
-
const lineBox = this.lineBox();
|
|
114
|
-
const lineStart = lineBox[valueAxis + (reverse ? 2 : 1)];
|
|
115
|
-
const lineSize = vertical ? lineBox.height() : lineBox.width();
|
|
116
|
-
const dir = reverse ? -1 : 1;
|
|
117
|
-
const step = dir * (lineSize / (options.max - options.min));
|
|
118
|
-
const slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
|
|
119
|
-
|
|
120
|
-
let start = a;
|
|
121
|
-
let end = b;
|
|
122
|
-
|
|
123
|
-
if (!defined(start)) {
|
|
124
|
-
start = end || 0;
|
|
125
|
-
}
|
|
107
|
+
const { axis, axisDir, lineBox, lineSize, lineStart } = this.lineInfo();
|
|
108
|
+
const step = axisDir * (lineSize / (options.max - options.min));
|
|
126
109
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
110
|
+
let start = valueOrDefault(a, b || 0);
|
|
111
|
+
let end = valueOrDefault(b, a || 0);
|
|
130
112
|
|
|
131
113
|
if (limit) {
|
|
132
|
-
start =
|
|
133
|
-
end =
|
|
114
|
+
start = limitValue(start, options.min, options.max);
|
|
115
|
+
end = limitValue(end, options.min, options.max);
|
|
134
116
|
}
|
|
135
117
|
|
|
136
|
-
|
|
118
|
+
const p1 = Math.min(start, end) - options.min;
|
|
119
|
+
const p2 = Math.max(start, end) - options.min;
|
|
137
120
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
} else {
|
|
142
|
-
p1 = Math.min(start, end) - options.min;
|
|
143
|
-
p2 = Math.max(start, end) - options.min;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
slotBox[valueAxis + 1] = limitCoordinate(lineStart + step * (reverse ? p2 : p1));
|
|
147
|
-
slotBox[valueAxis + 2] = limitCoordinate(lineStart + step * (reverse ? p1 : p2));
|
|
121
|
+
const slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
|
|
122
|
+
slotBox[axis + 1] = limitCoordinate(lineStart + step * (axisDir > 0 ? p1 : p2));
|
|
123
|
+
slotBox[axis + 2] = limitCoordinate(lineStart + step * (axisDir > 0 ? p2 : p1));
|
|
148
124
|
|
|
149
125
|
return slotBox;
|
|
150
126
|
}
|
|
151
127
|
|
|
152
128
|
getValue(point) {
|
|
153
129
|
const options = this.options;
|
|
154
|
-
const { vertical, reverse } = options;
|
|
155
130
|
const max = Number(options.max);
|
|
156
131
|
const min = Number(options.min);
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const dir = reverse ? -1 : 1;
|
|
162
|
-
const offset = dir * (point[valueAxis] - lineStart);
|
|
163
|
-
const step = (max - min) / lineSize;
|
|
164
|
-
const valueOffset = offset * step;
|
|
165
|
-
|
|
166
|
-
if (offset < 0 || offset > lineSize) {
|
|
132
|
+
const offset = this.pointOffset(point);
|
|
133
|
+
const valueOffset = offset * (max - min);
|
|
134
|
+
|
|
135
|
+
if (offset < 0 || offset > 1) {
|
|
167
136
|
return null;
|
|
168
137
|
}
|
|
169
138
|
|
|
170
|
-
const value =
|
|
171
|
-
max - valueOffset :
|
|
172
|
-
min + valueOffset;
|
|
173
|
-
|
|
139
|
+
const value = min + valueOffset;
|
|
174
140
|
return round(value, DEFAULT_PRECISION);
|
|
175
141
|
}
|
|
176
142
|
|
|
177
143
|
translateRange(delta) {
|
|
178
144
|
const options = this.options;
|
|
179
145
|
const { vertical, reverse, max, min } = options;
|
|
180
|
-
const
|
|
181
|
-
const size = vertical ? lineBox.height() : lineBox.width();
|
|
146
|
+
const { lineSize } = this.lineInfo();
|
|
182
147
|
const range = max - min;
|
|
183
|
-
const scale =
|
|
148
|
+
const scale = lineSize / range;
|
|
184
149
|
let offset = round(delta / scale, DEFAULT_PRECISION);
|
|
185
150
|
|
|
186
151
|
if ((vertical || reverse) && !(vertical && reverse )) {
|