@progress/kendo-charts 1.19.1 → 1.20.0-dev.202111121622

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.
Files changed (61) hide show
  1. package/dist/cdn/js/kendo-charts.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/chart/chart.js +15 -6
  4. package/dist/es/chart/constants.js +3 -1
  5. package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +8 -4
  6. package/dist/es/chart/selection.js +41 -1
  7. package/dist/es/common/mousewheel-delta.js +4 -7
  8. package/dist/es/core/axis.js +47 -0
  9. package/dist/es/core/category-axis.js +62 -20
  10. package/dist/es/core/date-category-axis.js +26 -38
  11. package/dist/es/core/date-value-axis.js +37 -40
  12. package/dist/es/core/logarithmic-axis.js +62 -88
  13. package/dist/es/core/numeric-axis.js +57 -81
  14. package/dist/es/main.js +1 -0
  15. package/dist/es/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +103 -0
  16. package/dist/es/qrcode/encodings/data-modes/byte-data-mode.js +51 -0
  17. package/dist/es/qrcode/encodings/data-modes/data-mode-instances.js +12 -0
  18. package/dist/es/qrcode/encodings/data-modes/numeric-data-mode.js +49 -0
  19. package/dist/es/qrcode/encodings/data-modes/qr-data-mode.js +50 -0
  20. package/dist/es/qrcode/encodings/encoders/iso-encoder.js +29 -0
  21. package/dist/es/qrcode/encodings/encoders/utf8-encoder.js +91 -0
  22. package/dist/es/qrcode/encodings/encoding-result.js +16 -0
  23. package/dist/es/qrcode/encodings/encoding.js +701 -0
  24. package/dist/es/qrcode/encodings/free-cell-visitor.js +57 -0
  25. package/dist/es/qrcode/encodings/version-codewords.js +1289 -0
  26. package/dist/es/qrcode/qrcode.js +403 -0
  27. package/dist/es/qrcode/utils.js +28 -0
  28. package/dist/es/qrcode.js +1 -0
  29. package/dist/es/stock/navigator.js +3 -2
  30. package/dist/es2015/chart/chart.js +15 -6
  31. package/dist/es2015/chart/constants.js +3 -1
  32. package/dist/es2015/chart/pan-and-zoom/mousewheel-zoom.js +6 -4
  33. package/dist/es2015/chart/selection.js +40 -1
  34. package/dist/es2015/common/mousewheel-delta.js +4 -7
  35. package/dist/es2015/core/axis.js +39 -0
  36. package/dist/es2015/core/category-axis.js +56 -18
  37. package/dist/es2015/core/date-category-axis.js +27 -36
  38. package/dist/es2015/core/date-value-axis.js +35 -40
  39. package/dist/es2015/core/logarithmic-axis.js +52 -83
  40. package/dist/es2015/core/numeric-axis.js +47 -78
  41. package/dist/es2015/main.js +1 -0
  42. package/dist/es2015/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +91 -0
  43. package/dist/es2015/qrcode/encodings/data-modes/byte-data-mode.js +41 -0
  44. package/dist/es2015/qrcode/encodings/data-modes/data-mode-instances.js +13 -0
  45. package/dist/es2015/qrcode/encodings/data-modes/numeric-data-mode.js +39 -0
  46. package/dist/es2015/qrcode/encodings/data-modes/qr-data-mode.js +44 -0
  47. package/dist/es2015/qrcode/encodings/encoders/iso-encoder.js +19 -0
  48. package/dist/es2015/qrcode/encodings/encoders/utf8-encoder.js +83 -0
  49. package/dist/es2015/qrcode/encodings/encoding-result.js +10 -0
  50. package/dist/es2015/qrcode/encodings/encoding.js +701 -0
  51. package/dist/es2015/qrcode/encodings/free-cell-visitor.js +49 -0
  52. package/dist/es2015/qrcode/encodings/version-codewords.js +1289 -0
  53. package/dist/es2015/qrcode/qrcode.js +395 -0
  54. package/dist/es2015/qrcode/utils.js +28 -0
  55. package/dist/es2015/qrcode.js +1 -0
  56. package/dist/es2015/stock/navigator.js +3 -2
  57. package/dist/npm/main.d.ts +1 -0
  58. package/dist/npm/main.js +3172 -283
  59. package/dist/npm/qrcode.d.ts +5 -0
  60. package/dist/systemjs/kendo-charts.js +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1,403 @@
