@gravity-ui/chartkit 0.9.0 → 0.10.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 (189) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/build/components/ChartKit.css +23 -0
  3. package/build/components/ChartKit.d.ts +0 -1
  4. package/build/components/ChartKit.js +4 -5
  5. package/build/i18n/keysets/en.json +60 -0
  6. package/build/i18n/keysets/ru.json +62 -0
  7. package/build/libs/chartkit-error/chartkit-error.d.ts +1 -0
  8. package/build/libs/chartkit-error/chartkit-error.js +1 -0
  9. package/build/libs/settings/__tests__/settings.test.js +1 -1
  10. package/build/libs/settings/settings.d.ts +6 -3
  11. package/build/libs/settings/settings.js +4 -2
  12. package/build/plugins/highcharts/__stories__/AreaRange.stories.d.ts +4 -0
  13. package/build/plugins/highcharts/__stories__/AreaRange.stories.js +22 -0
  14. package/build/plugins/highcharts/__stories__/Line.stories.d.ts +4 -0
  15. package/build/plugins/highcharts/__stories__/Line.stories.js +21 -0
  16. package/build/plugins/highcharts/__stories__/mocks/area-range.d.ts +2 -0
  17. package/build/plugins/highcharts/__stories__/mocks/area-range.js +61 -0
  18. package/build/plugins/highcharts/__stories__/mocks/holidays.d.ts +7070 -0
  19. package/build/plugins/highcharts/__stories__/mocks/holidays.js +7065 -0
  20. package/build/plugins/highcharts/__stories__/mocks/line.d.ts +2 -0
  21. package/build/plugins/highcharts/__stories__/mocks/line.js +129 -0
  22. package/build/plugins/highcharts/index.d.ts +2 -0
  23. package/build/plugins/highcharts/index.js +5 -0
  24. package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +23 -0
  25. package/build/plugins/highcharts/renderer/HighchartsWidget.js +6 -0
  26. package/build/plugins/highcharts/renderer/components/HighchartsComponent.css +4 -0
  27. package/build/plugins/highcharts/renderer/components/HighchartsComponent.d.ts +575 -0
  28. package/build/plugins/highcharts/renderer/components/HighchartsComponent.js +115 -0
  29. package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.css +50 -0
  30. package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.d.ts +10 -0
  31. package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.js +32 -0
  32. package/build/plugins/highcharts/renderer/components/withSplitPane/WithSplitPane.css +4 -0
  33. package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.d.ts +10 -0
  34. package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +207 -0
  35. package/build/plugins/highcharts/renderer/helpers/add-holidays.d.ts +1 -0
  36. package/build/plugins/highcharts/renderer/helpers/add-holidays.js +43 -0
  37. package/build/plugins/highcharts/renderer/helpers/comments/drawing.d.ts +11 -0
  38. package/build/plugins/highcharts/renderer/helpers/comments/drawing.js +571 -0
  39. package/build/plugins/highcharts/renderer/helpers/config/config.d.ts +575 -0
  40. package/build/plugins/highcharts/renderer/helpers/config/config.js +1483 -0
  41. package/build/plugins/highcharts/renderer/helpers/config/handleLegendItemClick.d.ts +1 -0
  42. package/build/plugins/highcharts/renderer/helpers/config/handleLegendItemClick.js +57 -0
  43. package/build/plugins/highcharts/renderer/helpers/config/options.d.ts +465 -0
  44. package/build/plugins/highcharts/renderer/helpers/config/options.js +350 -0
  45. package/build/plugins/highcharts/renderer/helpers/config/types.d.ts +6 -0
  46. package/build/plugins/highcharts/renderer/helpers/config/types.js +1 -0
  47. package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.d.ts +10 -0
  48. package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.js +42 -0
  49. package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.test.d.ts +1 -0
  50. package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.test.js +99 -0
  51. package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.d.ts +1 -0
  52. package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.js +17 -0
  53. package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.test.d.ts +1 -0
  54. package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.test.js +28 -0
  55. package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.d.ts +5 -0
  56. package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.js +20 -0
  57. package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.test.d.ts +1 -0
  58. package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.test.js +27 -0
  59. package/build/plugins/highcharts/renderer/helpers/config/utils/concatStrings.d.ts +1 -0
  60. package/build/plugins/highcharts/renderer/helpers/config/utils/concatStrings.js +1 -0
  61. package/build/plugins/highcharts/renderer/helpers/config/utils/getChartKitFormattedValue.d.ts +2 -0
  62. package/build/plugins/highcharts/renderer/helpers/config/utils/getChartKitFormattedValue.js +15 -0
  63. package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.d.ts +3 -0
  64. package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.js +15 -0
  65. package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.test.d.ts +1 -0
  66. package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.test.js +11 -0
  67. package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.d.ts +1 -0
  68. package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.js +9 -0
  69. package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.test.d.ts +1 -0
  70. package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.test.js +20 -0
  71. package/build/plugins/highcharts/renderer/helpers/config/utils/index.d.ts +13 -0
  72. package/build/plugins/highcharts/renderer/helpers/config/utils/index.js +13 -0
  73. package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.d.ts +2 -0
  74. package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.js +3 -0
  75. package/build/plugins/highcharts/renderer/helpers/config/utils/isSafari.d.ts +1 -0
  76. package/build/plugins/highcharts/renderer/helpers/config/utils/isSafari.js +12 -0
  77. package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.d.ts +1 -0
  78. package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.js +8 -0
  79. package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.test.d.ts +1 -0
  80. package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.test.js +31 -0
  81. package/build/plugins/highcharts/renderer/helpers/config/utils/localStorage.d.ts +5 -0
  82. package/build/plugins/highcharts/renderer/helpers/config/utils/localStorage.js +23 -0
  83. package/build/plugins/highcharts/renderer/helpers/config/utils/mergeArrayWithObject.d.ts +1 -0
  84. package/build/plugins/highcharts/renderer/helpers/config/utils/mergeArrayWithObject.js +10 -0
  85. package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.d.ts +2 -0
  86. package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.js +19 -0
  87. package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.test.d.ts +1 -0
  88. package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.test.js +20 -0
  89. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.d.ts +13 -0
  90. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.js +27 -0
  91. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.test.d.ts +1 -0
  92. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.test.js +45 -0
  93. package/build/plugins/highcharts/renderer/helpers/constants.d.ts +28 -0
  94. package/build/plugins/highcharts/renderer/helpers/constants.js +30 -0
  95. package/build/plugins/highcharts/renderer/helpers/graph.css +89 -0
  96. package/build/plugins/highcharts/renderer/helpers/graph.d.ts +552 -0
  97. package/build/plugins/highcharts/renderer/helpers/graph.js +85 -0
  98. package/build/plugins/highcharts/renderer/helpers/highcharts/colors.d.ts +2 -0
  99. package/build/plugins/highcharts/renderer/helpers/highcharts/colors.js +17 -0
  100. package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.d.ts +4 -0
  101. package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +346 -0
  102. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calcucalteClosestPointManually.d.ts +1 -0
  103. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calcucalteClosestPointManually.js +19 -0
  104. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calculateClosestPointManually.test.d.ts +1 -0
  105. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calculateClosestPointManually.test.js +42 -0
  106. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/index.d.ts +1 -0
  107. package/build/plugins/highcharts/renderer/helpers/highcharts/utils/index.js +1 -0
  108. package/build/plugins/highcharts/renderer/helpers/init-highcharts-modules.d.ts +1 -0
  109. package/build/plugins/highcharts/renderer/helpers/init-highcharts-modules.js +49 -0
  110. package/build/plugins/highcharts/renderer/helpers/prepare-data.d.ts +1 -0
  111. package/build/plugins/highcharts/renderer/helpers/prepare-data.js +175 -0
  112. package/build/plugins/highcharts/renderer/helpers/tooltip/constants.d.ts +13 -0
  113. package/build/plugins/highcharts/renderer/helpers/tooltip/constants.js +14 -0
  114. package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.d.ts +1 -0
  115. package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.js +5 -0
  116. package/build/plugins/highcharts/renderer/helpers/tooltip/index.d.ts +13 -0
  117. package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +253 -0
  118. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/index.d.ts +6 -0
  119. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/index.js +22 -0
  120. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashDotLineIcon.d.ts +2 -0
  121. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashDotLineIcon.js +20 -0
  122. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashLineIcon.d.ts +2 -0
  123. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashLineIcon.js +25 -0
  124. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DotLineIcon.d.ts +2 -0
  125. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DotLineIcon.js +20 -0
  126. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotDotLineIcon.d.ts +2 -0
  127. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotDotLineIcon.js +18 -0
  128. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotLineIcon.d.ts +2 -0
  129. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotLineIcon.js +18 -0
  130. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashLineIcon.d.ts +2 -0
  131. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashLineIcon.js +15 -0
  132. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotDotLineIcon.d.ts +2 -0
  133. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotDotLineIcon.js +18 -0
  134. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotLineIcon.d.ts +2 -0
  135. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotLineIcon.js +18 -0
  136. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashLineIcon.d.ts +2 -0
  137. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashLineIcon.js +18 -0
  138. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDotLineIcon.d.ts +2 -0
  139. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDotLineIcon.js +20 -0
  140. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/SolidLineIcon.d.ts +2 -0
  141. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/SolidLineIcon.js +13 -0
  142. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/index.d.ts +11 -0
  143. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/index.js +11 -0
  144. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.d.ts +4 -0
  145. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.js +1 -0
  146. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/utils.d.ts +7 -0
  147. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/utils.js +5 -0
  148. package/build/plugins/highcharts/renderer/helpers/tooltip/tooltip.css +367 -0
  149. package/build/plugins/highcharts/renderer/helpers/tooltip/types.d.ts +85 -0
  150. package/build/plugins/highcharts/renderer/helpers/tooltip/types.js +1 -0
  151. package/build/plugins/highcharts/renderer/helpers/types.d.ts +22 -0
  152. package/build/plugins/highcharts/renderer/helpers/types.js +1 -0
  153. package/build/plugins/highcharts/types/comments.d.ts +51 -0
  154. package/build/plugins/highcharts/types/comments.js +1 -0
  155. package/build/plugins/highcharts/types/highcharts-extends.d.ts +38 -0
  156. package/build/plugins/highcharts/types/index.d.ts +4 -0
  157. package/build/plugins/highcharts/types/index.js +1 -0
  158. package/build/plugins/highcharts/types/lib.d.ts +1 -0
  159. package/build/plugins/highcharts/types/lib.js +1 -0
  160. package/build/plugins/highcharts/types/misc.d.ts +19 -0
  161. package/build/plugins/highcharts/types/misc.js +1 -0
  162. package/build/plugins/highcharts/types/widget.d.ts +47 -0
  163. package/build/plugins/highcharts/types/widget.js +1 -0
  164. package/build/plugins/index.d.ts +4 -2
  165. package/build/plugins/index.js +1 -0
  166. package/build/plugins/indicator/renderer/IndicatorItem.d.ts +3 -2
  167. package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +10 -2
  168. package/build/plugins/indicator/renderer/IndicatorWidget.js +1 -1
  169. package/build/plugins/indicator/types.d.ts +0 -6
  170. package/build/plugins/shared/format-number/format-number.d.ts +4 -0
  171. package/build/plugins/shared/format-number/format-number.js +88 -0
  172. package/build/plugins/shared/format-number/format-number.test.d.ts +1 -0
  173. package/build/plugins/shared/format-number/format-number.test.js +14 -0
  174. package/build/plugins/shared/format-number/i18n/en.json +17 -0
  175. package/build/plugins/shared/format-number/i18n/i18n.d.ts +5 -0
  176. package/build/plugins/shared/format-number/i18n/i18n.js +8 -0
  177. package/build/plugins/shared/format-number/i18n/ru.json +17 -0
  178. package/build/plugins/shared/format-number/types.d.ts +14 -0
  179. package/build/plugins/shared/format-number/types.js +1 -0
  180. package/build/plugins/shared/index.d.ts +2 -0
  181. package/build/plugins/shared/index.js +1 -0
  182. package/build/plugins/yagr/renderer/YagrWidget.d.ts +11 -3
  183. package/build/plugins/yagr/renderer/YagrWidget.js +4 -3
  184. package/build/plugins/yagr/types.d.ts +0 -7
  185. package/build/types/index.d.ts +1 -2
  186. package/build/types/misc.d.ts +4 -0
  187. package/build/types/misc.js +1 -0
  188. package/build/types/widget.d.ts +17 -0
  189. package/package.json +5 -2
