@devexperts/dxcharts-lite 2.0.2 → 2.1.0

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/chart/__tests__/chart.test.d.ts +6 -0
  3. package/dist/chart/__tests__/chart.test.js +51 -0
  4. package/dist/chart/__tests__/env.d.ts +5 -0
  5. package/dist/chart/__tests__/env.js +28 -0
  6. package/dist/chart/bootstrap.js +2 -2
  7. package/dist/chart/chart.config.d.ts +4 -1
  8. package/dist/chart/chart.config.js +1 -1
  9. package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
  10. package/dist/chart/components/chart/chart.component.js +13 -3
  11. package/dist/chart/components/chart/chart.model.d.ts +2 -2
  12. package/dist/chart/components/chart/chart.model.js +9 -7
  13. package/dist/chart/components/cross_tool/cross-tool.component.d.ts +2 -1
  14. package/dist/chart/components/cross_tool/cross-tool.component.js +4 -3
  15. package/dist/chart/components/cross_tool/cross-tool.model.js +1 -0
  16. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +3 -1
  17. package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +3 -2
  18. package/dist/chart/components/dynamic-objects/dynamic-objects.component.js +1 -1
  19. package/dist/chart/components/dynamic-objects/dynamic-objects.model.d.ts +30 -10
  20. package/dist/chart/components/dynamic-objects/dynamic-objects.model.js +119 -57
  21. package/dist/chart/components/grid/grid.drawer.js +3 -1
  22. package/dist/chart/components/pane/extent/y-extent-component.js +2 -1
  23. package/dist/chart/components/pane/pane-hit-test.controller.js +2 -2
  24. package/dist/chart/components/volumes/volumes.component.d.ts +3 -0
  25. package/dist/chart/components/volumes/volumes.component.js +21 -4
  26. package/dist/chart/components/volumes/volumes.model.d.ts +2 -0
  27. package/dist/chart/components/volumes/volumes.model.js +2 -0
  28. package/dist/chart/components/x_axis/x-axis.component.js +2 -2
  29. package/dist/chart/components/y_axis/label-color.functions.d.ts +2 -1
  30. package/dist/chart/components/y_axis/label-color.functions.js +17 -0
  31. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +2 -2
  32. package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +27 -25
  33. package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +24 -13
  34. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +3 -3
  35. package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +58 -40
  36. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +3 -3
  37. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +15 -13
  38. package/dist/chart/components/y_axis/y-axis-scale.handler.js +1 -1
  39. package/dist/chart/components/y_axis/y-axis.component.d.ts +2 -1
  40. package/dist/chart/components/y_axis/y-axis.component.js +6 -2
  41. package/dist/chart/drawers/ht-data-series.drawer.js +1 -1
  42. package/dist/chart/inputhandlers/hover-producer.component.d.ts +1 -1
  43. package/dist/chart/inputhandlers/hover-producer.component.js +7 -7
  44. package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +2 -2
  45. package/dist/chart/inputlisteners/canvas-input-listener.component.js +9 -18
  46. package/dist/chart/model/candle-series.model.d.ts +1 -1
  47. package/dist/chart/model/candle-series.model.js +2 -2
  48. package/dist/chart/model/compare-series-hover.d.ts +2 -1
  49. package/dist/chart/model/compare-series-hover.js +1 -0
  50. package/dist/chart/model/data-series.model.d.ts +3 -2
  51. package/dist/chart/model/data-series.model.js +2 -1
  52. package/dist/chart/model/main-candle-series.model.d.ts +1 -1
  53. package/dist/chart/model/main-candle-series.model.js +2 -2
  54. package/dist/chart/model/scale.model.d.ts +2 -0
  55. package/dist/chart/model/scale.model.js +11 -2
  56. package/dist/chart/utils/dom.utils.d.ts +7 -0
  57. package/dist/chart/utils/dom.utils.js +12 -0
  58. package/dist/chart/utils/linkedList.utils.d.ts +3 -3
  59. package/dist/chart/utils/linkedList.utils.js +55 -57
  60. package/dist/dxchart.min.js +4 -4
  61. package/dist/index.d.ts +2 -1
  62. package/dist/index.js +2 -8
  63. package/package.json +7 -4