1
+ import {
2
+ geometry as geom,
3
+ drawing as draw
4
+ } from '@progress/kendo-drawing';
5
+
6
+ import {
7
+ Class,
8
+ addClass,
9
+ setDefaultOptions,
10
+ deepExtend
11
+ } from '../common';
12
+
13
+ import { Box } from '../core';
14
+ import { encodeData } from './encodings/encoding';
15
+ import { extend } from './utils';
16
+
17
+ var round = Math.round;
18
+ var crossPattern = [[0, 1], [1, 1], [1, 2], [2, 2], [2, 1], [3, 1], [3, 0], [2, 0], [2, -1], [1, -1], [1, 0]];
19
+ var squarePattern = [[0, 1], [1, 1], [1, 0]];
20
+
21
+ var QRCodeDefaults = {
22
+ DEFAULT_SIZE: 200,
23
+ QUIET_ZONE_LENGTH: 4,
24
+ DEFAULT_ERROR_CORRECTION_LEVEL: "L",
25
+ DEFAULT_BACKGROUND: "#fff",
26
+ DEFAULT_DARK_MODULE_COLOR: "#000",
27
+ MIN_BASE_UNIT_SIZE: 1,
28
+ DEFAULT_LOGO_SIZE: 7
29
+ };
30
+
31
+ var QRCode = (function (Class) {
32
+ function QRCode(element, options) {
33
+ Class.call(this);
34
+
35
+ this.options = deepExtend({}, this.options, options);
36
+ this.element = element;
37
+ this.wrapper = this.element;
38
+
39
+ this._initElement();
40
+ this._initSurface();
41
+
42
+ this.setOptions(options);
43
+ }
44
+
45
+ if ( Class ) QRCode.__proto__ = Class;
46
+ QRCode.prototype = Object.create( Class && Class.prototype );
47
+ QRCode.prototype.constructor = QRCode;
48
+
49
+ QRCode.prototype.destroy = function destroy () {
50
+ this._destroySurface();
51
+ };
52
+
53
+ QRCode.prototype._initElement = function _initElement () {
54
+ addClass(this.element, "k-qrcode");
55
+ this.element.style.display = "block";
56
+ };
57
+
58
+ QRCode.prototype._initSurface = function _initSurface () {
59
+ var ref = this;
60
+ var options = ref.options;
61
+ var surface = ref.surface;
62
+
63
+ if (!surface || surface.options.type !== options.renderAs) {
64
+ this._destroySurface();
65
+ this._initSurfaceElement();
66
+ this.surface = this._createSurface();
67
+ }
68
+ };
69
+
70
+ QRCode.prototype._createSurface = function _createSurface () {
71
+ return draw.Surface.create(this.surfaceElement, {
72
+ type: this.options.renderAs
73
+ });
74
+ };
75
+
76
+ QRCode.prototype._destroySurface = function _destroySurface () {
77
+ if (this.surface) {
78
+ this.surface.destroy();
79
+ this.surface = null;
80
+ this._destroySurfaceElement();
81
+ }
82
+ };
83
+
84
+ QRCode.prototype._initSurfaceElement = function _initSurfaceElement () {
85
+ if (!this.surfaceElement) {
86
+ this.surfaceElement = document.createElement('div');
87
+ this.surfaceElement.style.position = "relative";
88
+ this.element.appendChild(this.surfaceElement);
89
+ }
90
+ };
91
+
92
+ QRCode.prototype._destroySurfaceElement = function _destroySurfaceElement () {
93
+ if (this.surfaceElement && this.surfaceElement.parentNode) {
94
+ this.surfaceElement.parentNode.removeChild(this.surfaceElement);
95
+ this.surfaceElement = null;
96
+ }
97
+ };
98
+
99
+ QRCode.prototype.redraw = function redraw () {
100
+ var size = this._getSize();
101
+
102
+ this.surface.clear();
103
+
104
+ this.surface.setSize({
105
+ width: size,
106
+ height: size
107
+ });
108
+
109
+ this.createVisual();
110
+
111
+ this.surface.draw(this.visual);
112
+ };
113
+
114
+ QRCode.prototype.getSize = function getSize () {
115
+ var element = this.element;
116
+ var elementWidth = element.clientWidth;
117
+ var elementHeight = element.clientHeight;
118
+ var size = { width: 0, height: 0 };
119
+
120
+ if (elementWidth > 0) {
121
+ size.width = elementWidth;
122
+ }
123
+
124
+ if (elementHeight) {
125
+ size.height = elementHeight;
126
+ }
127
+
128
+ return size;
129
+ };
130
+
131
+ QRCode.prototype._resize = function _resize () {
132
+ this.redraw();
133
+ };
134
+
135
+ QRCode.prototype.createVisual = function createVisual () {
136
+ this.visual = this._render();
137
+ };
138
+
139
+ QRCode.prototype.exportVisual = function exportVisual () {
140
+ return this._render();
141
+ };
142
+
143
+ QRCode.prototype._render = function _render () {
144
+ var value = this._value,
145
+ baseUnit,
146
+ border = this.options.border || {},
147
+ padding = this.options.padding || 0,
148
+ borderWidth = border.width || 0,
149
+ quietZoneSize,
150
+ matrix,
151
+ size,
152
+ dataSize,
153
+ contentSize;
154
+
155
+ border.width = borderWidth;
156
+
157
+ var visual = new draw.Group();
158
+
159
+ if (value) {
160
+ matrix = encodeData(value, this.options.errorCorrection, this.options.encoding);
161
+ size = this._getSize();
162
+ contentSize = size - 2 * (borderWidth + padding);
163
+ baseUnit = this._calculateBaseUnit(contentSize, matrix.length);
164
+ dataSize = matrix.length * baseUnit;
165
+ quietZoneSize = borderWidth + padding + (contentSize - dataSize) / 2;
166
+
167
+ visual.append(this._renderBackground(size, border));
168
+ visual.append(this._renderMatrix(matrix, baseUnit, quietZoneSize));
169
+
170
+ if (this._hasCustomLogo()) {
171
+ visual.append(this._renderLogo(size, baseUnit));
172
+ } else if (this._isSwiss()) {
173
+ visual.append(this._renderSwissCode(size, baseUnit));
174
+ }
175
+ }
176
+
177
+ return visual;
178
+ };
179
+
180
+ QRCode.prototype._renderLogo = function _renderLogo (qrSize, baseUnit) {
181
+ var image;
182
+ var imageRect;
183
+ var center = round(qrSize / 2);
184
+ var logoSize = this._getLogoSize(baseUnit * QRCodeDefaults.DEFAULT_LOGO_SIZE);
185
+ var logoUrl = this.options.overlay.imageUrl;
186
+ var position = {
187
+ x: center - logoSize.width / 2,
188
+ y: center - logoSize.height / 2
189
+ };
190
+
191
+ imageRect = new geom.Rect(
192
+ new geom.Point(position.x, position.y),
193
+ new geom.Size(logoSize.width, logoSize.height)
194
+ );
195
+
196
+ image = new draw.Image(logoUrl, imageRect);
197
+
198
+ return image;
199
+ };
200
+
201
+ QRCode.prototype._renderSwissCode = function _renderSwissCode (qrSize, baseUnit) {
202
+ var logoSize = this._getLogoSize(baseUnit * QRCodeDefaults.DEFAULT_LOGO_SIZE);
203
+ logoSize = Math.max(logoSize.width, logoSize.height);
204
+ var crossSize = logoSize / 4;
205
+ var crossOffset = crossSize / 2;
206
+ var center = qrSize / 2;
207
+ var start = {};
208
+ var visual = new draw.Group();
209
+
210
+ start.x = start.y = Math.ceil(center - baseUnit - logoSize / 2);
211
+ visual.append(this._renderShape(start, Math.ceil(logoSize + baseUnit * 2), squarePattern, "#fff"));
212
+
213
+ start.x = start.y = center - logoSize / 2;
214
+ visual.append(this._renderShape(start, logoSize, squarePattern, this.options.color));
215
+
216
+ start.x = center + crossOffset - logoSize / 2;
217
+ start.y = center + crossOffset + crossSize - logoSize / 2;
218
+ visual.append(this._renderShape(start, crossSize, crossPattern, "#fff"));
219
+
220
+ return visual;
221
+ };
222
+
223
+ QRCode.prototype._renderShape = function _renderShape (start, step, pattern, color) {
224
+ var path = new draw.MultiPath({
225
+ fill: {
226
+ color: color
227
+ },
228
+ stroke: null
229
+ });
230
+
231
+ path.moveTo(start.x, start.y);
232
+
233
+ for (var i = 0; i < pattern.length; i++) {
234
+ path.lineTo(start.x + step * pattern[i][0], start.y + step * pattern[i][1]);
235
+ }
236
+
237
+ path.close();
238
+
239
+ return path;
240
+ };
241
+
242
+ QRCode.prototype._getSize = function _getSize () {
243
+ var size;
244
+
245
+ if (this.options.size) {
246
+ size = parseInt(this.options.size, 10);
247
+ } else {
248
+ var element = this.element;
249
+ var min = Math.min(element.clientWidth, element.clientHeight);
250
+
251
+ if (min > 0) {
252
+ size = min;
253
+ } else {
254
+ size = QRCodeDefaults.DEFAULT_SIZE;
255
+ }
256
+ }
257
+
258
+ return size;
259
+ };
260
+
261
+ QRCode.prototype._calculateBaseUnit = function _calculateBaseUnit (size, matrixSize) {
262
+ var baseUnit = Math.floor(size / matrixSize);
263
+
264
+ if (baseUnit < QRCodeDefaults.MIN_BASE_UNIT_SIZE) {
265
+ throw new Error("Insufficient size.");
266
+ }
267
+
268
+ if (baseUnit * matrixSize >= size &&
269
+ baseUnit - 1 >= QRCodeDefaults.MIN_BASE_UNIT_SIZE) {
270
+ baseUnit--;
271
+ }
272
+
273
+ return baseUnit;
274
+ };
275
+
276
+ QRCode.prototype._renderMatrix = function _renderMatrix (matrix, baseUnit, quietZoneSize) {
277
+ var path = new draw.MultiPath({
278
+ fill: {
279
+ color: this.options.color
280
+ },
281
+ stroke: null
282
+ });
283
+
284
+ for (var row = 0; row < matrix.length; row++) {
285
+ var y = quietZoneSize + row * baseUnit;
286
+ var column = 0;
287
+
288
+ while (column < matrix.length) {
289
+ while (matrix[row][column] === 0 && column < matrix.length) {
290
+ column++;
291
+ }
292
+
293
+ if (column < matrix.length) {
294
+ var x = column;
295
+ while (matrix[row][column] === 1) {
296
+ column++;
297
+ }
298
+
299
+ var x1 = round(quietZoneSize + x * baseUnit);
300
+ var y1 = round(y);
301
+ var x2 = round(quietZoneSize + column * baseUnit);
302
+ var y2 = round(y + baseUnit);
303
+
304
+ path.moveTo(x1, y1)
305
+ .lineTo(x1, y2)
306
+ .lineTo(x2, y2)
307
+ .lineTo(x2, y1)
308
+ .close();
309
+ }
310
+ }
311
+ }
312
+
313
+ return path;
314
+ };
315
+
316
+ QRCode.prototype._renderBackground = function _renderBackground (size, border) {
317
+ var box = new Box(0, 0, size, size).unpad(border.width / 2);
318
+ var background = draw.Path.fromRect(box.toRect(), {
319
+ fill: {
320
+ color: this.options.background
321
+ },
322
+ stroke: {
323
+ color: border.color,
324
+ width: border.width
325
+ }
326
+ });
327
+
328
+ return background;
329
+ };
330
+
331
+ QRCode.prototype.setOptions = function setOptions (options) {
332
+ var newOptions = options || {};
333
+ this.options = extend(this.options, newOptions);
334
+
335
+ if (options.value !== undefined) {
336
+ this._value = String(this.options.value);
337
+ }
338
+
339
+ this.redraw();
340
+ };
341
+
342
+ QRCode.prototype.value = function value (value$1) {
343
+ if (value$1 === undefined) {
344
+ return this._value;
345
+ }
346
+
347
+ this._value = String(value$1);
348
+
349
+ this.redraw();
350
+ };
351
+
352
+ QRCode.prototype._hasCustomLogo = function _hasCustomLogo () {
353
+ return Boolean(this.options.overlay.imageUrl);
354
+ };
355
+
356
+ QRCode.prototype._isSwiss = function _isSwiss () {
357
+ return this.options.overlay.type === "swiss";
358
+ };
359
+
360
+ QRCode.prototype._getLogoSize = function _getLogoSize (defautLogoSize) {
361
+ var width = this.options.overlay.width;
362
+ var height = this.options.overlay.height;
363
+
364
+ if (!width && !height) {
365
+ width = height = defautLogoSize;
366
+ } else if (width && !height) {
367
+ height = width;
368
+ } else if (!width && height) {
369
+ width = height;
370
+ }
371
+
372
+ return {
373
+ width: width,
374
+ height: height
375
+ };
376
+ };
377
+
378
+ return QRCode;
379
+ }(Class));
380
+
381
+ setDefaultOptions(QRCode, {
382
+ name: "QRCode",
383
+ renderAs: "svg",
384
+ encoding: "ISO_8859_1",
385
+ value: "",
386
+ errorCorrection: QRCodeDefaults.DEFAULT_ERROR_CORRECTION_LEVEL,
387
+ background: QRCodeDefaults.DEFAULT_BACKGROUND,
388
+ color: QRCodeDefaults.DEFAULT_DARK_MODULE_COLOR,
389
+ size: "",
390
+ padding: 0,
391
+ border: {
392
+ color: "",
393
+ width: 0
394
+ },
395
+ overlay: {
396
+ type: "image",
397
+ imageUrl: "",
398
+ width: 0,
399
+ height: 0
400
+ }
401
+ });
402
+
403
+ export default QRCode;
@@ -0,0 +1,28 @@
1
+ export var extend = Object.assign;
2
+
3
+ export function splitInto(str, chunkLength) {
4
+ var result = [];
5
+ var idx = 0;
6
+
7
+ while (idx < str.length) {
8
+ result.push(str.substring(idx, idx + chunkLength));
9
+ idx += chunkLength;
10
+ }
11
+
12
+ return result;
13
+ }
14
+
15
+ export function toBitsString(value, length) {
16
+ var bitString = Number(value).toString(2);
17
+
18
+ if (bitString.length < length) {
19
+ bitString = new Array(length - bitString.length + 1).join(0) + bitString;
20
+ }
21
+
22
+ return bitString;
23
+ }
24
+
25
+ export function toDecimal(value) {
26
+ return parseInt(value, 2);
27
+ }
28
+
@@ -0,0 +1 @@
1
+ export { default as QRCode } from './qrcode/qrcode';
@@ -286,6 +286,7 @@ var Navigator = (function (Class) {
286
286
 
287
287
  var fromIx = mainAxis.categoryIndex(selection.options.from);
288
288
  var toIx = mainAxis.categoryIndex(selection.options.to);
289
+ var coords = this.chart._eventCoordinates(e.originalEvent);
289
290
 
290
291
  e.originalEvent.preventDefault();
291
292
 
@@ -294,11 +295,11 @@ var Navigator = (function (Class) {
294
295
  }
295
296
 
296
297
  if (toIx - fromIx > 1) {
297
- selection.expand(delta);
298
+ selection.zoom(delta, coords);
298
299
  this.readSelection();
299
300
  } else {
300
301
  axis.options.min = select.from;
301
- select.from = axis.scaleRange(-e.delta).min;
302
+ select.from = axis.scaleRange(-e.delta * this.chart._mousewheelZoomRate(), coords).min;
302
303
  }
303
304
 
304
305
  if (liveDrag) {
@@ -22,12 +22,13 @@ import { ChartPane, ChartPlotArea, findAxisByName } from './api-elements';
22
22
 
23
23
  import { X, Y, VALUE, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_SERIES_OPACITY } from '../common/constants';
24
24
  import { addClass, Class, setDefaultOptions, deepExtend, defined, find, isObject, isFunction, elementSize, elementOffset,
25
- elementScale, elementStyles, eventCoordinates, bindEvents, unbindEvents, mousewheelDelta, FontLoader, inArray, last, round, HashMap } from '../common';
25
+ elementScale, elementStyles, eventCoordinates, bindEvents, unbindEvents, mousewheelDelta, FontLoader, inArray, last, round,
26
+ HashMap, valueOrDefault } from '../common';
26
27
 
27
28
  import { dateComparer } from '../date-utils';
28
29
 
29
30
  import { DRAG_START, DRAG, DRAG_END, ZOOM_START, ZOOM, ZOOM_END, SELECT_START, SELECT, SELECT_END, PLOT_AREA_HOVER, PLOT_AREA_LEAVE,
30
- RENDER, CATEGORY, PIE, DONUT, FUNNEL, COLUMN, MOUSEWHEEL, MOUSEWHEEL_DELAY, SHOW_TOOLTIP, SERIES_HOVER } from './constants';
31
+ RENDER, CATEGORY, PIE, DONUT, FUNNEL, COLUMN, MOUSEWHEEL, MOUSEWHEEL_DELAY, MOUSEWHEEL_ZOOM_RATE, SHOW_TOOLTIP, SERIES_HOVER } from './constants';
31
32
 
32
33
  import './animations';
33
34
  import './register-charts';
@@ -651,12 +652,13 @@ class Chart extends Class {
651
652
  this._gestureDistance = e.distance;
652
653
  const args = { delta: scaleDelta, axisRanges: axisRanges(this._plotArea.axes), originalEvent: e };
653
654
  if (this._zooming || !this.trigger(ZOOM_START, args)) {
655
+ const coords = this._eventCoordinates(e);
654
656
 
655
657
  if (!this._zooming) {
656
658
  this._zooming = true;
657
659
  }
658
660
 
659
- const ranges = args.axisRanges = mousewheelZoom.updateRanges(scaleDelta);
661
+ const ranges = args.axisRanges = mousewheelZoom.updateRanges(scaleDelta, coords);
660
662
  if (ranges && !this.trigger(ZOOM, args)) {
661
663
  mousewheelZoom.zoom();
662
664
  }
@@ -787,6 +789,12 @@ class Chart extends Class {
787
789
  }
788
790
  }
789
791
 
792
+ _mousewheelZoomRate() {
793
+ const zoomable = this.options.zoomable;
794
+ const mousewheel = (zoomable || {}).mousewheel || {};
795
+ return valueOrDefault(mousewheel.rate, MOUSEWHEEL_ZOOM_RATE);
796
+ }
797
+
790
798
  _mousewheel(e) {
791
799
  const delta = mousewheelDelta(e);
792
800
  const mousewheelZoom = this._mousewheelZoom;
@@ -811,7 +819,7 @@ class Chart extends Class {
811
819
  clearTimeout(this._mwTimeout);
812
820
  }
813
821
 
814
- args.axisRanges = mousewheelZoom.updateRanges(delta);
822
+ args.axisRanges = mousewheelZoom.updateRanges(delta, coords);
815
823
  if (args.axisRanges && !this.trigger(ZOOM, args)) {
816
824
  mousewheelZoom.zoom();
817
825
  }
@@ -844,7 +852,7 @@ class Chart extends Class {
844
852
  const currentAxis = axes[i];
845
853
  const axisName = currentAxis.options.name;
846
854
  if (axisName) {
847
- ranges[axisName] = currentAxis.scaleRange(-totalDelta);
855
+ ranges[axisName] = currentAxis.scaleRange(-totalDelta * this._mousewheelZoomRate(), coords);
848
856
  }
849
857
  }
850
858
 
@@ -1156,8 +1164,9 @@ class Chart extends Class {
1156
1164
  for (let i = 0; i < elements.length; i++) {
1157
1165
  const element = elements[i];
1158
1166
  const currSeries = element.series || series;
1167
+ const shouldHighlight = currSeries && (currSeries.highlight || {}).visible;
1159
1168
 
1160
- if (currSeries && element.visual) {
1169
+ if (shouldHighlight && element.visual) {
1161
1170
  const opacity = series ? series.opacity : element.series.opacity;
1162
1171
  if (currSeries !== activeSeries || reset) {
1163
1172
  element.visual.opacity(reset ? 1 : opacity);
@@ -94,6 +94,7 @@ const OUTSIDE_END = "outsideEnd";
94
94
 
95
95
  const MOUSEWHEEL = "DOMMouseScroll mousewheel";
96
96
  const MOUSEWHEEL_DELAY = 150;
97
+ const MOUSEWHEEL_ZOOM_RATE = 0.3;
97
98
 
98
99
  export {
99
100
  INITIAL_ANIMATION_DURATION, FADEIN,
@@ -115,7 +116,8 @@ export {
115
116
  LOGARITHMIC, DRAG, DRAG_START, DRAG_END, ZOOM_START, ZOOM, ZOOM_END,
116
117
  SELECT_START, SELECT, SELECT_END, PANE_RENDER, GAP,
117
118
  DONUT, INSIDE_END, INSIDE_BASE, OUTSIDE_END,
118
- MOUSEWHEEL, MOUSEWHEEL_DELAY, SHOW_TOOLTIP, HIDE_TOOLTIP,
119
+ MOUSEWHEEL, MOUSEWHEEL_DELAY, MOUSEWHEEL_ZOOM_RATE,
120
+ SHOW_TOOLTIP, HIDE_TOOLTIP,
119
121
  EQUALLY_SPACED_SERIES, ABOVE, BELOW,
120
122
  HEATMAP
121
123
  };
@@ -9,10 +9,12 @@ class MousewheelZoom extends Class {
9
9
  super();
10
10
 
11
11
  this.chart = chart;
12
- this.options = deepExtend({}, this.options, options);
12
+ this.options = deepExtend({
13
+ rate: 0.3
14
+ }, this.options, options);
13
15
  }
14
16
 
15
- updateRanges(delta) {
17
+ updateRanges(delta, coords) {
16
18
  const lock = (this.options.lock || "").toLowerCase();
17
19
  const axisRanges = [];
18
20
  const axes = this.chart._plotArea.axes;
@@ -22,7 +24,7 @@ class MousewheelZoom extends Class {
22
24
  const vertical = axis.options.vertical;
23
25
 
24
26
  if (!(lock === X && !vertical) && !(lock === Y && vertical) && axis.zoomRange) {
25
- const range = axis.zoomRange(-delta);
27
+ const range = axis.zoomRange(-delta * this.options.rate, coords);
26
28
 
27
29
  if (range) {
28
30
  axisRanges.push({
@@ -55,4 +57,4 @@ class MousewheelZoom extends Class {
55
57
  }
56
58
  }
57
59
 
58
- export default MousewheelZoom;
60
+ export default MousewheelZoom;
@@ -4,7 +4,7 @@ import { DateCategoryAxis, Point } from '../core';
4
4
 
5
5
  import { MOUSEWHEEL_DELAY, MOUSEWHEEL, SELECT_START, SELECT, SELECT_END } from './constants';
6
6
 
7
- import { LEFT, RIGHT, MIN_VALUE, MAX_VALUE } from '../common/constants';
7
+ import { LEFT, RIGHT, MIN_VALUE, MAX_VALUE, X } from '../common/constants';
8
8
  import { addClass, Class, removeClass, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
9
9
  import { parseDate } from '../date-utils';
10
10
 
@@ -542,6 +542,45 @@ class Selection extends Class {
542
542
  }
543
543
  }
544
544
 
545
+ zoom(delta, coords) {
546
+ const options = this.options;
547
+ const min = this._index(options.min);
548
+ const max = this._index(options.max);
549
+ const from = this._index(options.from);
550
+ const to = this._index(options.to);
551
+ let range = { from: from, to: to };
552
+ const oldRange = deepExtend({}, range);
553
+
554
+ const { reverse } = this.categoryAxis.options;
555
+ const origin = X + (reverse ? '2' : '1');
556
+ const lineBox = this.categoryAxis.lineBox();
557
+ const relative = Math.abs(lineBox[origin] - coords[X]);
558
+ const size = lineBox.width();
559
+ const position = round(relative / size, 2);
560
+ const minDelta = round(position * delta);
561
+ const maxDelta = round((1 - position) * delta);
562
+
563
+ if (this._state) {
564
+ range = this._state.range;
565
+ }
566
+
567
+ range.from = limitValue(
568
+ limitValue(from - minDelta, 0, to - 1),
569
+ min, max
570
+ );
571
+
572
+ range.to = limitValue(
573
+ limitValue(to + maxDelta, range.from + 1, max),
574
+ min,
575
+ max
576
+ );
577
+
578
+ if (range.from !== oldRange.from || range.to !== oldRange.to) {
579
+ this.set(range.from, range.to);
580
+ return true;
581
+ }
582
+ }
583
+
545
584
  trigger(name, args) {
546
585
  return (this.observer || this.chart).trigger(name, args);
547
586
  }
@@ -1,16 +1,13 @@
1
- import { drawing } from '@progress/kendo-drawing';
2
-
3
1
  export default function mousewheelDelta(e) {
4
2
  let delta = 0;
5
3
 
6
4
  if (e.wheelDelta) {
7
5
  delta = -e.wheelDelta / 120;
8
- delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
6
+ } else if (e.detail) {
7
+ delta = e.detail / 3;
9
8
  }
10
9
 
11
- if (e.detail) {
12
- delta = drawing.util.round(e.detail / 3);
13
- }
10
+ delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
14
11
 
15
12
  return delta;
16
- }
13
+ }
@@ -818,6 +818,45 @@ class Axis extends ChartElement {
818
818
  };
819
819
  }
820
820
 
821
+ lineDir() {
822
+ /*
823
+ * Axis line direction:
824
+ * * Vertical: up.
825
+ * * Horizontal: right.
826
+ */
827
+
828
+ const { vertical, reverse } = this.options;
829
+ return (vertical ? -1 : 1) * (reverse ? -1 : 1);
830
+ }
831
+
832
+ lineInfo() {
833
+ const { vertical } = this.options;
834
+ const lineBox = this.lineBox();
835
+ const lineSize = vertical ? lineBox.height() : lineBox.width();
836
+ const axis = vertical ? Y : X;
837
+ const axisDir = this.lineDir();
838
+ const startEdge = axisDir === 1 ? 1 : 2;
839
+ const axisOrigin = axis + startEdge.toString();
840
+ const lineStart = lineBox[axisOrigin];
841
+
842
+ return {
843
+ axis,
844
+ axisOrigin,
845
+ axisDir,
846
+ lineBox,
847
+ lineSize,
848
+ lineStart
849
+ };
850
+ }
851
+
852
+ pointOffset(point) {
853
+ const { axis, axisDir, axisOrigin, lineBox, lineSize } = this.lineInfo();
854
+ const relative = axisDir > 0 ? point[axis] - lineBox[axisOrigin] : lineBox[axisOrigin] - point[axis];
855
+ const offset = relative / lineSize;
856
+
857
+ return offset;
858
+ }
859
+
821
860
  labelsBetweenTicks() {
822
861
  return !this.options.justified;
823
862
  }