@progress/kendo-charts 1.20.0-dev.202111111633 → 1.20.0-dev.202111251025

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 (33) 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 +2 -1
  4. package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +10 -2
  5. package/dist/es/common/mousewheel-delta.js +12 -0
  6. package/dist/es/core/axis.js +20 -0
  7. package/dist/es/core/category-axis.js +2 -2
  8. package/dist/es/core/date-category-axis.js +2 -1
  9. package/dist/es/core/date-value-axis.js +2 -1
  10. package/dist/es/core/logarithmic-axis.js +2 -1
  11. package/dist/es/core/numeric-axis.js +4 -3
  12. package/dist/es2015/chart/chart.js +2 -1
  13. package/dist/es2015/chart/pan-and-zoom/mousewheel-zoom.js +10 -2
  14. package/dist/es2015/common/mousewheel-delta.js +12 -0
  15. package/dist/es2015/core/axis.js +20 -0
  16. package/dist/es2015/core/category-axis.js +2 -2
  17. package/dist/es2015/core/date-category-axis.js +2 -1
  18. package/dist/es2015/core/date-value-axis.js +2 -1
  19. package/dist/es2015/core/logarithmic-axis.js +2 -1
  20. package/dist/es2015/core/numeric-axis.js +4 -3
  21. package/dist/npm/barcode.d.ts +133 -2
  22. package/dist/npm/core.d.ts +1 -1
  23. package/dist/npm/field-types/border.interface.d.ts +21 -0
  24. package/dist/npm/field-types/dash-type.d.ts +7 -0
  25. package/dist/npm/field-types/margin.interface.d.ts +24 -0
  26. package/dist/npm/field-types/padding.interface.d.ts +7 -0
  27. package/dist/npm/field-types/render-mode.d.ts +8 -0
  28. package/dist/npm/field-types.d.ts +5 -0
  29. package/dist/npm/main.d.ts +1 -0
  30. package/dist/npm/main.js +56 -14
  31. package/dist/npm/qrcode.d.ts +127 -2
  32. package/dist/systemjs/kendo-charts.js +1 -1
  33. package/package.json +2 -2