@@ -0,0 +1,350 @@
1
+ /** Default options for Highcharts & Highstock */
2
+ import block from 'bem-cn-lite';
3
+ import merge from 'lodash/merge';
4
+ import { i18n } from '../../../../../i18n';
5
+ import { getChartKitFormattedValue } from './utils';
6
+ import LocalStorage from './utils/localStorage';
7
+ const b = block('chartkit-tooltip');
8
+ function getTooltipHeaderFormat(format, showColor) {
9
+ return `<div class="${b('header')}">
10
+ ${showColor
11
+ ? `<span class="${b('color')}" style="background-color:{point.color};"></span>`
12
+ : ''}
13
+ ${format}
14
+ </div>`;
15
+ }
16
+ function getTooltipPointFormat(cells, showColor) {
17
+ return `<div class="${b('row')}">
18
+ ${typeof showColor === 'boolean'
19
+ ? `<div class="${b('cell')}">
20
+ <span class="${b('color')}" ${showColor ? 'style="background-color:{point.color};"' : ''}></span>
21
+ </div>`
22
+ : ''}
23
+ ${cells.map((cell) => `<div class="${b('cell')}">${cell}</div>`).join('')}
24
+ </div>`;
25
+ }
26
+ function getFlowClear() {
27
+ return '<span/>';
28
+ }
29
+ function getDataLabelsFormatter(getValue) {
30
+ return function dataLabelsFormatter() {
31
+ var _a;
32
+ const value = getValue(this);
33
+ if (typeof value === 'number' && ((_a = this.series.options.dataLabels) === null || _a === void 0 ? void 0 : _a.chartKitFormatting)) {
34
+ return getChartKitFormattedValue(this.series.options.dataLabels, value, this.percentage);
35
+ }
36
+ return value;
37
+ };
38
+ }
39
+ const first = {
40
+ states: {
41
+ hover: {
42
+ lineWidthPlus: 1,
43
+ },
44
+ },
45
+ dataGrouping: {
46
+ approximation: 'open',
47
+ },
48
+ marker: {
49
+ enabled: false,
50
+ radius: 3,
51
+ states: {
52
+ hover: {
53
+ radiusPlus: 1,
54
+ },
55
+ },
56
+ },
57
+ };
58
+ const second = {
59
+ allowPointSelect: true,
60
+ slicedOffset: 20,
61
+ cursor: 'pointer',
62
+ showInLegend: true,
63
+ };
64
+ const wizardGraphDataLabels = {
65
+ dataLabels: {
66
+ formatter: getDataLabelsFormatter(function (point) {
67
+ var _a, _b;
68
+ return (_b = (_a = point.point.label) !== null && _a !== void 0 ? _a : point.point.value) !== null && _b !== void 0 ? _b : point.y;
69
+ }),
70
+ },
71
+ };
72
+ const notChangeOpacityForInactive = {
73
+ states: {
74
+ inactive: {
75
+ enabled: false,
76
+ },
77
+ },
78
+ };
79
+ const statesForLine = {
80
+ states: {
81
+ hover: {
82
+ animation: {
83
+ duration: 500,
84
+ easing: 'easeInQuint',
85
+ },
86
+ lineWidth: 4,
87
+ opacity: 1,
88
+ },
89
+ inactive: {
90
+ opacity: 1,
91
+ },
92
+ },
93
+ };
94
+ const options = {
95
+ chart: {
96
+ zoomType: 'xy',
97
+ backgroundColor: 'transparent',
98
+ className: 'chartkit-highcharts',
99
+ },
100
+ title: {
101
+ style: {
102
+ color: 'var(--highcharts-title)',
103
+ },
104
+ },
105
+ tooltip: {
106
+ split: false,
107
+ shared: true,
108
+ outside: true,
109
+ followPointer: true,
110
+ dateTimeLabelFormats: {
111
+ millisecond: '%d %B %Y %H:%M:%S.%L',
112
+ second: '%d %B %Y %H:%M:%S',
113
+ minute: '%d %B %Y %H:%M',
114
+ hour: '%d %B %Y %H:%M',
115
+ day: '%d %B %Y %A',
116
+ week: '%d %B %Y',
117
+ quarter: "%Q'%Y",
118
+ },
119
+ },
120
+ legend: {
121
+ itemStyle: {
122
+ color: 'var(--highcharts-legend-item)',
123
+ },
124
+ itemHoverStyle: {
125
+ color: 'var(--highcharts-legend-item-hover)',
126
+ },
127
+ itemHiddenStyle: {
128
+ color: 'var(--highcharts-legend-item-hidden)',
129
+ },
130
+ },
131
+ xAxis: {
132
+ crosshair: false,
133
+ gridLineColor: 'var(--highcharts-grid-line)',
134
+ lineColor: 'var(--highcharts-axis-line)',
135
+ labels: {
136
+ style: {
137
+ color: 'var(--highcharts-axis-labels)',
138
+ },
139
+ },
140
+ tickPixelInterval: 120,
141
+ tickColor: 'var(--highcharts-tick)',
142
+ tickmarkPlacement: 'on',
143
+ dateTimeLabelFormats: {
144
+ day: '%d.%m.%y',
145
+ week: '%d.%m.%y',
146
+ quarter: "%Q'%Y",
147
+ },
148
+ },
149
+ yAxis: {
150
+ gridLineColor: 'var(--highcharts-grid-line)',
151
+ lineColor: 'var(--highcharts-axis-line)',
152
+ labels: {
153
+ style: {
154
+ color: 'var(--highcharts-axis-labels)',
155
+ },
156
+ },
157
+ tickColor: 'var(--highcharts-tick)',
158
+ stackLabels: {
159
+ style: {
160
+ textOutline: 'none',
161
+ color: 'var(--highcharts-data-labels)',
162
+ },
163
+ },
164
+ },
165
+ plotOptions: {
166
+ series: {
167
+ borderColor: 'var(--highcharts-series-border)',
168
+ label: {
169
+ enabled: false,
170
+ },
171
+ tooltip: {
172
+ headerFormat: getTooltipHeaderFormat('{point.key}'),
173
+ pointFormat: getTooltipPointFormat([`<span class=${b('series-name')}>{series.name}</span>`, '{point.y}'], true),
174
+ },
175
+ dataLabels: {
176
+ style: {
177
+ textOutline: 'none',
178
+ color: 'var(--highcharts-data-labels)',
179
+ },
180
+ },
181
+ turboThreshold: 0,
182
+ },
183
+ area: Object.assign({
184
+ boostThreshold: 0,
185
+ trackByArea: true,
186
+ stickyTracking: false,
187
+ }, first, wizardGraphDataLabels, statesForLine),
188
+ areaspline: first,
189
+ bar: Object.assign({
190
+ borderWidth: 0,
191
+ pointWidth: 4,
192
+ }, first, wizardGraphDataLabels, notChangeOpacityForInactive),
193
+ column: Object.assign({}, first, wizardGraphDataLabels, notChangeOpacityForInactive),
194
+ line: Object.assign({}, first, wizardGraphDataLabels, statesForLine),
195
+ spline: first,
196
+ arearange: Object.assign({
197
+ tooltip: {
198
+ pointFormat: getTooltipPointFormat(['{point.low} - {point.high}', '{series.name}'], true),
199
+ },
200
+ }, first),
201
+ scatter: {
202
+ tooltip: {
203
+ headerFormat: getTooltipHeaderFormat('{series.name}', true),
204
+ pointFormat: getTooltipPointFormat([
205
+ '<div>X: {point.x}</div><div>Y: {point.y}<div/>',
206
+ ]),
207
+ },
208
+ },
209
+ bubble: {
210
+ tooltip: {
211
+ headerFormat: getTooltipHeaderFormat('{series.name}', true),
212
+ pointFormat: getTooltipPointFormat([
213
+ `({point.x}, {point.y}), ${i18n('chartkit', 'tooltip-point-format-size')}: {point.z}`,
214
+ ]),
215
+ },
216
+ },
217
+ sankey: {
218
+ tooltip: {
219
+ headerFormat: getTooltipHeaderFormat('{series.name}', true),
220
+ pointFormat: getTooltipPointFormat([
221
+ '{point.fromNode.name} → {point.toNode.name}: <b>{point.weight}</b>',
222
+ ]),
223
+ },
224
+ },
225
+ heatmap: {
226
+ tooltip: {
227
+ headerFormat: getTooltipHeaderFormat('{series.name}', true),
228
+ pointFormat: getTooltipPointFormat(['{point.x}, {point.y}: {point.value}']),
229
+ },
230
+ },
231
+ treemap: {
232
+ tooltip: {
233
+ headerFormat: null,
234
+ pointFormat: getTooltipPointFormat(['<b>{point.name}</b>: {point.value}']),
235
+ },
236
+ },
237
+ timeline: {
238
+ tooltip: {
239
+ headerFormat: getTooltipHeaderFormat('{point.key}', true),
240
+ pointFormat: `
241
+ <div class="${b('point-container', { type: 'timeline' })}">
242
+ <div>{point.description}</div>
243
+ </div>
244
+ `,
245
+ },
246
+ },
247
+ variwide: {},
248
+ waterfall: {},
249
+ pie: Object.assign({
250
+ tooltip: {
251
+ headerFormat: null,
252
+ pointFormat: getTooltipPointFormat(['{point.y}', '{point.name}'], true),
253
+ },
254
+ dataLabels: {
255
+ formatter: getDataLabelsFormatter(function (point) {
256
+ var _a;
257
+ return ((_a = point.point.label) !== null && _a !== void 0 ? _a :
258
+ // https://api.highcharts.com/highcharts/plotOptions.pie.dataLabels.formatter
259
+ (point.point.isNull ? undefined : point.point.name));
260
+ }),
261
+ },
262
+ }, second, notChangeOpacityForInactive),
263
+ histogram: {
264
+ tooltip: {
265
+ headerFormat: null,
266
+ pointFormat: getTooltipHeaderFormat('{point.x} - {point.x2}') +
267
+ getTooltipPointFormat(['{point.y}', '{series.name}'], true),
268
+ },
269
+ },
270
+ bellcurve: {},
271
+ streamgraph: {},
272
+ ohlc: {
273
+ tooltip: {
274
+ pointFormat: getTooltipPointFormat(['{series.name}'], true) +
275
+ getTooltipPointFormat(['', '{point.open}', 'Open']) +
276
+ getTooltipPointFormat(['', '{point.high}', 'High']) +
277
+ getTooltipPointFormat(['', '{point.low}', 'Low']) +
278
+ getTooltipPointFormat(['', '{point.close}', 'Close']),
279
+ },
280
+ },
281
+ ema: {},
282
+ sma: {},
283
+ wordcloud: {
284
+ tooltip: {
285
+ pointFormat: getTooltipPointFormat(['{point.weight}', '{series.name}'], true),
286
+ },
287
+ },
288
+ xrange: {
289
+ tooltip: {
290
+ headerFormat: getTooltipHeaderFormat('{point.x} - {point.x2}'),
291
+ pointFormat: getTooltipPointFormat(['{point.yCategory}', '{series.name}'], true),
292
+ },
293
+ },
294
+ solidgauge: second,
295
+ funnel: second,
296
+ boxplot: {
297
+ tooltip: {
298
+ pointFormat: getTooltipPointFormat(['{series.name}'], true) +
299
+ getFlowClear() +
300
+ getTooltipPointFormat(['{point.high}', 'Maximum'], false) +
301
+ getTooltipPointFormat(['{point.q3}', 'Upper quartile'], false) +
302
+ getTooltipPointFormat(['{point.median}', 'Median'], false) +
303
+ getTooltipPointFormat(['{point.q1}', 'Lower quartile'], false) +
304
+ getTooltipPointFormat(['{point.low}', 'Minimum'], false),
305
+ },
306
+ },
307
+ },
308
+ exporting: {
309
+ buttons: {
310
+ contextButton: {
311
+ enabled: false,
312
+ },
313
+ },
314
+ },
315
+ rangeSelector: {
316
+ enabled: false,
317
+ inputEnabled: false,
318
+ },
319
+ scrollbar: {
320
+ enabled: false,
321
+ barBackgroundColor: 'var(--highcarts-navigator-body)',
322
+ barBorderColor: 'var(--highcarts-navigator-border)',
323
+ buttonArrowColor: 'var(--highcarts-navigator-track)',
324
+ buttonBorderColor: 'var(--highcarts-navigator-border)',
325
+ buttonBackgroundColor: 'var(--highcarts-navigator-body)',
326
+ trackBackgroundColor: 'var(--highcarts-navigator-track)',
327
+ trackBorderColor: 'var(--highcarts-navigator-border)',
328
+ },
329
+ navigator: {
330
+ height: 30,
331
+ outlineColor: 'var(--highcarts-navigator-border)',
332
+ xAxis: {
333
+ gridLineColor: 'var(--highcarts-navigator-border)',
334
+ },
335
+ handles: {
336
+ backgroundColor: 'var(--highcarts-navigator-track)',
337
+ borderColor: 'var(--highcarts-navigator-body)',
338
+ },
339
+ },
340
+ };
341
+ const externalOptions = LocalStorage.restore('__chartkit_highcharts_external_options');
342
+ if (externalOptions) {
343
+ try {
344
+ merge(options, externalOptions);
345
+ }
346
+ catch (error) {
347
+ console.error(error);
348
+ }
349
+ }
350
+ export default options;
@@ -0,0 +1,6 @@
1
+ export declare type NavigatorPeriod = {
2
+ type: string;
3
+ value: string;
4
+ period: Period;
5
+ };
6
+ export declare type Period = 'month' | 'year' | 'day' | 'hour' | 'week' | 'quarter';
@@ -0,0 +1,10 @@
1
+ import { NavigatorLinesMode } from '../../constants';
2
+ declare type AddShowInNavigatorToSeriesArgs = {
3
+ linesMode: NavigatorLinesMode;
4
+ graphs: Record<string, any>[];
5
+ baseSeriesName: string;
6
+ params: Record<string, any>;
7
+ selectedLines: string[];
8
+ };
9
+ export declare const addShowInNavigatorToSeries: ({ linesMode, graphs, baseSeriesName, params, selectedLines, }: AddShowInNavigatorToSeriesArgs) => void;
10
+ export {};
@@ -0,0 +1,42 @@
1
+ import { NavigatorLinesMode } from '../../constants';
2
+ import { getXAxisThresholdValue } from './getXAxisThresholdValue';
3
+ export const addShowInNavigatorToSeries = ({ linesMode, graphs, baseSeriesName, params, selectedLines, }) => {
4
+ if (linesMode === NavigatorLinesMode.All) {
5
+ graphs.forEach((item) => {
6
+ item.showInNavigator = true;
7
+ });
8
+ }
9
+ else {
10
+ const mergedLines = [...selectedLines];
11
+ if (baseSeriesName) {
12
+ mergedLines.push(baseSeriesName);
13
+ }
14
+ if (mergedLines.length) {
15
+ graphs.forEach((item) => {
16
+ const itemName = item.sname || item.name || item.title;
17
+ if (typeof item.showInNavigator === 'undefined') {
18
+ item.showInNavigator = mergedLines.includes(itemName);
19
+ }
20
+ });
21
+ }
22
+ else {
23
+ graphs.forEach((item) => {
24
+ item.showInNavigator = false;
25
+ });
26
+ const xMinValue = getXAxisThresholdValue(graphs, 'min');
27
+ const xMaxValue = getXAxisThresholdValue(graphs, 'max');
28
+ const navigatorParams = Object.assign({}, params.navigator) || {};
29
+ if (navigatorParams.xAxis) {
30
+ navigatorParams.xAxis.min = xMinValue;
31
+ navigatorParams.xAxis.max = xMaxValue;
32
+ }
33
+ else {
34
+ navigatorParams.xAxis = {
35
+ min: xMinValue,
36
+ max: xMaxValue,
37
+ };
38
+ }
39
+ params.navigator = navigatorParams;
40
+ }
41
+ }
42
+ };
@@ -0,0 +1,99 @@
1
+ import { NavigatorLinesMode } from '../../constants';
2
+ import { addShowInNavigatorToSeries } from './addShowInNavigatorToSeries';
3
+ describe('plugins/highcharts/config/addShowInNavigatorToSeries', () => {
4
+ let MOCKED_SERIES;
5
+ let MOCKED_PARAMS;
6
+ beforeEach(() => {
7
+ MOCKED_SERIES = [{ name: 'Test1' }, { name: 'Test2' }, { name: 'Test3' }];
8
+ MOCKED_PARAMS = { navigator: {} };
9
+ });
10
+ it("should set {showInNavigator: true} to all series in case of {linesMode: 'all'}", () => {
11
+ const linesMode = NavigatorLinesMode.All;
12
+ addShowInNavigatorToSeries({
13
+ linesMode,
14
+ graphs: MOCKED_SERIES,
15
+ params: MOCKED_PARAMS,
16
+ selectedLines: [],
17
+ baseSeriesName: '',
18
+ });
19
+ const expectedResult = [
20
+ { name: 'Test1', showInNavigator: true },
21
+ { name: 'Test2', showInNavigator: true },
22
+ { name: 'Test3', showInNavigator: true },
23
+ ];
24
+ expect(MOCKED_SERIES).toEqual(expectedResult);
25
+ });
26
+ it("should set {showInNavigator: false} to all series in case of {linesMode: 'selected'} and add min & max to params.navigator.xAxis", () => {
27
+ const linesMode = NavigatorLinesMode.Selected;
28
+ addShowInNavigatorToSeries({
29
+ linesMode,
30
+ graphs: MOCKED_SERIES,
31
+ params: MOCKED_PARAMS,
32
+ selectedLines: [],
33
+ baseSeriesName: '',
34
+ });
35
+ const expectedSeries = [
36
+ { name: 'Test1', showInNavigator: false },
37
+ { name: 'Test2', showInNavigator: false },
38
+ { name: 'Test3', showInNavigator: false },
39
+ ];
40
+ const expectedParams = {
41
+ navigator: {
42
+ xAxis: {
43
+ max: null,
44
+ min: null,
45
+ },
46
+ },
47
+ };
48
+ expect(MOCKED_SERIES).toEqual(expectedSeries);
49
+ expect(MOCKED_PARAMS).toEqual(expectedParams);
50
+ });
51
+ it('should set {showInNavigator: true} in case of selectedLines contains series', () => {
52
+ const linesMode = NavigatorLinesMode.Selected;
53
+ addShowInNavigatorToSeries({
54
+ linesMode,
55
+ graphs: MOCKED_SERIES,
56
+ params: MOCKED_PARAMS,
57
+ selectedLines: ['Test3'],
58
+ baseSeriesName: '',
59
+ });
60
+ const expectedSeries = [
61
+ { name: 'Test1', showInNavigator: false },
62
+ { name: 'Test2', showInNavigator: false },
63
+ { name: 'Test3', showInNavigator: true },
64
+ ];
65
+ expect(MOCKED_SERIES).toEqual(expectedSeries);
66
+ });
67
+ it('should set {showInNavigator: true} in case of series equals to baseSeriesName', () => {
68
+ const linesMode = NavigatorLinesMode.Selected;
69
+ addShowInNavigatorToSeries({
70
+ linesMode,
71
+ graphs: MOCKED_SERIES,
72
+ params: MOCKED_PARAMS,
73
+ selectedLines: [],
74
+ baseSeriesName: 'Test2',
75
+ });
76
+ const expectedSeries = [
77
+ { name: 'Test1', showInNavigator: false },
78
+ { name: 'Test2', showInNavigator: true },
79
+ { name: 'Test3', showInNavigator: false },
80
+ ];
81
+ expect(MOCKED_SERIES).toEqual(expectedSeries);
82
+ });
83
+ it('should set {showInNavigator: true} in case of selectedLines and baseSeriesName', () => {
84
+ const linesMode = NavigatorLinesMode.Selected;
85
+ addShowInNavigatorToSeries({
86
+ linesMode,
87
+ graphs: MOCKED_SERIES,
88
+ params: MOCKED_PARAMS,
89
+ selectedLines: ['Test1'],
90
+ baseSeriesName: 'Test2',
91
+ });
92
+ const expectedSeries = [
93
+ { name: 'Test1', showInNavigator: true },
94
+ { name: 'Test2', showInNavigator: true },
95
+ { name: 'Test3', showInNavigator: false },
96
+ ];
97
+ expect(MOCKED_SERIES).toEqual(expectedSeries);
98
+ });
99
+ });
@@ -0,0 +1 @@
1
+ export declare const buildNavigatorFallback: (graphs: Record<string, any>[], baseSeriesName?: string | undefined) => void;
@@ -0,0 +1,17 @@
1
+ export const buildNavigatorFallback = (graphs, baseSeriesName) => {
2
+ if (baseSeriesName) {
3
+ graphs.forEach((item) => {
4
+ if (typeof item.showInNavigator === 'undefined') {
5
+ item.showInNavigator =
6
+ item.sname === baseSeriesName ||
7
+ item.name === baseSeriesName ||
8
+ item.title === baseSeriesName;
9
+ }
10
+ });
11
+ }
12
+ else {
13
+ graphs.forEach((item) => {
14
+ item.showInNavigator = true;
15
+ });
16
+ }
17
+ };
@@ -0,0 +1,28 @@
1
+ import { buildNavigatorFallback } from './buildNavigatorFallback';
2
+ const MOCKED_GRAPHS = [{ name: 'Test' }, { name: 'Test1' }, { name: 'Test2' }];
3
+ const baseSeriesName = 'Test2';
4
+ const missedSeriesName = 'Test3';
5
+ describe('plugins/highcharts/config/buildNavigatorFallback', () => {
6
+ it('should set {showInNavigator: true} to current series in case of initialized baseSeriesName', () => {
7
+ const expectedResult = [
8
+ { name: 'Test', showInNavigator: false },
9
+ { name: 'Test1', showInNavigator: false },
10
+ { name: 'Test2', showInNavigator: true },
11
+ ];
12
+ buildNavigatorFallback(MOCKED_GRAPHS, baseSeriesName);
13
+ expect(MOCKED_GRAPHS).toEqual(expectedResult);
14
+ });
15
+ it('should set {showInNavigator: true} to all series in case of baseSeriesName are not initialized', () => {
16
+ const expectedResult = [
17
+ { name: 'Test', showInNavigator: true },
18
+ { name: 'Test1', showInNavigator: true },
19
+ { name: 'Test2', showInNavigator: true },
20
+ ];
21
+ buildNavigatorFallback(MOCKED_GRAPHS);
22
+ expect(MOCKED_GRAPHS).toEqual(expectedResult);
23
+ });
24
+ it('should not set {showInNavigator: true} to current series in case of baseSeriesName are not finded in graphs', () => {
25
+ buildNavigatorFallback(MOCKED_GRAPHS, missedSeriesName);
26
+ expect(MOCKED_GRAPHS).toEqual(MOCKED_GRAPHS);
27
+ });
28
+ });
@@ -0,0 +1,5 @@
1
+ export declare const calculatePrecision: (alternativePrecision: number | null, options: {
2
+ normalizeDiv: boolean;
3
+ normalizeSub: boolean;
4
+ precision?: number;
5
+ }, originalValue?: number | undefined) => number | null | undefined;
@@ -0,0 +1,20 @@
1
+ import isInteger from 'lodash/isInteger';
2
+ export const calculatePrecision = (alternativePrecision, options, originalValue) => {
3
+ const hasPrecisionOption = options.precision || options.precision === 0;
4
+ const hasAlternativePrecision = alternativePrecision || alternativePrecision === 0;
5
+ const hasFloat = originalValue && !isInteger(originalValue);
6
+ let precision;
7
+ if (options.normalizeDiv || options.normalizeSub) {
8
+ precision = 2;
9
+ }
10
+ if (hasPrecisionOption) {
11
+ precision = options.precision;
12
+ }
13
+ if (!precision && precision !== 0 && hasAlternativePrecision) {
14
+ precision = alternativePrecision;
15
+ }
16
+ if (hasFloat && !precision && precision !== 0 && !hasAlternativePrecision) {
17
+ precision = 2;
18
+ }
19
+ return precision;
20
+ };
@@ -0,0 +1,27 @@
1
+ import { calculatePrecision } from './calculatePrecision';
2
+ describe('plugins/highcharts/config/calculatePrecision', () => {
3
+ test('should return undefined', () => {
4
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: false })).toEqual(undefined);
5
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: false }, 1)).toEqual(undefined);
6
+ });
7
+ test('should return 2 in case of some of normalized options are initialized', () => {
8
+ expect(calculatePrecision(null, { normalizeDiv: true, normalizeSub: false }, 99)).toEqual(2);
9
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: true }, 99.99)).toEqual(2);
10
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: true })).toEqual(2);
11
+ expect(calculatePrecision(10, { normalizeDiv: true, normalizeSub: true })).toEqual(2);
12
+ });
13
+ test('should return precision value from func arguments', () => {
14
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: false, precision: 3 })).toEqual(3);
15
+ expect(calculatePrecision(null, { normalizeDiv: true, normalizeSub: false, precision: 4 }, 99.99)).toEqual(4);
16
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: true, precision: 5 }, 99)).toEqual(5);
17
+ expect(calculatePrecision(10, { normalizeDiv: false, normalizeSub: false, precision: 3 })).toEqual(3);
18
+ });
19
+ test('should return alternativePrecision value from func arguments', () => {
20
+ expect(calculatePrecision(10, { normalizeDiv: false, normalizeSub: false })).toEqual(10);
21
+ expect(calculatePrecision(10, { normalizeDiv: false, normalizeSub: false }, 99)).toEqual(10);
22
+ expect(calculatePrecision(10, { normalizeDiv: false, normalizeSub: false }, 99.99)).toEqual(10);
23
+ });
24
+ test('should return 2 for decimal number by default', () => {
25
+ expect(calculatePrecision(null, { normalizeDiv: false, normalizeSub: false }, 0.1111111)).toEqual(2);
26
+ });
27
+ });
@@ -0,0 +1 @@
1
+ export declare const concatStrings: (...strs: unknown[]) => string;
@@ -0,0 +1 @@
1
+ export const concatStrings = (...strs) => strs.filter(Boolean).join(' ');
@@ -0,0 +1,2 @@
1
+ import type { ChartKitFormatNumberSettings } from '../../types';
2
+ export declare const getChartKitFormattedValue: (chartKitFormatSettings: ChartKitFormatNumberSettings, value: number, percentage: number) => string;
@@ -0,0 +1,15 @@
1
+ import { formatNumber } from '../../../../../shared';
2
+ export const getChartKitFormattedValue = (chartKitFormatSettings, value, percentage) => {
3
+ const { chartKitPrecision, chartKitPrefix, chartKitPostfix, chartKitUnit, chartKitFormat, chartKitLabelMode, chartKitShowRankDelimiter, } = chartKitFormatSettings;
4
+ const formatOptions = {
5
+ precision: chartKitPrecision,
6
+ prefix: chartKitPrefix,
7
+ postfix: chartKitPostfix,
8
+ format: chartKitFormat,
9
+ showRankDelimiter: chartKitShowRankDelimiter,
10
+ unit: chartKitUnit,
11
+ labelMode: chartKitLabelMode,
12
+ };
13
+ const valueToFormat = chartKitLabelMode === 'percent' ? percentage : value;
14
+ return formatNumber(valueToFormat, formatOptions);
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { FormatNumberOptions } from '../../../../../shared';
2
+ import type { TooltipLine } from '../../tooltip/types';
3
+ export declare const getFormatOptionsFromLine: (line?: Partial<TooltipLine> | undefined) => FormatNumberOptions | undefined;