@progress/kendo-charts 2.7.3-develop.2 → 2.8.0-develop.2

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 (135) hide show
  1. package/dist/cdn/js/kendo-charts.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/barcode/barcode.js +1 -4
  4. package/dist/es/barcode/encodings/code128.js +1 -3
  5. package/dist/es/barcode/encodings/encoding.js +1 -3
  6. package/dist/es/chart/aggregates/aggregates.js +3 -3
  7. package/dist/es/chart/aggregates/default-aggregates.js +1 -5
  8. package/dist/es/chart/aggregates/series-aggregator.js +12 -10
  9. package/dist/es/chart/api-elements/chart-axis.js +1 -5
  10. package/dist/es/chart/api-elements/chart-plotarea.js +1 -5
  11. package/dist/es/chart/axis-group-range-tracker.js +1 -4
  12. package/dist/es/chart/categorical-chart.js +8 -8
  13. package/dist/es/chart/chart.js +9 -8
  14. package/dist/es/chart/error-bars/error-range-calculator.js +2 -4
  15. package/dist/es/chart/highlight.js +1 -5
  16. package/dist/es/chart/line-chart/line-chart.js +2 -2
  17. package/dist/es/chart/line-chart/line-point.js +19 -19
  18. package/dist/es/chart/mixins/accessibility-attributes-mixin.js +3 -4
  19. package/dist/es/chart/mixins/clip-animation-mixin.js +6 -5
  20. package/dist/es/chart/mixins/line-chart-mixin.js +1 -2
  21. package/dist/es/chart/mixins/note-mixin.js +1 -2
  22. package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +2 -4
  23. package/dist/es/chart/pan-and-zoom/pannable.js +2 -4
  24. package/dist/es/chart/pan-and-zoom/zoom-selection.js +2 -4
  25. package/dist/es/chart/plotarea/categorical-plotarea.js +2 -2
  26. package/dist/es/chart/plotarea/plotarea-factory.js +1 -5
  27. package/dist/es/chart/selection.js +2 -4
  28. package/dist/es/chart/series-binder.js +4 -8
  29. package/dist/es/chart/tooltip/base-tooltip.js +2 -4
  30. package/dist/es/common/getter.js +1 -3
  31. package/dist/es/common/grep.js +2 -11
  32. package/dist/es/common/in-array.js +1 -1
  33. package/dist/es/common/observable.js +1 -4
  34. package/dist/es/common/user-events.js +2 -6
  35. package/dist/es/core/box.js +38 -20
  36. package/dist/es/core/category-axis.js +5 -12
  37. package/dist/es/core/chart-element.js +8 -6
  38. package/dist/es/core/curve-processor.js +2 -5
  39. package/dist/es/core/point.js +2 -4
  40. package/dist/es/core/ring.js +2 -5
  41. package/dist/es/core/shape-builder.js +1 -2
  42. package/dist/es/core/utils/element-id.js +5 -0
  43. package/dist/es/core/utils/guid.js +4 -16
  44. package/dist/es/drawing-utils.js +0 -2
  45. package/dist/es/gauges/gauge.js +2 -5
  46. package/dist/es/gauges/pointer.js +2 -4
  47. package/dist/es/map/crs.js +5 -10
  48. package/dist/es/map/extent.js +1 -3
  49. package/dist/es/map/layers/bubble.js +1 -4
  50. package/dist/es/map/layers/layer.js +1 -4
  51. package/dist/es/map/layers/marker.js +1 -3
  52. package/dist/es/map/layers/shape.js +1 -3
  53. package/dist/es/map/layers/tile.js +3 -7
  54. package/dist/es/map/location.js +1 -4
  55. package/dist/es/map/scroller/draggable.js +1 -4
  56. package/dist/es/map/scroller/fx.js +1 -3
  57. package/dist/es/map/scroller/scroller.js +1 -4
  58. package/dist/es/map/tooltip/tooltip.js +2 -4
  59. package/dist/es/qrcode/encodings/data-modes/qr-data-mode.js +1 -4
  60. package/dist/es/qrcode/encodings/encoders/iso-encoder.js +1 -2
  61. package/dist/es/qrcode/encodings/encoders/utf8-encoder.js +1 -4
  62. package/dist/es/qrcode/encodings/encoding-result.js +1 -5
  63. package/dist/es/qrcode/encodings/free-cell-visitor.js +1 -5
  64. package/dist/es/qrcode/qrcode.js +1 -4
  65. package/dist/es/sankey/element.js +1 -3
  66. package/dist/es/stock/navigator-hint.js +2 -4
  67. package/dist/es/stock/navigator.js +2 -4
  68. package/dist/es2015/barcode/barcode.js +1 -4
  69. package/dist/es2015/barcode/encodings/code128.js +1 -3
  70. package/dist/es2015/barcode/encodings/encoding.js +1 -3
  71. package/dist/es2015/chart/aggregates/aggregates.js +3 -3
  72. package/dist/es2015/chart/aggregates/default-aggregates.js +1 -5
  73. package/dist/es2015/chart/aggregates/series-aggregator.js +12 -10
  74. package/dist/es2015/chart/api-elements/chart-axis.js +1 -5
  75. package/dist/es2015/chart/api-elements/chart-plotarea.js +1 -5
  76. package/dist/es2015/chart/axis-group-range-tracker.js +1 -4
  77. package/dist/es2015/chart/categorical-chart.js +8 -8
  78. package/dist/es2015/chart/chart.js +9 -8
  79. package/dist/es2015/chart/error-bars/error-range-calculator.js +2 -4
  80. package/dist/es2015/chart/highlight.js +1 -5
  81. package/dist/es2015/chart/line-chart/line-chart.js +2 -2
  82. package/dist/es2015/chart/line-chart/line-point.js +19 -19
  83. package/dist/es2015/chart/mixins/accessibility-attributes-mixin.js +3 -4
  84. package/dist/es2015/chart/mixins/clip-animation-mixin.js +6 -5
  85. package/dist/es2015/chart/mixins/line-chart-mixin.js +1 -2
  86. package/dist/es2015/chart/mixins/note-mixin.js +1 -2
  87. package/dist/es2015/chart/pan-and-zoom/mousewheel-zoom.js +2 -4
  88. package/dist/es2015/chart/pan-and-zoom/pannable.js +2 -4
  89. package/dist/es2015/chart/pan-and-zoom/zoom-selection.js +2 -4
  90. package/dist/es2015/chart/plotarea/categorical-plotarea.js +2 -2
  91. package/dist/es2015/chart/plotarea/plotarea-factory.js +1 -5
  92. package/dist/es2015/chart/selection.js +2 -4
  93. package/dist/es2015/chart/series-binder.js +4 -8
  94. package/dist/es2015/chart/tooltip/base-tooltip.js +2 -4
  95. package/dist/es2015/common/getter.js +1 -3
  96. package/dist/es2015/common/grep.js +2 -11
  97. package/dist/es2015/common/in-array.js +1 -1
  98. package/dist/es2015/common/observable.js +1 -4
  99. package/dist/es2015/common/user-events.js +2 -6
  100. package/dist/es2015/core/box.js +38 -20
  101. package/dist/es2015/core/category-axis.js +5 -12
  102. package/dist/es2015/core/chart-element.js +8 -6
  103. package/dist/es2015/core/curve-processor.js +2 -5
  104. package/dist/es2015/core/point.js +2 -4
  105. package/dist/es2015/core/ring.js +2 -5
  106. package/dist/es2015/core/shape-builder.js +1 -2
  107. package/dist/es2015/core/utils/element-id.js +5 -0
  108. package/dist/es2015/core/utils/guid.js +4 -16
  109. package/dist/es2015/drawing-utils.js +0 -2
  110. package/dist/es2015/gauges/gauge.js +2 -5
  111. package/dist/es2015/gauges/pointer.js +2 -4
  112. package/dist/es2015/map/crs.js +5 -10
  113. package/dist/es2015/map/extent.js +1 -3
  114. package/dist/es2015/map/layers/bubble.js +1 -4
  115. package/dist/es2015/map/layers/layer.js +1 -4
  116. package/dist/es2015/map/layers/marker.js +1 -3
  117. package/dist/es2015/map/layers/shape.js +1 -3
  118. package/dist/es2015/map/layers/tile.js +3 -7
  119. package/dist/es2015/map/location.js +1 -4
  120. package/dist/es2015/map/scroller/draggable.js +1 -4
  121. package/dist/es2015/map/scroller/fx.js +1 -3
  122. package/dist/es2015/map/scroller/scroller.js +1 -4
  123. package/dist/es2015/map/tooltip/tooltip.js +2 -4
  124. package/dist/es2015/qrcode/encodings/data-modes/qr-data-mode.js +1 -4
  125. package/dist/es2015/qrcode/encodings/encoders/iso-encoder.js +1 -2
  126. package/dist/es2015/qrcode/encodings/encoders/utf8-encoder.js +1 -4
  127. package/dist/es2015/qrcode/encodings/encoding-result.js +1 -5
  128. package/dist/es2015/qrcode/encodings/free-cell-visitor.js +1 -5
  129. package/dist/es2015/qrcode/qrcode.js +1 -4
  130. package/dist/es2015/sankey/element.js +1 -3
  131. package/dist/es2015/stock/navigator-hint.js +2 -4
  132. package/dist/es2015/stock/navigator.js +2 -4
  133. package/dist/npm/main.js +6378 -6892
  134. package/dist/systemjs/kendo-charts.js +1 -1
  135. package/package.json +1 -1