@@ -19,102 +19,100 @@ export class LinkedList {
19
19
  this._tail = null;
20
20
  this.length = 0;
21
21
  this._head = head !== null && head !== void 0 ? head : null;
22
- // init tail
23
22
  if (this.head !== null) {
24
- let current;
25
- current = this.head;
23
+ // init tail
24
+ let current = this.head;
26
25
  while (current.next) {
27
26
  current = current.next;
28
27
  }
29
28
  this._tail = current;
29
+ this.length++;
30
30
  }
31
31
  }
32
32
  insertAtEnd(data) {
33
33
  const node = new ListNode(data);
34
- let current;
35
34
  if (this.head === null) {
36
35
  this._head = node;
37
36
  }
38
37
  else {
39
- current = this.head;
38
+ let current = this.head;
39
+ // iterate till the end of the list
40
40
  while (current.next) {
41
41
  current = current.next;
42
42
  }
43
+ // insert the node at the end
43
44
  current.next = node;
44
45
  }
45
46
  this._tail = node;
46
47
  this.length++;
47
- return node;
48
48
  }
49
49
  insertAt(position, data) {
50
- if (position > -1 && position < this.length && this.head) {
50
+ // falsy cases
51
+ if (!this.head || position < 0 || position > this.length) {
52
+ return null;
53
+ }
54
+ const node = new ListNode(data);
55
+ // if position === 0 it means that we need to insert the node in the head
56
+ if (position === 0) {
57
+ node.next = this.head;
58
+ this._head = node;
59
+ }
60
+ else {
51
61
  let current = this.head;
62
+ let previous = current;
52
63
  let index = 0;
53
- let previous = null;
54
- const node = new ListNode(data);
64
+ // iterate till the index === position
65
+ while (current && index < position) {
66
+ index++;
67
+ previous = current;
68
+ current = current.next;
69
+ }
70
+ // insert an element
71
+ node.next = current;
72
+ previous.next = node;
73
+ // update tail
55
74
  if (position === this.length - 1) {
56
75
  this._tail = node;
57
76
  }
58
- if (position === 0) {
59
- node.next = current;
60
- this._head = node;
61
- }
62
- else {
63
- while (index < position && current.next) {
64
- index++;
65
- previous = current;
66
- current = current.next;
67
- }
68
- node.next = current;
69
- if (previous) {
70
- previous.next = node;
71
- }
72
- }
73
- this.length++;
74
- return current;
75
- }
76
- else {
77
- this._head = new ListNode(data);
78
- this.length++;
79
- return this.head;
80
77
  }
78
+ this.length++;
81
79
  }
82
80
  removeAt(position) {
83
- if (position > -1 && position < this.length && this.head) {
84
- let current = this.head;
85
- let previous = null;
86
- let index = 0;
87
- if (position === 0) {
88
- this._head = current.next;
89
- }
90
- else {
91
- while (index < position && current.next) {
92
- index++;
93
- previous = current;
94
- current = current.next;
95
- }
96
- if (previous) {
97
- previous.next = current.next;
98
- }
99
- if (position === this.length - 1) {
100
- this._tail = current;
101
- }
102
- }
103
- this.length--;
104
- return current;
81
+ // falsy cases
82
+ if (!this.head || position < 0 || position >= this.length) {
83
+ return null;
84
+ }
85
+ let current = this.head;
86
+ let previous = current;
87
+ let index = 0;
88
+ // if position === 0 it means that we need to delete the first node
89
+ if (position === 0) {
90
+ this._head = current.next;
105
91
  }
106
92
  else {
107
- return null;
93
+ // iterate till the index === position
94
+ while (current.next && index < position) {
95
+ index++;
96
+ previous = current;
97
+ current = current.next;
98
+ }
99
+ // remove the element
100
+ previous.next = current.next;
101
+ // update tail
102
+ if (position === this.length - 1) {
103
+ this._tail = previous;
104
+ }
108
105
  }
106
+ this.length--;
109
107
  }
110
108
  getNodePosition(node) {
111
109
  let index = 0;
112
110
  let current = this.head;
113
- while (node) {
114
- if ((current === null || current === void 0 ? void 0 : current.data) === node.data) {
111
+ while (current) {
112
+ if (current.data === node.data) {
115
113
  return index;
116
114
  }
117
- current = current && current.next;
115
+ current = current.next;
118
116
  index++;
119
117
  }
120
118
  return -1;