@@ -1193,8 +1193,9 @@ var Chart = (function (Class) {
1193
1193
  for (var i = 0; i < elements.length; i++) {
1194
1194
  var element = elements[i];
1195
1195
  var currSeries = element.series || series;
1196
+ var shouldHighlight = currSeries && (currSeries.highlight || {}).visible;
1196
1197
 
1197
- if (currSeries && element.visual) {
1198
+ if (shouldHighlight && element.visual) {
1198
1199
  var opacity = series ? series.opacity : element.series.opacity;
1199
1200
  if (currSeries !== activeSeries || reset) {
1200
1201
  element.visual.opacity(reset ? 1 : opacity);
@@ -3,6 +3,13 @@ import toChartAxisRanges from './to-chart-axis-ranges';
3
3
 
4
4
  import { X, Y } from '../../common/constants';
5
5
  import { Class, deepExtend } from '../../common';
6
+ import { limitValue } from '../../drawing-utils';
7
+
8
+ // Limit the zoom rate between 1% and 90% per mousewheel event.
9
+ // At zoom rates close to 100% the axis range quickly becomes 0.
10
+ var MIN_RATE = 0.01;
11
+ var MAX_RATE = 0.9;
12
+ var DEFAULT_RATE = 0.3;
6
13
 
7
14
  var MousewheelZoom = (function (Class) {
8
15
  function MousewheelZoom(chart, options) {
@@ -10,7 +17,7 @@ var MousewheelZoom = (function (Class) {
10
17
 
11
18
  this.chart = chart;
12
19
  this.options = deepExtend({
13
- rate: 0.3
20
+ rate: DEFAULT_RATE
14
21
  }, this.options, options);
15
22
  }
16
23
 
@@ -30,7 +37,8 @@ var MousewheelZoom = (function (Class) {
30
37
  var vertical = axis.options.vertical;
31
38
 
32
39
  if (!(lock === X && !vertical) && !(lock === Y && vertical) && axis.zoomRange) {
33
- var range = axis.zoomRange(-delta * this$1.options.rate, coords);
40
+ var rate = limitValue(this$1.options.rate, MIN_RATE, MAX_RATE);
41
+ var range = axis.zoomRange(-delta * rate, coords);
34
42
 
35
43
  if (range) {
36
44
  axisRanges.push({
@@ -1,8 +1,20 @@
1
+ import { support } from '@progress/kendo-drawing';
2
+
3
+ var browser = support.browser || {};
4
+
1
5
  export default function mousewheelDelta(e) {
2
6
  var delta = 0;
3
7
 
4
8
  if (e.wheelDelta) {
5
9
  delta = -e.wheelDelta / 120;
10
+
11
+ if (browser.webkit) {
12
+ // Webkit browsers scale the delta by twice the device resolution.
13
+ // Possibly related to https://bugs.webkit.org/show_bug.cgi?id=196339
14
+ //
15
+ // Low device resolutions (e.g. zoom-out to 30%) also behave strangely.
16
+ delta = delta / (2 * Math.max(window.devicePixelRatio, 0.625));
17
+ }
6
18
  } else if (e.detail) {
7
19
  delta = e.detail / 3;
8
20
  }
@@ -907,6 +907,26 @@ var Axis = (function (ChartElement) {
907
907
  return offset;
908
908
  };
909
909
 
910
+ // Computes the axis range change (delta) for a given scale factor.
911
+ // The delta is subtracted from the axis range:
912
+ // * delta > 0 reduces the axis range (zoom-in)
913
+ // * delta < 0 expands the axis range (zoom-out)
914
+ Axis.prototype.scaleToDelta = function scaleToDelta (rawScale, range) {
915
+ // Scale >= 1 would result in axis range of 0.
916
+ // Scale <= -1 would reverse the scale direction.
917
+ var MAX_SCALE = 0.999;
918
+ var scale = limitValue(rawScale, -MAX_SCALE, MAX_SCALE);
919
+
920
+ var delta;
921
+ if (scale > 0) {
922
+ delta = range * Math.min(1, scale);
923
+ } else {
924
+ delta = range - (range / (1 + scale));
925
+ }
926
+
927
+ return delta;
928
+ };
929
+
910
930
  Axis.prototype.labelsBetweenTicks = function labelsBetweenTicks () {
911
931
  return !this.options.justified;
912
932
  };
@@ -445,7 +445,8 @@ var CategoryAxis = (function (Axis) {
445
445
  CategoryAxis.prototype.scaleRange = function scaleRange (scale, cursor) {
446
446
  var position = Math.abs(this.pointOffset(cursor));
447
447
  var rangeIndices = this.totalRangeIndices();
448
- var delta = (rangeIndices.max - rangeIndices.min) * Math.min(1, scale);
448
+ var range = rangeIndices.max - rangeIndices.min;
449
+ var delta = this.scaleToDelta(scale, range);
449
450
  var minDelta = position * delta;
450
451
  var maxDelta = (1 - position) * delta;
451
452
  var min = rangeIndices.min + minDelta;
@@ -455,7 +456,6 @@ var CategoryAxis = (function (Axis) {
455
456
  max = min + MIN_CATEGORY_RANGE;
456
457
  }
457
458
 
458
-
459
459
  return {
460
460
  min: min,
461
461
  max: max
@@ -544,7 +544,8 @@ var DateCategoryAxis = (function (CategoryAxis) {
544
544
  var rangeMax = ref.max;
545
545
 
546
546
  var position = Math.abs(this.pointOffset(cursor));
547
- var delta = (rangeMax - rangeMin) * scale;
547
+ var range = rangeMax - rangeMin;
548
+ var delta = this.scaleToDelta(scale, range);
548
549
  var minDelta = Math.round(position * delta);
549
550
  var maxDelta = Math.round((1 - position) * delta);
550
551
 
@@ -180,7 +180,8 @@ var DateValueAxis = (function (Axis) {
180
180
 
181
181
  DateValueAxis.prototype.scaleRange = function scaleRange (scale, cursor) {
182
182
  var position = Math.abs(this.pointOffset(cursor));
183
- var delta = (this.options.max - this.options.min) * Math.min(1, scale);
183
+ var range = this.options.max - this.options.min;
184
+ var delta = this.scaleToDelta(scale, range);
184
185
  var minDelta = position * delta;
185
186
  var maxDelta = (1 - position) * delta;
186
187
  var min = toDate(toTime(this.options.min) + minDelta);
@@ -313,7 +313,8 @@ var LogarithmicAxis = (function (Axis) {
313
313
  var logMin = log(this.options.min, base);
314
314
  var logMax = log(this.options.max, base);
315
315
  var position = Math.abs(this.pointOffset(cursor));
316
- var delta = (logMax - logMin) * Math.min(1, scale);
316
+ var range = logMax - logMin;
317
+ var delta = this.scaleToDelta(scale, range);
317
318
  var min = Math.pow(base, logMin + position * delta);
318
319
  var max = Math.pow(base, logMax - (1 - position) * delta);
319
320
 
@@ -215,11 +215,12 @@ var NumericAxis = (function (Axis) {
215
215
 
216
216
  NumericAxis.prototype.scaleRange = function scaleRange (scale, cursor) {
217
217
  var position = Math.abs(this.pointOffset(cursor));
218
- var delta = (this.options.max - this.options.min) * Math.min(1, scale);
218
+ var range = this.options.max - this.options.min;
219
+ var delta = this.scaleToDelta(scale, range);
219
220
  var minDelta = position * delta;
220
221
  var maxDelta = (1 - position) * delta;
221
- var min = this.options.min + minDelta;
222
- var max = this.options.max - maxDelta;
222
+ var min = round(this.options.min + minDelta, DEFAULT_PRECISION);
223
+ var max = round(this.options.max - maxDelta, DEFAULT_PRECISION);
223
224
 
224
225
  if (max - min < MIN_VALUE_RANGE) {
225
226
  max = min + MIN_VALUE_RANGE;
@@ -1164,8 +1164,9 @@ class Chart extends Class {
1164
1164
  for (let i = 0; i < elements.length; i++) {
1165
1165
  const element = elements[i];
1166
1166
  const currSeries = element.series || series;
1167
+ const shouldHighlight = currSeries && (currSeries.highlight || {}).visible;
1167
1168
 
1168
- if (currSeries && element.visual) {
1169
+ if (shouldHighlight && element.visual) {
1169
1170
  const opacity = series ? series.opacity : element.series.opacity;
1170
1171
  if (currSeries !== activeSeries || reset) {
1171
1172
  element.visual.opacity(reset ? 1 : opacity);
@@ -3,6 +3,13 @@ import toChartAxisRanges from './to-chart-axis-ranges';
3
3
 
4
4
  import { X, Y } from '../../common/constants';
5
5
  import { Class, deepExtend } from '../../common';
6
+ import { limitValue } from '../../drawing-utils';
7
+
8
+ // Limit the zoom rate between 1% and 90% per mousewheel event.
9
+ // At zoom rates close to 100% the axis range quickly becomes 0.
10
+ const MIN_RATE = 0.01;
11
+ const MAX_RATE = 0.9;
12
+ const DEFAULT_RATE = 0.3;
6
13
 
7
14
  class MousewheelZoom extends Class {
8
15
  constructor(chart, options) {
@@ -10,7 +17,7 @@ class MousewheelZoom extends Class {
10
17
 
11
18
  this.chart = chart;
12
19
  this.options = deepExtend({
13
- rate: 0.3
20
+ rate: DEFAULT_RATE
14
21
  }, this.options, options);
15
22
  }
16
23
 
@@ -24,7 +31,8 @@ class MousewheelZoom extends Class {
24
31
  const vertical = axis.options.vertical;
25
32
 
26
33
  if (!(lock === X && !vertical) && !(lock === Y && vertical) && axis.zoomRange) {
27
- const range = axis.zoomRange(-delta * this.options.rate, coords);
34
+ const rate = limitValue(this.options.rate, MIN_RATE, MAX_RATE);
35
+ const range = axis.zoomRange(-delta * rate, coords);
28
36
 
29
37
  if (range) {
30
38
  axisRanges.push({
@@ -1,8 +1,20 @@
1
+ import { support } from '@progress/kendo-drawing';
2
+
3
+ const browser = support.browser || {};
4
+
1
5
  export default function mousewheelDelta(e) {
2
6
  let delta = 0;
3
7
 
4
8
  if (e.wheelDelta) {
5
9
  delta = -e.wheelDelta / 120;
10
+
11
+ if (browser.webkit) {
12
+ // Webkit browsers scale the delta by twice the device resolution.
13
+ // Possibly related to https://bugs.webkit.org/show_bug.cgi?id=196339
14
+ //
15
+ // Low device resolutions (e.g. zoom-out to 30%) also behave strangely.
16
+ delta = delta / (2 * Math.max(window.devicePixelRatio, 0.625));
17
+ }
6
18
  } else if (e.detail) {
7
19
  delta = e.detail / 3;
8
20
  }
@@ -857,6 +857,26 @@ class Axis extends ChartElement {
857
857
  return offset;
858
858
  }
859
859
 
860
+ // Computes the axis range change (delta) for a given scale factor.
861
+ // The delta is subtracted from the axis range:
862
+ // * delta > 0 reduces the axis range (zoom-in)
863
+ // * delta < 0 expands the axis range (zoom-out)
864
+ scaleToDelta(rawScale, range) {
865
+ // Scale >= 1 would result in axis range of 0.
866
+ // Scale <= -1 would reverse the scale direction.
867
+ const MAX_SCALE = 0.999;
868
+ const scale = limitValue(rawScale, -MAX_SCALE, MAX_SCALE);
869
+
870
+ let delta;
871
+ if (scale > 0) {
872
+ delta = range * Math.min(1, scale);
873
+ } else {
874
+ delta = range - (range / (1 + scale));
875
+ }
876
+
877
+ return delta;
878
+ }
879
+
860
880
  labelsBetweenTicks() {
861
881
  return !this.options.justified;
862
882
  }
@@ -410,7 +410,8 @@ class CategoryAxis extends Axis {
410
410
  scaleRange(scale, cursor) {
411
411
  const position = Math.abs(this.pointOffset(cursor));
412
412
  const rangeIndices = this.totalRangeIndices();
413
- const delta = (rangeIndices.max - rangeIndices.min) * Math.min(1, scale);
413
+ const range = rangeIndices.max - rangeIndices.min;
414
+ const delta = this.scaleToDelta(scale, range);
414
415
  const minDelta = position * delta;
415
416
  const maxDelta = (1 - position) * delta;
416
417
  const min = rangeIndices.min + minDelta;
@@ -420,7 +421,6 @@ class CategoryAxis extends Axis {
420
421
  max = min + MIN_CATEGORY_RANGE;
421
422
  }
422
423
 
423
-
424
424
  return {
425
425
  min: min,
426
426
  max: max
@@ -528,7 +528,8 @@ class DateCategoryAxis extends CategoryAxis {
528
528
  const { min: rangeMin, max: rangeMax } = this.dataRange.displayRange();
529
529
 
530
530
  const position = Math.abs(this.pointOffset(cursor));
531
- const delta = (rangeMax - rangeMin) * scale;
531
+ const range = rangeMax - rangeMin;
532
+ const delta = this.scaleToDelta(scale, range);
532
533
  const minDelta = Math.round(position * delta);
533
534
  const maxDelta = Math.round((1 - position) * delta);
534
535
 
@@ -172,7 +172,8 @@ class DateValueAxis extends Axis {
172
172
 
173
173
  scaleRange(scale, cursor) {
174
174
  const position = Math.abs(this.pointOffset(cursor));
175
- const delta = (this.options.max - this.options.min) * Math.min(1, scale);
175
+ const range = this.options.max - this.options.min;
176
+ const delta = this.scaleToDelta(scale, range);
176
177
  const minDelta = position * delta;
177
178
  const maxDelta = (1 - position) * delta;
178
179
  const min = toDate(toTime(this.options.min) + minDelta);
@@ -268,7 +268,8 @@ class LogarithmicAxis extends Axis {
268
268
  const logMin = log(this.options.min, base);
269
269
  const logMax = log(this.options.max, base);
270
270
  const position = Math.abs(this.pointOffset(cursor));
271
- const delta = (logMax - logMin) * Math.min(1, scale);
271
+ const range = logMax - logMin;
272
+ const delta = this.scaleToDelta(scale, range);
272
273
  const min = Math.pow(base, logMin + position * delta);
273
274
  let max = Math.pow(base, logMax - (1 - position) * delta);
274
275
 
@@ -197,11 +197,12 @@ class NumericAxis extends Axis {
197
197
 
198
198
  scaleRange(scale, cursor) {
199
199
  const position = Math.abs(this.pointOffset(cursor));
200
- const delta = (this.options.max - this.options.min) * Math.min(1, scale);
200
+ const range = this.options.max - this.options.min;
201
+ const delta = this.scaleToDelta(scale, range);
201
202
  const minDelta = position * delta;
202
203
  const maxDelta = (1 - position) * delta;
203
- const min = this.options.min + minDelta;
204
- let max = this.options.max - maxDelta;
204
+ const min = round(this.options.min + minDelta, DEFAULT_PRECISION);
205
+ let max = round(this.options.max - maxDelta, DEFAULT_PRECISION);
205
206
 
206
207
  if (max - min < MIN_VALUE_RANGE) {
207
208
  max = min + MIN_VALUE_RANGE;
@@ -1,5 +1,136 @@
1
+ import { Group } from '@progress/kendo-drawing';
2
+ import { Border, Margin, Padding, RenderMode } from './field-types';
3
+
4
+ /**
5
+ * Supported symbologies (encodings) for the Barcode component.
6
+ */
7
+ export type BarcodeType =
8
+ 'EAN8' | 'EAN13' | 'UPCE' | 'UPCA' | 'Code11' | 'Code39' | 'Code39Extended' |
9
+ 'Code93' | 'Code93Extended' | 'Code128' | 'Code128A' | 'Code128B' | 'Code128C' |
10
+ 'GS1-128' | 'MSImod10' | 'MSImod11' | 'MSImod1010' | 'MSImod1110' | 'POSTNET' |
11
+ 'ean8' | 'ean13' | 'upce' | 'upca' | 'code11' | 'code39' | 'code39extended' |
12
+ 'code93' | 'code93extended' | 'code128' | 'code128a' | 'code128b' | 'code128c' |
13
+ 'gs1-128' | 'msimod10' | 'msimod11' | 'msimod1010' | 'msimod1110' | 'postnet';
14
+
15
+ /**
16
+ * The Barcode text label configuration.
17
+ */
18
+ export interface BarcodeText {
19
+ /**
20
+ * The color of the text. Any valid CSS color string will work here, including hex and rgb.
21
+ *
22
+ * @default "black"
23
+ */
24
+ color?: string;
25
+
26
+ /**
27
+ * The font of the text.
28
+ *
29
+ * @default "16px Consolas, Monaco, Sans Mono, monospace, sans-serif"
30
+ */
31
+ font?: string;
32
+
33
+ /**
34
+ * The margin of the text. A numeric value sets all margins.
35
+ *
36
+ * @default 0
37
+ */
38
+ margin?: Margin | number;
39
+
40
+ /**
41
+ * A flag indicating of the Barcode text label is visible.
42
+ *
43
+ * If set to false the barcode will not display the value as a text below the barcode lines.
44
+ *
45
+ * @default true
46
+ */
47
+ visible?: boolean;
48
+ }
49
+
50
+ /**
51
+ * The Barcode configuration options.
52
+ */
53
+ export interface BarcodeOptions {
54
+ /**
55
+ * The background color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
56
+ *
57
+ * @default "white"
58
+ */
59
+ background?: string;
60
+
61
+ /**
62
+ * The border of the Barcode.
63
+ */
64
+ border?: Border;
65
+
66
+ /**
67
+ * If set to `true`, the Barcode will display the checksum digit next to the value in the text area.
68
+ *
69
+ * @default true
70
+ */
71
+ checksum?: boolean;
72
+
73
+ /**
74
+ * The color of the Barcode. Accepts a valid CSS color string, including hex and rgb.
75
+ *
76
+ * @default "black"
77
+ */
78
+ color?: string;
79
+
80
+ /**
81
+ * The height of the Barcode in pixels.
82
+ *
83
+ * @default 100
84
+ */
85
+ height?: number;
86
+
87
+ /**
88
+ * The padding of the barcode. A numeric value sets all paddings.
89
+ *
90
+ * @default 0
91
+ */
92
+ padding?: Padding | number;
93
+
94
+ /**
95
+ * Sets the preferred rendering mode of the Barcode.
96
+ *
97
+ * The supported values are:
98
+ * * "canvas" - renders the component as a Canvas element.
99
+ * * "svg" - renders the component as an inline SVG document.
100
+ *
101
+ * @default "svg"
102
+ */
103
+ renderAs?: RenderMode;
104
+
105
+ /**
106
+ * The Barcode text label configuration.
107
+ */
108
+ text?: BarcodeText;
109
+
110
+ /**
111
+ * The symbology (encoding) the Barcode will use.
112
+ *
113
+ * @default "Code39"
114
+ */
115
+ type: BarcodeType;
116
+
117
+ /**
118
+ * The value of the Barcode.
119
+ */
120
+ value: number | string;
121
+
122
+ /**
123
+ * The width of the Barcode in pixels.
124
+ *
125
+ * @default 300
126
+ */
127
+ width?: number;
128
+ }
129
+
1
130
  export class Barcode {
2
- constructor(element: any, options: any);
131
+ constructor(element: Element, options: BarcodeOptions);
132
+
3
133
  public redraw(): void;
4
- public setOptions(options: any): void;
134
+ public setOptions(options: BarcodeOptions): void;
135
+ public exportVisual(): Group;
5
136
  }
@@ -4,4 +4,4 @@ export class DateCategoryAxis {
4
4
 
5
5
  export class DateValueAxis {
6
6
  public options: any;
7
- }
7
+ }
@@ -0,0 +1,21 @@
1
+ import { DashType } from './dash-type';
2
+
3
+ /**
4
+ * The appearance settings for the border lines.
5
+ */
6
+ export interface Border {
7
+ /**
8
+ * The color of the border line. Accepts a valid CSS color string, including hex and rgb.
9
+ */
10
+ color?: string;
11
+
12
+ /**
13
+ * The dash type of the border line.
14
+ */
15
+ dashType?: DashType;
16
+
17
+ /**
18
+ * The width of the border line in pixels.
19
+ */
20
+ width?: number;
21
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The dash line type.
3
+ */
4
+ export type DashType =
5
+ 'dash' | 'dashDot' | 'dot' |
6
+ 'longDash' | 'longDashDot' | 'longDashDotDot' |
7
+ 'solid';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The margin size for each side.
3
+ */
4
+ export interface Margin {
5
+ /**
6
+ * The top margin in pixels.
7
+ */
8
+ top?: number;
9
+
10
+ /**
11
+ * The right margin in pixels.
12
+ */
13
+ right?: number;
14
+
15
+ /**
16
+ * The bottom margin in pixels.
17
+ */
18
+ bottom?: number;
19
+
20
+ /**
21
+ * The left margin in pixels.
22
+ */
23
+ left?: number;
24
+ }
@@ -0,0 +1,7 @@
1
+ import { Margin } from './margin.interface';
2
+
3
+ /**
4
+ * The padding size for each side.
5
+ */
6
+ export interface Padding extends Margin {
7
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sets the rendering mode of the component.
3
+ *
4
+ * The supported values are:
5
+ * * "canvas" - renders the component as a Canvas element.
6
+ * * "svg" - renders the component as an inline SVG document.
7
+ */
8
+ export type RenderMode = 'svg' | 'canvas';
@@ -0,0 +1,5 @@
1
+ export { Border } from './field-types/border.interface';
2
+ export { DashType } from './field-types/dash-type';
3
+ export { Margin } from './field-types/margin.interface';
4
+ export { Padding } from './field-types/padding.interface';
5
+ export { RenderMode } from './field-types/render-mode';
@@ -7,5 +7,6 @@ export * from './gauges';
7
7
  export * from './barcode';
8
8
  export * from './qrcode';
9
9
  export * from './common';
10
+ export * from './field-types'
10
11
 
11
12
  export function chartBaseTheme(): any;