@@ -7,19 +7,22 @@ import NoteMixin from '../mixins/note-mixin';
7
7
  import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, BORDER_BRIGHTNESS, TOOLTIP_OFFSET, ABOVE, BELOW, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
8
8
 
9
9
  import { WHITE, CIRCLE, CENTER, TOP, BOTTOM, LEFT, HIGHLIGHT_ZINDEX } from '../../common/constants';
10
- import { deepExtend, defined, getTemplate, getAriaTemplate, valueOrDefault, getSpacing } from '../../common';
11
- import guid from '../../core/utils/guid';
10
+ import { deepExtend, getTemplate, getAriaTemplate, valueOrDefault, getSpacing } from '../../common';
11
+ import elementId from '../../core/utils/element-id';
12
12
  import unclipBox from '../utils/unclip-box';
13
13
 
14
14
  class LinePoint extends ChartElement {
15
15
  constructor(value, options) {
16
- super();
16
+ super(options);
17
17
 
18
18
  this.value = value;
19
- this.options = Object.assign({}, options);
20
19
  this.aboveAxis = valueOrDefault(this.options.aboveAxis, true);
21
20
  this.tooltipTracking = true;
22
- this._id = guid();
21
+ this._id = elementId();
22
+ }
23
+
24
+ initOptions(options) {
25
+ this.options = Object.assign({}, options);
23
26
  }
24
27
 
25
28
  render() {
@@ -56,15 +59,13 @@ class LinePoint extends ChartElement {
56
59
 
57
60
  createLabelElement(options) {
58
61
  return new TextBox(this.getLabelText(options),
59
- deepExtend({
60
- align: CENTER,
62
+ Object.assign({}, {align: CENTER,
61
63
  vAlign: CENTER,
62
- margin: {
63
- left: 5,
64
- right: 5
65
- },
66
- zIndex: valueOrDefault(options.zIndex, this.series.zIndex)
67
- }, options),
64
+ zIndex: valueOrDefault(options.zIndex, this.series.zIndex)},
65
+ options,
66
+ {margin: Object.assign({}, {left: 5,
67
+ right: 5},
68
+ options.margin)}),
68
69
  this.pointData()
69
70
  );
70
71
  }
@@ -95,9 +96,9 @@ class LinePoint extends ChartElement {
95
96
  markerBorder() {
96
97
  const options = this.options.markers;
97
98
  const background = options.background;
98
- const border = deepExtend({ color: this.color }, options.border);
99
+ const border = Object.assign({}, {color: this.color}, options.border);
99
100
 
100
- if (!defined(border.color)) {
101
+ if (border.color === undefined) {
101
102
  border.color = new Color(background).brightness(BORDER_BRIGHTNESS).toHex();
102
103
  }
103
104
 
@@ -120,9 +121,8 @@ class LinePoint extends ChartElement {
120
121
  zIndex: valueOrDefault(options.zIndex, this.series.zIndex),
121
122
  animation: options.animation,
122
123
  visual: options.visual,
123
- accessibilityOptions: deepExtend({
124
- ariaLabel: this.getAriaLabelText(this.options.labels)
125
- }, this.options.accessibility)
124
+ accessibilityOptions: Object.assign({}, {ariaLabel: this.getAriaLabelText(this.options.labels)},
125
+ this.options.accessibility)
126
126
  }, {
127
127
  dataItem: this.dataItem,
128
128
  value: this.value,
@@ -370,7 +370,7 @@ class LinePoint extends ChartElement {
370
370
  }
371
371
 
372
372
  getIndex() {
373
- return defined(this.categoryIx) ? this.categoryIx : this.pointIx;
373
+ return this.categoryIx !== undefined ? this.categoryIx : this.pointIx;
374
374
  }
375
375
  }
376
376
 
@@ -1,14 +1,13 @@
1
1
  import addAccessibilityAttributesToVisual from "../../core/utils/add-accessibility-attributes-to-visual";
2
- import { deepExtend, getAriaTemplate } from "../../common";
2
+ import { getAriaTemplate } from "../../common";
3
3
  import guid from '../../core/utils/guid';
4
4
 
5
5
  const AccessibilityAttributesMixin = {
6
6
  addAccessibilityAttributesToVisual: function() {
7
7
  this._id = this._id || guid();
8
8
 
9
- const accessibilityOptions = deepExtend({
10
- ariaLabel: this.getAriaLabelText()
11
- }, this.options.accessibility);
9
+ const accessibilityOptions = Object.assign({}, {ariaLabel: this.getAriaLabelText()},
10
+ this.options.accessibility);
12
11
 
13
12
  addAccessibilityAttributesToVisual(this.visual, accessibilityOptions);
14
13
  },
@@ -7,13 +7,14 @@ import { defined } from '../../common';
7
7
  const ClipAnimationMixin = {
8
8
  createAnimation: function() {
9
9
  const root = this.getRoot();
10
- if (root && (root.options || {}).transitions !== false) {
11
- const box = root.size();
10
+ const transitions = ((root && root.options) || {}).transitions;
11
+ if (root && transitions !== false) {
12
+ const box = (this.parent && this.parent.clipBox) || root.size();
12
13
  const clipPath = draw.Path.fromRect(box.toRect());
14
+ const loading = (transitions && transitions !== true) ? transitions.loading : transitions;
13
15
  this.visual.clip(clipPath);
14
- this.animation = new ClipAnimation(clipPath, {
15
- box: box
16
- });
16
+ this.animation = new ClipAnimation(clipPath, Object.assign({}, {box: box},
17
+ loading));
17
18
  if (anyHasZIndex(this.options.series)) {
18
19
  this._setChildrenAnimation(clipPath);
19
20
  }
@@ -2,7 +2,6 @@ import { ZERO, INTERPOLATE } from '../constants';
2
2
 
3
3
  import { Point } from '../../core';
4
4
  import { MAX_VALUE } from '../../common/constants';
5
- import { defined } from '../../common';
6
5
 
7
6
  const LineChartMixin = {
8
7
  renderSegments: function() {
@@ -70,7 +69,7 @@ const LineChartMixin = {
70
69
  for (let i = 0; i < allPoints.length; i++) {
71
70
  const point = allPoints[i];
72
71
 
73
- if (point && defined(point.value) && point.value !== null && point.visible !== false) {
72
+ if (point && point.value !== undefined && point.value !== null && point.visible !== false) {
74
73
  const pointBox = point.box;
75
74
  const pointDistance = pointBox.center().distanceTo(target);
76
75
 
@@ -1,12 +1,11 @@
1
1
  import { Note } from '../../core';
2
- import { defined } from '../../common';
3
2
 
4
3
  const NoteMixin = {
5
4
  createNote: function() {
6
5
  const options = this.options.notes;
7
6
  const text = this.noteText || options.label.text;
8
7
 
9
- if (options.visible !== false && defined(text) && text !== null) {
8
+ if (options.visible !== false && text !== undefined && text !== null) {
10
9
  this.note = new Note({
11
10
  value: this.value,
12
11
  text: text,
@@ -2,7 +2,7 @@
2
2
  import toChartAxisRanges from './to-chart-axis-ranges';
3
3
 
4
4
  import { X, Y } from '../../common/constants';
5
- import { Class, deepExtend } from '../../common';
5
+ import { deepExtend } from '../../common';
6
6
  import { limitValue } from '../../drawing-utils';
7
7
 
8
8
  // Limit the zoom rate between 1% and 90% per mousewheel event.
@@ -11,10 +11,8 @@ const MIN_RATE = 0.01;
11
11
  const MAX_RATE = 0.9;
12
12
  const DEFAULT_RATE = 0.3;
13
13
 
14
- class MousewheelZoom extends Class {
14
+ class MousewheelZoom {
15
15
  constructor(chart, options) {
16
- super();
17
-
18
16
  this.chart = chart;
19
17
  this.options = deepExtend({
20
18
  rate: DEFAULT_RATE
@@ -2,12 +2,10 @@ import acceptKey from './accept-key';
2
2
  import toChartAxisRanges from './to-chart-axis-ranges';
3
3
 
4
4
  import { X, Y } from '../../common/constants';
5
- import { Class, deepExtend } from '../../common';
5
+ import { deepExtend } from '../../common';
6
6
 
7
- class Pannable extends Class {
7
+ class Pannable {
8
8
  constructor(plotArea, options) {
9
- super();
10
-
11
9
  this.plotArea = plotArea;
12
10
  this.options = deepExtend({}, this.options, options);
13
11
  }
@@ -2,12 +2,10 @@ import acceptKey from './accept-key';
2
2
  import toChartAxisRanges from './to-chart-axis-ranges';
3
3
 
4
4
  import { X, Y } from '../../common/constants';
5
- import { Class, deepExtend, elementStyles, elementOffset, defined } from '../../common';
5
+ import { deepExtend, elementStyles, elementOffset, defined } from '../../common';
6
6
 
7
- class ZoomSelection extends Class {
7
+ class ZoomSelection {
8
8
  constructor(chart, options) {
9
- super();
10
-
11
9
  this.chart = chart;
12
10
  this.options = deepExtend({}, this.options, options);
13
11
  this.createElement();
@@ -288,11 +288,11 @@ class CategoricalPlotArea extends PlotAreaBase {
288
288
  category = parseDateCategory(category, srcData[idx], this.chartService.intl);
289
289
  }
290
290
 
291
- if (!defined(category)) {
291
+ if (category === undefined) {
292
292
  category = srcCategories[idx];
293
293
  }
294
294
 
295
- if (defined(category) && category !== null) {
295
+ if (category !== undefined && category !== null) {
296
296
  const categoryIx = categoryAxis.totalIndex(category);
297
297
  result[categoryIx] = result[categoryIx] || { items: [], category: category };
298
298
  result[categoryIx].items.push(idx);
@@ -1,12 +1,8 @@
1
1
  import filterSeriesByType from '../utils/filter-series-by-type';
2
- import { Class } from '../../common';
3
2
  import { TRENDLINE_SERIES } from '../constants';
4
3
 
5
- class PlotAreaFactory extends Class {
6
-
4
+ class PlotAreaFactory {
7
5
  constructor() {
8
- super();
9
-
10
6
  this._registry = [];
11
7
  }
12
8
 
@@ -5,7 +5,7 @@ import { DateCategoryAxis, Point } from '../core';
5
5
  import { MOUSEWHEEL_DELAY, MOUSEWHEEL, SELECT_START, SELECT, SELECT_END } from './constants';
6
6
 
7
7
  import { LEFT, RIGHT, MIN_VALUE, MAX_VALUE, X } from '../common/constants';
8
- import { addClass, Class, removeClass, eventCoordinates, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
8
+ import { addClass, removeClass, eventCoordinates, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
9
9
  import { parseDate } from '../date-utils';
10
10
 
11
11
  const ZOOM_ACCELERATION = 3;
@@ -29,10 +29,8 @@ function closestHandle(element) {
29
29
  return current;
30
30
  }
31
31
 
32
- class Selection extends Class {
32
+ class Selection {
33
33
  constructor(chart, categoryAxis, options, observer) {
34
- super();
35
-
36
34
  const chartElement = chart.element;
37
35
 
38
36
  this.options = deepExtend({}, this.options, options);
@@ -1,12 +1,8 @@
1
1
  import getField from './utils/get-field';
2
2
  import { VALUE } from '../common/constants';
3
- import { Class, defined } from '../common';
4
-
5
- class SeriesBinder extends Class {
6
3
 
4
+ class SeriesBinder {
7
5
  constructor() {
8
- super();
9
-
10
6
  this._valueFields = {};
11
7
  this._otherFields = {};
12
8
  this._nullValue = {};
@@ -39,7 +35,7 @@ class SeriesBinder extends Class {
39
35
 
40
36
  bindPoint(series, pointIx, item) {
41
37
  const data = series.data;
42
- const pointData = defined(item) ? item : data[pointIx];
38
+ const pointData = item !== undefined ? item : data[pointIx];
43
39
  const result = { valueFields: { value: pointData } };
44
40
  const valueFields = this.valueFields(series);
45
41
  const otherFields = this._otherFields[series.type];
@@ -47,7 +43,7 @@ class SeriesBinder extends Class {
47
43
 
48
44
  if (pointData === null) {
49
45
  value = this._nullValue[series.type];
50
- } else if (!defined(pointData)) {
46
+ } else if (pointData === undefined) {
51
47
  value = this._undefinedValue[series.type];
52
48
  } else if (Array.isArray(pointData)) {
53
49
  const fieldData = pointData.slice(valueFields.length);
@@ -61,7 +57,7 @@ class SeriesBinder extends Class {
61
57
  fields = this._bindFromObject(pointData, otherFields, srcPointFields);
62
58
  }
63
59
 
64
- if (defined(value)) {
60
+ if (value !== undefined) {
65
61
  if (valueFields.length === 1) {
66
62
  result.valueFields.value = value[valueFields[0]];
67
63
  } else {
@@ -1,12 +1,10 @@
1
1
  import { Color } from '@progress/kendo-drawing';
2
2
 
3
- import { Class, defined, deepExtend, setDefaultOptions, valueOrDefault, getSpacing, styleValue } from '../../common';
3
+ import { defined, deepExtend, setDefaultOptions, valueOrDefault, getSpacing, styleValue } from '../../common';
4
4
  import { SHOW_TOOLTIP, HIDE_TOOLTIP } from '../constants';
5
5
 
6
- class BaseTooltip extends Class {
6
+ class BaseTooltip {
7
7
  constructor(chartService, options) {
8
- super();
9
-
10
8
  this.chartService = chartService;
11
9
  this.options = deepExtend({}, this.options, options);
12
10
  }
@@ -1,5 +1,3 @@
1
- import { drawing } from '@progress/kendo-drawing';
2
-
3
1
  const FIELD_REGEX = /\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;
4
2
  const getterCache = {};
5
3
 
@@ -14,7 +12,7 @@ export default function getter(field) {
14
12
 
15
13
  const fields = [];
16
14
  field.replace(FIELD_REGEX, function(match, index, indexAccessor, field) {
17
- fields.push(drawing.util.defined(index) ? index : (indexAccessor || field));
15
+ fields.push(index !== undefined ? index : (indexAccessor || field));
18
16
  });
19
17
 
20
18
  getterCache[field] = function(obj) {
@@ -1,11 +1,2 @@
1
- export default function grep(array, callback) {
2
- const length = array.length;
3
- const result = [];
4
- for (let idx = 0; idx < length; idx++) {
5
- if (callback(array[idx])) {
6
- result .push(array[idx]);
7
- }
8
- }
9
-
10
- return result;
11
- }
1
+ const grep = (array, callback) => array.filter(callback);
2
+ export default grep;
@@ -1,5 +1,5 @@
1
1
  export default function inArray(value, array) {
2
2
  if (array) {
3
- return array.indexOf(value) !== -1;
3
+ return array.includes(value);
4
4
  }
5
5
  }
@@ -1,5 +1,3 @@
1
- import { Class } from '../drawing-utils';
2
-
3
1
  const STRING = "string";
4
2
  const FUNCTION = "function";
5
3
 
@@ -11,9 +9,8 @@ let isDefaultPrevented = function() {
11
9
  return this._defaultPrevented === true;
12
10
  };
13
11
 
14
- export default class Observable extends Class {
12
+ export default class Observable {
15
13
  constructor() {
16
- super();
17
14
  this._events = {};
18
15
  }
19
16
 
@@ -1,4 +1,3 @@
1
- import { Class } from '../drawing-utils';
2
1
  import { applyEventMap, eventMap } from './event-map';
3
2
  import { on, off } from './event-utils';
4
3
  import getSupportedFeatures from './get-supported-features';
@@ -83,9 +82,8 @@ function getTouches(e) {
83
82
 
84
83
  return touches;
85
84
  }
86
- class TouchAxis extends Class {
85
+ class TouchAxis {
87
86
  constructor(axis, location) {
88
- super();
89
87
  let that = this;
90
88
 
91
89
  that.support = getSupportedFeatures();
@@ -124,10 +122,8 @@ class TouchAxis extends Class {
124
122
  }
125
123
  }
126
124
 
127
- class Touch extends Class {
125
+ class Touch {
128
126
  constructor(userEvents, target, touchInfo) {
129
- super();
130
-
131
127
  extend(this, {
132
128
  x: new TouchAxis('X', touchInfo.location),
133
129
  y: new TouchAxis('Y', touchInfo.location),
@@ -2,13 +2,11 @@ import { geometry as geom } from '@progress/kendo-drawing';
2
2
 
3
3
  import Point from './point';
4
4
 
5
- import { X, Y, TOP, BOTTOM, LEFT, RIGHT, CENTER, WIDTH, HEIGHT } from '../common/constants';
6
- import { Class, defined, getSpacing, inArray, isArray, rad } from '../common';
5
+ import { X, Y, TOP, BOTTOM, LEFT, RIGHT, CENTER } from '../common/constants';
6
+ import { getSpacing, isArray, rad } from '../common';
7
7
 
8
- class Box extends Class {
8
+ class Box {
9
9
  constructor(x1, y1, x2, y2) {
10
- super();
11
-
12
10
  this.x1 = x1 || 0;
13
11
  this.y1 = y1 || 0;
14
12
  this.x2 = x2 || 0;
@@ -41,12 +39,12 @@ class Box extends Class {
41
39
  const height = this.height();
42
40
  const width = this.width();
43
41
 
44
- if (defined(x)) {
42
+ if (x !== undefined) {
45
43
  this.x1 = x;
46
44
  this.x2 = this.x1 + width;
47
45
  }
48
46
 
49
- if (defined(y)) {
47
+ if (y !== undefined) {
50
48
  this.y1 = y;
51
49
  this.y2 = this.y1 + height;
52
50
  }
@@ -217,20 +215,40 @@ class Box extends Class {
217
215
  }
218
216
 
219
217
  align(targetBox, axis, alignment) {
220
- const c1 = axis + 1;
221
- const c2 = axis + 2;
222
- const sizeFunc = axis === X ? WIDTH : HEIGHT;
223
- const size = this[sizeFunc]();
224
-
225
- if (inArray(alignment, [ LEFT, TOP ])) {
226
- this[c1] = targetBox[c1];
227
- this[c2] = this[c1] + size;
228
- } else if (inArray(alignment, [ RIGHT, BOTTOM ])) {
229
- this[c2] = targetBox[c2];
230
- this[c1] = this[c2] - size;
218
+ if (axis === X) {
219
+ this.alignX(targetBox, alignment);
220
+ } else {
221
+ this.alignY(targetBox, alignment);
222
+ }
223
+
224
+ return this;
225
+ }
226
+
227
+ alignX(targetBox, alignment) {
228
+ const width = this.width();
229
+ if (alignment === LEFT) {
230
+ this.x1 = targetBox.x1;
231
+ this.x2 = this.x1 + width;
232
+ } else if (alignment === RIGHT) {
233
+ this.x2 = targetBox.x2;
234
+ this.x1 = this.x2 - width;
231
235
  } else if (alignment === CENTER) {
232
- this[c1] = targetBox[c1] + (targetBox[sizeFunc]() - size) / 2;
233
- this[c2] = this[c1] + size;
236
+ this.x1 = targetBox.x1 + (targetBox.width() - width) / 2;
237
+ this.x2 = this.x1 + width;
238
+ }
239
+ }
240
+
241
+ alignY(targetBox, alignment) {
242
+ const height = this.height();
243
+ if (alignment === TOP) {
244
+ this.y1 = targetBox.y1;
245
+ this.y2 = this.y1 + height;
246
+ } else if (alignment === BOTTOM) {
247
+ this.y2 = targetBox.y2;
248
+ this.y1 = this.y2 - height;
249
+ } else if (alignment === CENTER) {
250
+ this.y1 = targetBox.y1 + (targetBox.height() - height) / 2;
251
+ this.y2 = this.y1 + height;
234
252
  }
235
253
  }
236
254
  }
@@ -2,7 +2,7 @@ import Axis from './axis';
2
2
  import AxisLabel from './axis-label';
3
3
 
4
4
  import { BLACK, COORD_PRECISION, DEFAULT_PRECISION, X, Y } from '../common/constants';
5
- import { defined, isNumber, last, limitValue, round, setDefaultOptions, valueOrDefault, HashMap } from '../common';
5
+ import { isNumber, last, limitValue, round, setDefaultOptions, valueOrDefault, HashMap } from '../common';
6
6
  import { dateEquals } from '../date-utils';
7
7
 
8
8
  const MIN_CATEGORY_POINTS_RANGE = 0.01;
@@ -10,14 +10,7 @@ const MIN_CATEGORY_RANGE = 0.1;
10
10
 
11
11
  function indexOf(value, arr) {
12
12
  if (value instanceof Date) {
13
- const length = arr.length;
14
- for (let idx = 0; idx < length; idx++) {
15
- if (dateEquals(arr[idx], value)) {
16
- return idx;
17
- }
18
- }
19
-
20
- return -1;
13
+ return arr.findIndex((item) => dateEquals(item, value));
21
14
  }
22
15
 
23
16
  return arr.indexOf(value);
@@ -43,8 +36,8 @@ class CategoryAxis extends Axis {
43
36
 
44
37
  initUserOptions(options) {
45
38
  const categories = options.categories || [];
46
- const definedMin = defined(options.min);
47
- const definedMax = defined(options.max);
39
+ const definedMin = options.min !== undefined;
40
+ const definedMax = options.max !== undefined;
48
41
  options.srcCategories = options.categories = categories;
49
42
 
50
43
  if ((definedMin || definedMax) && categories.length) {
@@ -259,7 +252,7 @@ class CategoryAxis extends Axis {
259
252
  const { axis: valueAxis, lineStart } = this.lineInfo();
260
253
 
261
254
  const slotBox = box.clone();
262
- const singleSlot = !defined(to);
255
+ const singleSlot = to === undefined;
263
256
 
264
257
  const start = valueOrDefault(from, 0);
265
258
  let end = valueOrDefault(to, start);
@@ -1,14 +1,16 @@
1
1
  import { drawing as draw } from '@progress/kendo-drawing';
2
2
 
3
3
  import { WHITE } from '../common/constants';
4
- import { Class, deepExtend, defined, valueOrDefault, autoTextColor } from '../common';
4
+ import { deepExtend, valueOrDefault, autoTextColor } from '../common';
5
5
 
6
- class ChartElement extends Class {
6
+ class ChartElement {
7
7
  constructor(options) {
8
- super();
9
-
10
8
  this.children = [];
11
9
 
10
+ this.initOptions(options);
11
+ }
12
+
13
+ initOptions(options) {
12
14
  this.options = deepExtend({}, this.options, this.initUserOptions(options));
13
15
  }
14
16
 
@@ -137,7 +139,7 @@ class ChartElement extends Class {
137
139
 
138
140
  if (childVisual.options.noclip) {
139
141
  this.clipRoot().visual.append(childVisual);
140
- } else if (defined(childVisual.options.zIndex)) {
142
+ } else if (childVisual.options.zIndex !== undefined) {
141
143
  this.stackRoot().stackVisual(childVisual);
142
144
  } else if (this.isStackRoot) {
143
145
  this.stackVisual(childVisual);
@@ -261,7 +263,7 @@ class ChartElement extends Class {
261
263
  highlight = this._highlight = this.createHighlight(highlightOptions);
262
264
  }
263
265
 
264
- if (!defined(highlight.options.zIndex)) {
266
+ if (highlight.options.zIndex === undefined) {
265
267
  highlight.options.zIndex = valueOrDefault(options.zIndex, this.options.zIndex);
266
268
  }
267
269
 
@@ -1,16 +1,13 @@
1
1
  import { geometry as geom } from '@progress/kendo-drawing';
2
2
 
3
3
  import { X, Y } from '../common/constants';
4
- import { Class, last, round } from '../common';
4
+ import { last, round } from '../common';
5
5
 
6
6
  const WEIGHT = 0.333;
7
7
  const EXTREMUM_ALLOWED_DEVIATION = 0.01;
8
8
 
9
- class CurveProcessor extends Class {
10
-
9
+ class CurveProcessor {
11
10
  constructor(closed) {
12
- super();
13
-
14
11
  this.closed = closed;
15
12
  }
16
13
 
@@ -1,10 +1,8 @@
1
1
  import { COORD_PRECISION } from '../common/constants';
2
- import { Class, rad, round } from '../common';
2
+ import { rad, round } from '../common';
3
3
 
4
- class Point extends Class {
4
+ class Point {
5
5
  constructor(x, y) {
6
- super();
7
-
8
6
  this.x = x || 0;
9
7
  this.y = y || 0;
10
8
  }
@@ -1,13 +1,10 @@
1
1
  import Box from './box';
2
2
  import Point from './point';
3
3
  import { COORD_PRECISION, MAX_VALUE, MIN_VALUE } from '../common/constants';
4
- import { Class, clockwise, rad, round } from '../common';
5
-
6
- class Ring extends Class {
4
+ import { clockwise, rad, round } from '../common';
7
5
 
6
+ class Ring {
8
7
  constructor(center, innerRadius, radius, startAngle, angle) {
9
- super();
10
-
11
8
  this.center = center;
12
9
  this.innerRadius = innerRadius;
13
10
  this.radius = radius;
@@ -1,9 +1,8 @@
1
1
  import { geometry as geom, drawing as draw } from '@progress/kendo-drawing';
2
- import { Class } from '../common';
3
2
 
4
3
  const DIRECTION_ANGLE = 0.001; //any value that will make the endAngle bigger than the start angle will work here.
5
4
 
6
- class ShapeBuilder extends Class {
5
+ class ShapeBuilder {
7
6
  createRing(sector, options) {
8
7
  const startAngle = sector.startAngle + 180;
9
8
  let endAngle = sector.angle + startAngle;
@@ -0,0 +1,5 @@
1
+ let elId = 1;
2
+
3
+ export default function elementId() {
4
+ return "kchart" + elId++;
5
+ }