@limetech/lime-elements 40.24.0 → 40.25.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 (244) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/{checkbox.template-CNJ29zDR.js → checkbox.template-DgiUCPna.js} +1 -1
  3. package/dist/cjs/{image.template-DlF-f23b.js → image.template-B_HZH9t-.js} +1 -1
  4. package/dist/cjs/{index-BlsqxTB1.js → index-CQn9p_mp.js} +12 -0
  5. package/dist/cjs/lime-elements.cjs.js +2 -2
  6. package/dist/cjs/limel-3d-hover-effect-glow.cjs.entry.js +1 -1
  7. package/dist/cjs/limel-action-bar_3.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-ai-avatar.cjs.entry.js +1 -1
  9. package/dist/cjs/limel-badge_7.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-banner.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-button-group.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-button.cjs.entry.js +1 -1
  13. package/dist/cjs/limel-callout.cjs.entry.js +1 -1
  14. package/dist/cjs/limel-card.cjs.entry.js +2 -2
  15. package/dist/cjs/limel-chart.cjs.entry.js +777 -174
  16. package/dist/cjs/limel-checkbox.cjs.entry.js +2 -2
  17. package/dist/cjs/limel-chip-set.cjs.entry.js +1 -1
  18. package/dist/cjs/limel-chip_2.cjs.entry.js +2 -2
  19. package/dist/cjs/limel-circular-progress.cjs.entry.js +1 -1
  20. package/dist/cjs/limel-code-diff.cjs.entry.js +1 -1
  21. package/dist/cjs/limel-code-editor.cjs.entry.js +1 -1
  22. package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
  23. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +1 -1
  24. package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
  25. package/dist/cjs/limel-config.cjs.entry.js +1 -1
  26. package/dist/cjs/limel-date-picker.cjs.entry.js +1 -1
  27. package/dist/cjs/limel-dialog.cjs.entry.js +1 -1
  28. package/dist/cjs/limel-dock-button.cjs.entry.js +1 -1
  29. package/dist/cjs/limel-dock.cjs.entry.js +1 -1
  30. package/dist/cjs/limel-drag-handle_2.cjs.entry.js +1 -1
  31. package/dist/cjs/limel-dynamic-label.cjs.entry.js +1 -1
  32. package/dist/cjs/limel-email-viewer.cjs.entry.js +1 -1
  33. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +1 -1
  34. package/dist/cjs/limel-file-viewer.cjs.entry.js +2 -2
  35. package/dist/cjs/limel-file.cjs.entry.js +1 -1
  36. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
  37. package/dist/cjs/limel-flex-container.cjs.entry.js +1 -1
  38. package/dist/cjs/limel-form-header.cjs.entry.js +1 -1
  39. package/dist/cjs/limel-form.cjs.entry.js +1 -1
  40. package/dist/cjs/limel-grid.cjs.entry.js +1 -1
  41. package/dist/cjs/limel-header.cjs.entry.js +1 -1
  42. package/dist/cjs/limel-help_2.cjs.entry.js +1 -1
  43. package/dist/cjs/limel-helper-line_3.cjs.entry.js +1 -1
  44. package/dist/cjs/limel-hotkey_4.cjs.entry.js +1 -1
  45. package/dist/cjs/limel-icon-button.cjs.entry.js +1 -1
  46. package/dist/cjs/limel-icon.cjs.entry.js +1 -1
  47. package/dist/cjs/limel-info-tile.cjs.entry.js +1 -1
  48. package/dist/cjs/limel-list-item.cjs.entry.js +4 -4
  49. package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
  50. package/dist/cjs/limel-masonry-layout.cjs.entry.js +1 -1
  51. package/dist/cjs/limel-menu-item-meta.cjs.entry.js +1 -1
  52. package/dist/cjs/limel-pagination-jump.cjs.entry.js +1 -1
  53. package/dist/cjs/limel-pagination.cjs.entry.js +1 -1
  54. package/dist/cjs/limel-picker.cjs.entry.js +1 -1
  55. package/dist/cjs/limel-popover_2.cjs.entry.js +1 -1
  56. package/dist/cjs/limel-profile-picture.cjs.entry.js +2 -2
  57. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
  58. package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
  59. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
  60. package/dist/cjs/limel-radio-button-group.cjs.entry.js +1 -1
  61. package/dist/cjs/limel-radio-button.cjs.entry.js +1 -1
  62. package/dist/cjs/limel-resize-handle.cjs.entry.js +1 -1
  63. package/dist/cjs/limel-select.cjs.entry.js +2 -2
  64. package/dist/cjs/limel-shortcut.cjs.entry.js +1 -1
  65. package/dist/cjs/limel-side-panel.cjs.entry.js +1 -1
  66. package/dist/cjs/limel-slider.cjs.entry.js +1 -1
  67. package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
  68. package/dist/cjs/limel-split-button.cjs.entry.js +1 -1
  69. package/dist/cjs/limel-switch.cjs.entry.js +1 -1
  70. package/dist/cjs/limel-tab-bar.cjs.entry.js +1 -1
  71. package/dist/cjs/limel-tab-panel.cjs.entry.js +1 -1
  72. package/dist/cjs/limel-table.cjs.entry.js +1 -1
  73. package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +1 -1
  74. package/dist/cjs/limel-text-editor.cjs.entry.js +1 -1
  75. package/dist/cjs/loader.cjs.js +2 -2
  76. package/dist/cjs/{render-list-component-BtAliHQp.js → render-list-component-BOYFHMFE.js} +1 -1
  77. package/dist/collection/components/chart/chart.css +29 -0
  78. package/dist/collection/components/chart/chart.js +352 -67
  79. package/dist/collection/components/chart/options.js +342 -109
  80. package/dist/collection/components/chart/scale.js +25 -2
  81. package/dist/collection/components/chart/series.js +110 -0
  82. package/dist/esm/{checkbox.template-CAja2LKZ.js → checkbox.template-BJJmiDJP.js} +1 -1
  83. package/dist/esm/{image.template-BGjw97m_.js → image.template-Cw2q5IS7.js} +1 -1
  84. package/dist/esm/{index-BU9IJqli.js → index-D3SUrFhp.js} +12 -1
  85. package/dist/esm/{keyboard-navigation-BF7IKmnG.js → keyboard-navigation-DeMxdkNf.js} +1 -1
  86. package/dist/esm/lime-elements.js +3 -3
  87. package/dist/esm/limel-3d-hover-effect-glow.entry.js +1 -1
  88. package/dist/esm/limel-action-bar_3.entry.js +1 -1
  89. package/dist/esm/limel-ai-avatar.entry.js +1 -1
  90. package/dist/esm/limel-badge_7.entry.js +1 -1
  91. package/dist/esm/limel-banner.entry.js +1 -1
  92. package/dist/esm/limel-button-group.entry.js +1 -1
  93. package/dist/esm/limel-button.entry.js +1 -1
  94. package/dist/esm/limel-callout.entry.js +1 -1
  95. package/dist/esm/limel-card.entry.js +2 -2
  96. package/dist/esm/limel-chart.entry.js +778 -175
  97. package/dist/esm/limel-checkbox.entry.js +2 -2
  98. package/dist/esm/limel-chip-set.entry.js +1 -1
  99. package/dist/esm/limel-chip_2.entry.js +2 -2
  100. package/dist/esm/limel-circular-progress.entry.js +1 -1
  101. package/dist/esm/limel-code-diff.entry.js +1 -1
  102. package/dist/esm/limel-code-editor.entry.js +1 -1
  103. package/dist/esm/limel-collapsible-section.entry.js +1 -1
  104. package/dist/esm/limel-color-picker-palette.entry.js +1 -1
  105. package/dist/esm/limel-color-picker.entry.js +1 -1
  106. package/dist/esm/limel-config.entry.js +1 -1
  107. package/dist/esm/limel-date-picker.entry.js +1 -1
  108. package/dist/esm/limel-dialog.entry.js +1 -1
  109. package/dist/esm/limel-dock-button.entry.js +1 -1
  110. package/dist/esm/limel-dock.entry.js +1 -1
  111. package/dist/esm/limel-drag-handle_2.entry.js +1 -1
  112. package/dist/esm/limel-dynamic-label.entry.js +1 -1
  113. package/dist/esm/limel-email-viewer.entry.js +1 -1
  114. package/dist/esm/limel-file-dropzone_2.entry.js +1 -1
  115. package/dist/esm/limel-file-viewer.entry.js +2 -2
  116. package/dist/esm/limel-file.entry.js +1 -1
  117. package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
  118. package/dist/esm/limel-flex-container.entry.js +1 -1
  119. package/dist/esm/limel-form-header.entry.js +1 -1
  120. package/dist/esm/limel-form.entry.js +1 -1
  121. package/dist/esm/limel-grid.entry.js +1 -1
  122. package/dist/esm/limel-header.entry.js +1 -1
  123. package/dist/esm/limel-help_2.entry.js +1 -1
  124. package/dist/esm/limel-helper-line_3.entry.js +1 -1
  125. package/dist/esm/limel-hotkey_4.entry.js +1 -1
  126. package/dist/esm/limel-icon-button.entry.js +1 -1
  127. package/dist/esm/limel-icon.entry.js +1 -1
  128. package/dist/esm/limel-info-tile.entry.js +1 -1
  129. package/dist/esm/limel-list-item.entry.js +4 -4
  130. package/dist/esm/limel-markdown.entry.js +1 -1
  131. package/dist/esm/limel-masonry-layout.entry.js +1 -1
  132. package/dist/esm/limel-menu-item-meta.entry.js +1 -1
  133. package/dist/esm/limel-pagination-jump.entry.js +1 -1
  134. package/dist/esm/limel-pagination.entry.js +1 -1
  135. package/dist/esm/limel-picker.entry.js +1 -1
  136. package/dist/esm/limel-popover_2.entry.js +1 -1
  137. package/dist/esm/limel-profile-picture.entry.js +2 -2
  138. package/dist/esm/limel-progress-flow-item.entry.js +1 -1
  139. package/dist/esm/limel-progress-flow.entry.js +1 -1
  140. package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
  141. package/dist/esm/limel-radio-button-group.entry.js +1 -1
  142. package/dist/esm/limel-radio-button.entry.js +1 -1
  143. package/dist/esm/limel-resize-handle.entry.js +1 -1
  144. package/dist/esm/limel-select.entry.js +2 -2
  145. package/dist/esm/limel-shortcut.entry.js +1 -1
  146. package/dist/esm/limel-side-panel.entry.js +1 -1
  147. package/dist/esm/limel-slider.entry.js +1 -1
  148. package/dist/esm/limel-snackbar.entry.js +1 -1
  149. package/dist/esm/limel-split-button.entry.js +1 -1
  150. package/dist/esm/limel-switch.entry.js +1 -1
  151. package/dist/esm/limel-tab-bar.entry.js +2 -2
  152. package/dist/esm/limel-tab-panel.entry.js +1 -1
  153. package/dist/esm/limel-table.entry.js +1 -1
  154. package/dist/esm/limel-text-editor-link-menu.entry.js +1 -1
  155. package/dist/esm/limel-text-editor.entry.js +1 -1
  156. package/dist/esm/loader.js +3 -3
  157. package/dist/esm/{render-list-component-J1IzNpbv.js → render-list-component-CnMNjOaj.js} +1 -1
  158. package/dist/lime-elements/lime-elements.esm.js +1 -1
  159. package/dist/lime-elements/{p-6f8305ac.entry.js → p-07961d4f.entry.js} +1 -1
  160. package/dist/lime-elements/{p-a5aa8c06.entry.js → p-099e9e1a.entry.js} +1 -1
  161. package/dist/lime-elements/{p-6567de01.entry.js → p-0dd5cb25.entry.js} +1 -1
  162. package/dist/lime-elements/{p-bfb98b0e.entry.js → p-1d57370e.entry.js} +1 -1
  163. package/dist/lime-elements/{p-391a227e.entry.js → p-1ef92aa3.entry.js} +1 -1
  164. package/dist/lime-elements/p-1eff9347.entry.js +56 -0
  165. package/dist/lime-elements/{p-d078ea89.entry.js → p-22458db2.entry.js} +1 -1
  166. package/dist/lime-elements/{p-557f0e46.entry.js → p-2520a91b.entry.js} +1 -1
  167. package/dist/lime-elements/{p-85318636.entry.js → p-25473848.entry.js} +1 -1
  168. package/dist/lime-elements/{p-51fde63a.entry.js → p-27000dfb.entry.js} +1 -1
  169. package/dist/lime-elements/{p-65199efa.entry.js → p-29800b71.entry.js} +1 -1
  170. package/dist/lime-elements/{p-4de3b35b.entry.js → p-2e1fd8c4.entry.js} +1 -1
  171. package/dist/lime-elements/{p-558a7e27.entry.js → p-2f6ee1b0.entry.js} +1 -1
  172. package/dist/lime-elements/{p-ae634a68.entry.js → p-427a3da3.entry.js} +1 -1
  173. package/dist/lime-elements/{p-46695dd3.entry.js → p-447a2633.entry.js} +1 -1
  174. package/dist/lime-elements/{p-e481fb53.entry.js → p-4c54780d.entry.js} +1 -1
  175. package/dist/lime-elements/{p-08b1bfad.entry.js → p-4f81f0b4.entry.js} +1 -1
  176. package/dist/lime-elements/{p-81c43fe9.entry.js → p-5062b51a.entry.js} +1 -1
  177. package/dist/lime-elements/{p-71ed9466.entry.js → p-5295b4c7.entry.js} +1 -1
  178. package/dist/lime-elements/{p-c63d294b.entry.js → p-5a1b7f4d.entry.js} +1 -1
  179. package/dist/lime-elements/{p-664dbc43.entry.js → p-5b9c1f8f.entry.js} +1 -1
  180. package/dist/lime-elements/{p-ce418df1.entry.js → p-5be1e9e8.entry.js} +1 -1
  181. package/dist/lime-elements/{p-da9be21e.entry.js → p-5c6589aa.entry.js} +1 -1
  182. package/dist/lime-elements/{p-c1dbad1e.entry.js → p-5e7ca1fd.entry.js} +1 -1
  183. package/dist/lime-elements/{p-083aa41f.entry.js → p-5f66e497.entry.js} +1 -1
  184. package/dist/lime-elements/{p-4bc550e5.entry.js → p-667759da.entry.js} +1 -1
  185. package/dist/lime-elements/{p-d51bf98b.entry.js → p-6a340609.entry.js} +1 -1
  186. package/dist/lime-elements/{p-e3cf45ed.entry.js → p-6d3cde2e.entry.js} +1 -1
  187. package/dist/lime-elements/{p-63f2f0b7.entry.js → p-6e529563.entry.js} +1 -1
  188. package/dist/lime-elements/{p-b6334f4b.entry.js → p-743f014f.entry.js} +1 -1
  189. package/dist/lime-elements/{p-5fcb39b8.entry.js → p-7aa034e2.entry.js} +1 -1
  190. package/dist/lime-elements/{p-507965d9.entry.js → p-7b2ec934.entry.js} +1 -1
  191. package/dist/lime-elements/p-7b99624f.entry.js +1 -0
  192. package/dist/lime-elements/{p-1c7fcafc.entry.js → p-7ea96b80.entry.js} +1 -1
  193. package/dist/lime-elements/{p-a1cd0dc0.entry.js → p-7fe1d9ad.entry.js} +1 -1
  194. package/dist/lime-elements/{p-9e5a15d1.entry.js → p-842694af.entry.js} +1 -1
  195. package/dist/lime-elements/{p-9cbfedad.entry.js → p-848aeaa6.entry.js} +1 -1
  196. package/dist/lime-elements/{p-15f5e45e.entry.js → p-868a8b12.entry.js} +1 -1
  197. package/dist/lime-elements/{p-4eee17f7.entry.js → p-891f6a07.entry.js} +1 -1
  198. package/dist/lime-elements/{p-b810b854.entry.js → p-8dcb9ef1.entry.js} +1 -1
  199. package/dist/lime-elements/{p-2a5113ef.entry.js → p-92f79a62.entry.js} +1 -1
  200. package/dist/lime-elements/{p-61c81d09.entry.js → p-93907698.entry.js} +2 -2
  201. package/dist/lime-elements/{p-718431c1.entry.js → p-9b3c7341.entry.js} +1 -1
  202. package/dist/lime-elements/{p-_1yBt1pG.js → p-BJrZuSu3.js} +1 -1
  203. package/dist/lime-elements/{p-Cadm4-WZ.js → p-BzHrLZdr.js} +1 -1
  204. package/dist/lime-elements/{p-BU9IJqli.js → p-D3SUrFhp.js} +2 -2
  205. package/dist/lime-elements/p-DpXrxCh5.js +1 -0
  206. package/dist/lime-elements/p-DwxRLqY6.js +1 -0
  207. package/dist/lime-elements/{p-3f9acb22.entry.js → p-a0501e84.entry.js} +1 -1
  208. package/dist/lime-elements/{p-3a421be9.entry.js → p-a5419b44.entry.js} +1 -1
  209. package/dist/lime-elements/{p-22aaa1ae.entry.js → p-abd612b3.entry.js} +1 -1
  210. package/dist/lime-elements/{p-c6eed240.entry.js → p-aeac9588.entry.js} +2 -2
  211. package/dist/lime-elements/p-b01e8af9.entry.js +1 -0
  212. package/dist/lime-elements/{p-f97ec7a5.entry.js → p-b08c9b52.entry.js} +1 -1
  213. package/dist/lime-elements/{p-be653ca9.entry.js → p-b1f6412e.entry.js} +1 -1
  214. package/dist/lime-elements/{p-6b6b8ffe.entry.js → p-b3967ab3.entry.js} +1 -1
  215. package/dist/lime-elements/{p-eb812303.entry.js → p-b8bfec0e.entry.js} +1 -1
  216. package/dist/lime-elements/{p-490ac19d.entry.js → p-ba4b44ad.entry.js} +1 -1
  217. package/dist/lime-elements/{p-783fd221.entry.js → p-bf726f16.entry.js} +1 -1
  218. package/dist/lime-elements/{p-1e699935.entry.js → p-c2f27d2a.entry.js} +1 -1
  219. package/dist/lime-elements/{p-271662d4.entry.js → p-c3bd19ea.entry.js} +1 -1
  220. package/dist/lime-elements/{p-8e46d111.entry.js → p-cc560bbd.entry.js} +1 -1
  221. package/dist/lime-elements/{p-e8665e99.entry.js → p-d2953c11.entry.js} +1 -1
  222. package/dist/lime-elements/{p-156ea100.entry.js → p-d3d01dd4.entry.js} +1 -1
  223. package/dist/lime-elements/{p-4b75e653.entry.js → p-d9e6175b.entry.js} +1 -1
  224. package/dist/lime-elements/{p-373032c0.entry.js → p-dab5421d.entry.js} +1 -1
  225. package/dist/lime-elements/{p-c3d1aa57.entry.js → p-dcaeefc9.entry.js} +1 -1
  226. package/dist/lime-elements/{p-1fa0fd7a.entry.js → p-df8aa135.entry.js} +1 -1
  227. package/dist/lime-elements/{p-d2f784a8.entry.js → p-e2fb2af4.entry.js} +1 -1
  228. package/dist/lime-elements/{p-c7bcae67.entry.js → p-e929fc64.entry.js} +1 -1
  229. package/dist/lime-elements/{p-3d6ba932.entry.js → p-ea02dade.entry.js} +1 -1
  230. package/dist/lime-elements/{p-0700e83f.entry.js → p-ecd633cb.entry.js} +1 -1
  231. package/dist/lime-elements/{p-c3b86df2.entry.js → p-f5cd53e8.entry.js} +1 -1
  232. package/dist/lime-elements/{p-127ff801.entry.js → p-f7cae25a.entry.js} +1 -1
  233. package/dist/types/components/chart/chart.d.ts +59 -8
  234. package/dist/types/components/chart/chart.types.d.ts +23 -0
  235. package/dist/types/components/chart/options.d.ts +83 -8
  236. package/dist/types/components/chart/scale.d.ts +10 -0
  237. package/dist/types/components/chart/series.d.ts +71 -0
  238. package/dist/types/components.d.ts +42 -15
  239. package/package.json +2 -2
  240. package/dist/lime-elements/p-2d698983.entry.js +0 -1
  241. package/dist/lime-elements/p-391305a7.entry.js +0 -56
  242. package/dist/lime-elements/p-N9vxZMhe.js +0 -1
  243. package/dist/lime-elements/p-bb45a5bb.entry.js +0 -1
  244. package/dist/lime-elements/p-eF09GxA_.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BlsqxTB1.js');
3
+ var index = require('./index-CQn9p_mp.js');
4
4
  var translations = require('./translations-BPsptVkN.js');
5
5
  var keyboardNavigation = require('./keyboard-navigation-VyqkMDKy.js');
6
6
  require('./keycodes-BQ_AERli.js');
@@ -25330,7 +25330,7 @@ var tmpNotUsedArr = [];
25330
25330
  * specific language governing permissions and limitations
25331
25331
  * under the License.
25332
25332
  */
25333
- var AXIS_TYPES = {
25333
+ var AXIS_TYPES$1 = {
25334
25334
  value: 1,
25335
25335
  category: 1,
25336
25336
  time: 1,
@@ -25346,7 +25346,7 @@ function determineAxisType(model) {
25346
25346
  // PENDING: Theoretically, a customized `Scale` is probably impossible, since
25347
25347
  // the interface of `Scale` does not guarantee stability. But we still literally
25348
25348
  // support it for backward compat, though type incorrect.
25349
- || !hasOwn(AXIS_TYPES, type) && !Scale.getClass(type)) {
25349
+ || !hasOwn(AXIS_TYPES$1, type) && !Scale.getClass(type)) {
25350
25350
  type = 'value';
25351
25351
  }
25352
25352
  return type;
@@ -42061,7 +42061,7 @@ var axisDefault = {
42061
42061
  * @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...
42062
42062
  */
42063
42063
  function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
42064
- each$3(AXIS_TYPES, function (v, axisType) {
42064
+ each$3(AXIS_TYPES$1, function (v, axisType) {
42065
42065
  var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);
42066
42066
  var AxisModel = /** @class */function (_super) {
42067
42067
  __extends$1(AxisModel, _super);
@@ -50190,12 +50190,21 @@ const WHOLE_TYPES = new Set([
50190
50190
  'doughnut',
50191
50191
  'ring',
50192
50192
  ]);
50193
- const AXIS_INCREMENT_TYPES = new Set([
50193
+ /**
50194
+ * Types that draw their values along an axis, against the texts of the items
50195
+ * along another one.
50196
+ */
50197
+ const AXIS_TYPES = new Set([
50194
50198
  'bar',
50195
50199
  'dot',
50196
50200
  'area',
50197
50201
  'line',
50198
50202
  ]);
50203
+ const STACK_TYPES = new Set([
50204
+ 'bar',
50205
+ 'area',
50206
+ 'line',
50207
+ ]);
50199
50208
  /**
50200
50209
  * Whether the items of a chart of this type are parts of one whole.
50201
50210
  * @param type - the chart type
@@ -50209,7 +50218,21 @@ function isPartOfWhole(type) {
50209
50218
  * @param type - the chart type
50210
50219
  */
50211
50220
  function usesAxisIncrement(type) {
50212
- return AXIS_INCREMENT_TYPES.has(type);
50221
+ return AXIS_TYPES.has(type);
50222
+ }
50223
+ /**
50224
+ * Whether a chart of this type can draw `series`.
50225
+ * @param type - the chart type
50226
+ */
50227
+ function canDrawSeries(type) {
50228
+ return AXIS_TYPES.has(type);
50229
+ }
50230
+ /**
50231
+ * Whether a chart of this type can stack its `series` on each other.
50232
+ * @param type - the chart type
50233
+ */
50234
+ function canStack(type) {
50235
+ return STACK_TYPES.has(type);
50213
50236
  }
50214
50237
  /**
50215
50238
  * Whether the item has a `[start, end]` range, or an `[x, y]` point in a
@@ -50781,11 +50804,123 @@ function findLocale(language) {
50781
50804
  return locales.get(language);
50782
50805
  }
50783
50806
 
50807
+ /**
50808
+ * Lines up the items of the series by their text, since items of different
50809
+ * series that have the same text belong to the same category. When a series
50810
+ * has several items with the same text, its second item with that text lines
50811
+ * up with the second one of the other series, and so on.
50812
+ * @param series - the series
50813
+ */
50814
+ function alignSeries(series) {
50815
+ const categories = [];
50816
+ const placesOfTexts = new Map();
50817
+ const placedSeries = series.map((current) => {
50818
+ var _a;
50819
+ const timesSeen = new Map();
50820
+ return ((_a = current.items) !== null && _a !== void 0 ? _a : []).map((item) => {
50821
+ var _a, _b;
50822
+ const occurrence = (_a = timesSeen.get(item.text)) !== null && _a !== void 0 ? _a : 0;
50823
+ timesSeen.set(item.text, occurrence + 1);
50824
+ const places = (_b = placesOfTexts.get(item.text)) !== null && _b !== void 0 ? _b : [];
50825
+ placesOfTexts.set(item.text, places);
50826
+ if (occurrence === places.length) {
50827
+ places.push(categories.length);
50828
+ categories.push(item.text);
50829
+ }
50830
+ return { item: item, index: places[occurrence] };
50831
+ });
50832
+ });
50833
+ return {
50834
+ categories: categories,
50835
+ series: series.map((current, index) => {
50836
+ const itemsByCategory = new Map(placedSeries[index].map((placed) => [placed.index, placed.item]));
50837
+ return {
50838
+ text: current.text,
50839
+ color: current.color,
50840
+ items: categories.map((_, category) => itemsByCategory.get(category)),
50841
+ };
50842
+ }),
50843
+ };
50844
+ }
50845
+ /**
50846
+ * The item at a position, if there is one.
50847
+ * @param grid - the series
50848
+ * @param position - where the item is
50849
+ */
50850
+ function getItemAt(grid, position) {
50851
+ var _a;
50852
+ return (_a = grid.series[position.series]) === null || _a === void 0 ? void 0 : _a.items[position.index];
50853
+ }
50854
+ /**
50855
+ * The series that has an item at a place on the axis and is nearest to a
50856
+ * series: the series itself when it has an item there, otherwise the closest
50857
+ * one, and the earlier of two that are as close.
50858
+ * @param grid - the series
50859
+ * @param position - the place on the axis, and the series to start from
50860
+ */
50861
+ function getNearestSeries(grid, position) {
50862
+ const distance = (series) => Math.abs(series - position.series);
50863
+ const [nearest] = [...grid.series.keys()]
50864
+ .filter((series) => getItemAt(grid, Object.assign(Object.assign({}, position), { series: series })))
50865
+ .sort((a, b) => distance(a) - distance(b));
50866
+ return nearest;
50867
+ }
50868
+ /**
50869
+ * The items of every series, in no particular order.
50870
+ * @param grid - the series
50871
+ */
50872
+ function getAllItems(grid) {
50873
+ return grid.series.flatMap((series) => series.items.filter((item) => item !== undefined));
50874
+ }
50875
+ /**
50876
+ * The items that the value axis has to reach: every item, or, when the
50877
+ * series are stacked, the two ends of the stack at each place on the axis.
50878
+ * Positive and negative values are stacked on their own side of zero, and a
50879
+ * range adds its extent to the stack.
50880
+ * @param grid - the series
50881
+ * @param stacked - whether the series are stacked on each other
50882
+ */
50883
+ function getAxisItems(grid, stacked) {
50884
+ if (!stacked) {
50885
+ return getAllItems(grid);
50886
+ }
50887
+ return grid.categories.flatMap((text, index) => {
50888
+ const values = grid.series
50889
+ .map((series) => series.items[index])
50890
+ .filter((item) => item !== undefined)
50891
+ .map((item) => getValueSpan(item));
50892
+ const sum = (side) => values.filter((value) => side(value)).reduce((a, b) => a + b, 0);
50893
+ return [
50894
+ { text: text, value: sum((value) => value > 0) },
50895
+ { text: text, value: sum((value) => value < 0) },
50896
+ ];
50897
+ });
50898
+ }
50899
+ /**
50900
+ * Whether the item at a position ends its stack, since no later series has
50901
+ * an item on the same side of zero at that place on the axis.
50902
+ * @param grid - the stacked series
50903
+ * @param position - where the item is
50904
+ */
50905
+ function endsStack(grid, position) {
50906
+ const side = Math.sign(getStackedValue(grid, position));
50907
+ return grid.series.slice(position.series + 1).every((_, offset) => Math.sign(getStackedValue(grid, {
50908
+ series: position.series + 1 + offset,
50909
+ index: position.index,
50910
+ })) !== side);
50911
+ }
50912
+ function getStackedValue(grid, position) {
50913
+ const item = getItemAt(grid, position);
50914
+ return item ? getValueSpan(item) : 0;
50915
+ }
50916
+
50784
50917
  const DOT_SIZE = 8;
50785
50918
  const LINE_DOT_SIZE = 6;
50786
50919
  const CONNECTOR_WIDTH = 2;
50787
50920
  const DIMMED_OPACITY = 0.4;
50788
50921
  const AREA_OPACITY = 0.4;
50922
+ const SERIES_AREA_OPACITY = 0.15;
50923
+ const SERIES_STACK = { stack: 'series', stackStrategy: 'samesign' };
50789
50924
  const PADDING = 8;
50790
50925
  const NPS_MIN = -100;
50791
50926
  const NPS_MAX = 100;
@@ -50796,6 +50931,15 @@ const NPS_ARC_WIDTH = 16;
50796
50931
  const ITEM_TEXT_MIN_WIDTH = 40;
50797
50932
  const ITEM_TEXT_GAP = 4;
50798
50933
  const ITEM_TEXT_LINE_HEIGHT = 14;
50934
+ const SWATCH = {
50935
+ width: '0.625rem',
50936
+ height: '0.625rem',
50937
+ 'border-radius': '0.125rem',
50938
+ };
50939
+ const SWATCH_SHAPES = {
50940
+ line: { height: '0.125rem' },
50941
+ dot: { 'border-radius': '50%' },
50942
+ };
50799
50943
  const emphasis = { focus: 'self' };
50800
50944
  const blur = { itemStyle: { opacity: DIMMED_OPACITY } };
50801
50945
  const hidden = { show: false };
@@ -50807,34 +50951,116 @@ const hidden = { show: false };
50807
50951
  * when it is known from an earlier drawing
50808
50952
  */
50809
50953
  function drawChart(settings, theme, itemSpace) {
50810
- const drawing = drawSeries(settings, theme, itemSpace);
50811
- return Object.assign(Object.assign({}, drawing), { option: Object.assign({ animation: theme.animate, textStyle: { fontFamily: theme.fontFamily, color: theme.textColor }, tooltip: {
50812
- trigger: 'item',
50813
- appendTo: 'body',
50814
- backgroundColor: theme.surfaceColor,
50815
- borderColor: theme.axisLineColor,
50816
- textStyle: { color: theme.textColor },
50817
- formatter: (params) => getTooltip(settings, getItemIndex(drawing, params)),
50818
- } }, drawing.option) });
50819
- }
50820
- /**
50821
- * The index of the item drawn at a position, if an item is drawn there.
50954
+ const drawn = getDrawnSettings(settings);
50955
+ const grid = getSeriesGrid(drawn);
50956
+ const drawing = drawSeries(drawn, grid, theme, itemSpace);
50957
+ return Object.assign(Object.assign({}, drawing), { option: Object.assign({ animation: theme.animate, textStyle: { fontFamily: theme.fontFamily, color: theme.textColor }, tooltip: Object.assign({ appendTo: 'body', backgroundColor: theme.surfaceColor, borderColor: theme.axisLineColor, textStyle: { color: theme.textColor } }, (drawn.series
50958
+ ? getCategoryTooltipOption(drawn, grid, theme)
50959
+ : {
50960
+ trigger: 'item',
50961
+ formatter: (params) => getTooltip(drawn, findItem(drawing, params).index),
50962
+ })) }, drawing.option) });
50963
+ }
50964
+ /**
50965
+ * The item drawn at a position, if an item is drawn there. A position in a
50966
+ * series of ECharts that draws no items of its own, such as the invisible
50967
+ * column of an item, belongs to the first series.
50822
50968
  * @param drawing - the drawing of the chart
50823
50969
  * @param location - a position within the drawn series
50824
50970
  */
50825
- function getItemIndex(drawing, location) {
50826
- return drawing.itemsAreSeries ? location.seriesIndex : location.dataIndex;
50971
+ function findItem(drawing, location) {
50972
+ var _a, _b;
50973
+ if (drawing.itemsAreSeries) {
50974
+ return { series: 0, index: location.seriesIndex };
50975
+ }
50976
+ return {
50977
+ series: (_b = (_a = drawing.partsOfSeries) === null || _a === void 0 ? void 0 : _a[location.seriesIndex]) !== null && _b !== void 0 ? _b : 0,
50978
+ index: location.dataIndex,
50979
+ };
50827
50980
  }
50828
50981
  /**
50829
50982
  * Where an item is drawn, for highlighting it and showing its tooltip.
50830
50983
  * @param drawing - the drawing of the chart
50831
- * @param index - the index of the item
50984
+ * @param position - where the item is among the series
50832
50985
  */
50833
- function locateItem(drawing, index) {
50986
+ function locateItem(drawing, position) {
50834
50987
  if (drawing.itemsAreSeries) {
50835
- return { seriesIndex: index, dataIndex: 0 };
50988
+ return { seriesIndex: position.index, dataIndex: 0 };
50989
+ }
50990
+ return {
50991
+ seriesIndex: drawing.seriesIndexes[position.series],
50992
+ dataIndex: position.index,
50993
+ };
50994
+ }
50995
+ /**
50996
+ * The series that the chart draws: its series, when its type can draw them.
50997
+ * @param settings - what the chart is given
50998
+ */
50999
+ function getDrawnSeries(settings) {
51000
+ var _a;
51001
+ if (!((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) || !canDrawSeries(settings.type)) {
51002
+ return;
51003
+ }
51004
+ return settings.series;
51005
+ }
51006
+ /**
51007
+ * The series whose items the chart draws as its items: its first series,
51008
+ * when its type cannot draw series and it has no items.
51009
+ * @param settings - what the chart is given
51010
+ */
51011
+ function getSeriesOfDrawnItems(settings) {
51012
+ var _a, _b;
51013
+ if (getDrawnSeries(settings) || ((_a = settings.items) === null || _a === void 0 ? void 0 : _a.length)) {
51014
+ return;
51015
+ }
51016
+ return (_b = settings.series) === null || _b === void 0 ? void 0 : _b[0];
51017
+ }
51018
+ /**
51019
+ * The items that the chart draws when it draws no series: its items, or the
51020
+ * items of its first series when it has no items.
51021
+ * @param settings - what the chart is given
51022
+ */
51023
+ function getDrawnItems(settings) {
51024
+ var _a, _b, _c;
51025
+ if (getDrawnSeries(settings)) {
51026
+ return [];
50836
51027
  }
50837
- return { seriesIndex: drawing.seriesIndex, dataIndex: index };
51028
+ return (_c = (_b = (_a = getSeriesOfDrawnItems(settings)) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : settings.items) !== null && _c !== void 0 ? _c : [];
51029
+ }
51030
+ /**
51031
+ * Whether the chart stacks its series on each other. Only the types that
51032
+ * can stack series do, and never with dates, since a sum of dates means
51033
+ * nothing.
51034
+ * @param settings - what the chart is given
51035
+ */
51036
+ function isStacked(settings) {
51037
+ return Boolean(settings.stacked &&
51038
+ getDrawnSeries(settings) &&
51039
+ canStack(settings.type) &&
51040
+ settings.valueFormat !== 'date');
51041
+ }
51042
+ function getDrawnSettings(settings) {
51043
+ return Object.assign(Object.assign({}, settings), { items: getDrawnItems(settings), series: getDrawnSeries(settings), stacked: isStacked(settings) });
51044
+ }
51045
+ /**
51046
+ * The series that the chart draws lined up by category, or the items it
51047
+ * draws as the only series when it draws no series.
51048
+ * @param settings - what the chart is given
51049
+ */
51050
+ function getSeriesGrid(settings) {
51051
+ var _a;
51052
+ return alignSeries((_a = getDrawnSeries(settings)) !== null && _a !== void 0 ? _a : [
51053
+ { text: '', items: getDrawnItems(settings) },
51054
+ ]);
51055
+ }
51056
+ /**
51057
+ * The style of the marker of a series, in the legend and in the tooltip: a
51058
+ * square for bars and areas, a line for lines, and a dot for dots.
51059
+ * @param type - the chart type
51060
+ * @param color - the color of the series
51061
+ */
51062
+ function getSwatchStyle(type, color = '') {
51063
+ return Object.assign(Object.assign(Object.assign({}, SWATCH), SWATCH_SHAPES[type]), { 'background-color': color });
50838
51064
  }
50839
51065
  /**
50840
51066
  * Shows the text of every item on the axis, cut short to the space of the
@@ -50893,7 +51119,51 @@ function getTooltip(settings, index) {
50893
51119
  .map((text) => encodeHTML(text))
50894
51120
  .join('<br/>');
50895
51121
  }
50896
- function drawSeries(settings, theme, itemSpace) {
51122
+ /**
51123
+ * The tooltip of a category of a chart with series, as HTML: its text, and
51124
+ * the name and value of each series that has an item there.
51125
+ * @param grid - the series of the chart, lined up by category
51126
+ * @param style - how the chart writes values
51127
+ * @param index - the index of the category
51128
+ */
51129
+ function getCategoryTooltip(grid, style, index) {
51130
+ const category = grid.categories[index];
51131
+ if (category === undefined) {
51132
+ return '';
51133
+ }
51134
+ const lines = grid.series
51135
+ .filter((series) => series.items[index] !== undefined)
51136
+ .map((series) => {
51137
+ var _a;
51138
+ const item = series.items[index];
51139
+ return getTooltipLine(getSwatch(style.type, (_a = item.color) !== null && _a !== void 0 ? _a : series.color), series.text, formatValue(item, style));
51140
+ });
51141
+ return [`<div>${encodeHTML(category)}</div>`, ...lines].join('');
51142
+ }
51143
+ function getTooltipLine(swatch, name, value) {
51144
+ return `<div style="display:flex;justify-content:space-between;gap:1rem"><span>${swatch}${encodeHTML(name)}</span><span>${encodeHTML(value)}</span></div>`;
51145
+ }
51146
+ function getSwatch(type, color = '') {
51147
+ const style = Object.assign({ display: 'inline-block', 'vertical-align': 'middle', 'margin-right': '0.375rem' }, getSwatchStyle(type, encodeHTML(color)));
51148
+ const declarations = Object.entries(style).map(([property, value]) => `${property}:${value}`);
51149
+ return `<span style="${declarations.join(';')}"></span>`;
51150
+ }
51151
+ function getCategoryTooltipOption(settings, grid, theme) {
51152
+ return {
51153
+ trigger: 'axis',
51154
+ axisPointer: settings.type === 'bar'
51155
+ ? {
51156
+ type: 'shadow',
51157
+ shadowStyle: { color: theme.axisLineColor, opacity: 0.2 },
51158
+ }
51159
+ : { type: 'line', lineStyle: { color: theme.axisLineColor } },
51160
+ formatter: (params) => {
51161
+ const [first] = [params].flat();
51162
+ return getCategoryTooltip(grid, settings, first === null || first === void 0 ? void 0 : first.dataIndex);
51163
+ },
51164
+ };
51165
+ }
51166
+ function drawSeries(settings, grid, theme, itemSpace) {
50897
51167
  switch (settings.type) {
50898
51168
  case 'pie':
50899
51169
  case 'doughnut': {
@@ -50912,46 +51182,54 @@ function drawSeries(settings, theme, itemSpace) {
50912
51182
  return drawNps(settings, theme);
50913
51183
  }
50914
51184
  default: {
50915
- return drawOnAxes(settings, theme, itemSpace);
51185
+ return drawOnAxes(settings, grid, theme, itemSpace);
50916
51186
  }
50917
51187
  }
50918
51188
  }
50919
- function drawOnAxes(settings, theme, itemSpace) {
50920
- const { items, orientation } = settings;
50921
- const range = settings.valueFormat === 'date'
50922
- ? getDateRange(items.flatMap((item) => [
50923
- getMinimumValue(item),
50924
- getMaximumValue(item),
50925
- ]), settings.maxValue)
50926
- : getAxisRange(items, settings.maxValue, settings.axisIncrement);
50927
- const itemTextAxis = getItemTextAxis(settings);
50928
- const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
51189
+ function drawOnAxes(settings, grid, theme, itemSpace) {
51190
+ const { orientation } = settings;
51191
+ const range = getValueRange(settings, grid);
51192
+ const itemTextAxis = getItemTextAxis(settings, grid);
51193
+ const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
50929
51194
  itemSpace &&
50930
51195
  getItemTextLayout(itemTextAxis, itemSpace))), axisTick: hidden, axisLine: { lineStyle: { color: theme.axisLineColor } } }), getAxisName(settings, settings.itemsLabel, theme));
50931
51196
  const valueAxis = getValueAxis(range, getAxisName(settings, settings.valuesLabel, theme), settings, theme);
50932
- const { series, seriesIndex } = getAxisSeries(settings, theme);
51197
+ const { series, seriesIndexes, partsOfSeries } = getAxisSeries(settings, grid, theme);
50933
51198
  const option = {
50934
51199
  grid: getGrid(theme),
50935
51200
  xAxis: orientation === 'landscape' ? categoryAxis : valueAxis,
50936
51201
  yAxis: orientation === 'landscape' ? valueAxis : categoryAxis,
50937
51202
  series: series,
50938
51203
  };
51204
+ const hasColumns = settings.type !== 'bar' && !settings.series;
50939
51205
  return {
50940
- seriesIndex: seriesIndex,
51206
+ seriesIndexes: seriesIndexes,
51207
+ partsOfSeries: partsOfSeries,
50941
51208
  itemsAreSeries: false,
50942
51209
  itemTextAxis: itemTextAxis,
50943
- option: settings.type === 'bar' ? option : withColumns(option, settings),
51210
+ valueRange: range,
51211
+ option: hasColumns ? withColumns(option, settings, grid) : option,
50944
51212
  };
50945
51213
  }
50946
- function getCategoryAxis(settings) {
51214
+ function getValueRange(settings, grid) {
51215
+ const items = getAxisItems(grid, Boolean(settings.stacked));
51216
+ if (settings.valueFormat === 'date') {
51217
+ return getDateRange(items.flatMap((item) => [
51218
+ getMinimumValue(item),
51219
+ getMaximumValue(item),
51220
+ ]), settings.maxValue);
51221
+ }
51222
+ return getAxisRange(items, settings.maxValue, settings.axisIncrement);
51223
+ }
51224
+ function getCategoryAxis(settings, grid) {
50947
51225
  return {
50948
51226
  type: 'category',
50949
- data: settings.items.map((item) => item.text),
51227
+ data: grid.categories,
50950
51228
  inverse: settings.orientation === 'portrait',
50951
51229
  };
50952
51230
  }
50953
- function getItemTextAxis(settings) {
50954
- if (!settings.displayItemText || settings.items.length < 2) {
51231
+ function getItemTextAxis(settings, grid) {
51232
+ if (!settings.displayItemText || grid.categories.length < 2) {
50955
51233
  return;
50956
51234
  }
50957
51235
  return settings.orientation === 'landscape' ? 'xAxis' : 'yAxis';
@@ -50960,9 +51238,9 @@ function getItemTextAxis(settings) {
50960
51238
  // column across the whole plot that shows its tooltip and takes its clicks.
50961
51239
  // The columns have axes of their own, so they are not laid out next to the
50962
51240
  // bars that draw ranges.
50963
- function withColumns(option, settings) {
51241
+ function withColumns(option, settings, grid) {
50964
51242
  const { items, orientation } = settings;
50965
- const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings)), { show: false });
51243
+ const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { show: false });
50966
51244
  const valueAxis = { type: 'value', min: 0, max: 1, show: false };
50967
51245
  const columns = {
50968
51246
  type: 'bar',
@@ -50977,78 +51255,140 @@ function withColumns(option, settings) {
50977
51255
  const landscape = orientation === 'landscape';
50978
51256
  return Object.assign(Object.assign({}, option), { xAxis: [option.xAxis, landscape ? categoryAxis : valueAxis], yAxis: [option.yAxis, landscape ? valueAxis : categoryAxis], series: [...option.series, columns] });
50979
51257
  }
50980
- function getAxisSeries(settings, theme) {
51258
+ function getAxisSeries(settings, grid, theme) {
51259
+ const series = [];
51260
+ const seriesIndexes = [];
51261
+ const partsOfSeries = [];
51262
+ for (const index of grid.series.keys()) {
51263
+ const drawn = drawItemSeries(settings, grid, index, theme);
51264
+ seriesIndexes.push(series.length + drawn.seriesIndex);
51265
+ series.push(...drawn.series);
51266
+ partsOfSeries.push(...drawn.series.map(() => index));
51267
+ }
51268
+ return {
51269
+ series: series,
51270
+ seriesIndexes: seriesIndexes,
51271
+ partsOfSeries: partsOfSeries,
51272
+ };
51273
+ }
51274
+ function drawItemSeries(settings, grid, index, theme) {
51275
+ const series = grid.series[index];
50981
51276
  if (settings.type === 'line' || settings.type === 'area') {
50982
- return getLineSeries(settings, theme);
51277
+ return getLineSeries(settings, series, index, theme);
50983
51278
  }
50984
51279
  if (settings.type === 'dot') {
50985
- return getDotSeries(settings, theme);
51280
+ return getDotSeries(settings, series, index, theme);
50986
51281
  }
50987
- return getBarSeries(settings, theme);
51282
+ if (settings.stacked) {
51283
+ return {
51284
+ series: [getStackedBars(settings, grid, index, theme)],
51285
+ seriesIndex: 0,
51286
+ };
51287
+ }
51288
+ return getBarSeries(settings, series, index, theme);
50988
51289
  }
50989
- function getBarSeries(settings, theme) {
50990
- const { items } = settings;
51290
+ function getStackedBars(settings, grid, index, theme) {
51291
+ const series = grid.series[index];
51292
+ return Object.assign(Object.assign({ type: 'bar' }, SERIES_STACK), { data: series.items.map((item, category) => item
51293
+ ? {
51294
+ value: getValueSpan(item),
51295
+ itemStyle: {
51296
+ color: item.color,
51297
+ borderRadius: endsStack(grid, {
51298
+ series: index,
51299
+ index: category,
51300
+ })
51301
+ ? getOuterCorners(settings, item, theme)
51302
+ : 0,
51303
+ borderColor: theme.dividerColor,
51304
+ borderWidth: 1,
51305
+ },
51306
+ }
51307
+ : null), label: Object.assign(Object.assign({}, getValueLabel(settings, series, theme)), { position: 'inside', color: undefined }), cursor: getSeriesCursor(series.items), emphasis: emphasis, blur: blur });
51308
+ }
51309
+ function getOuterCorners(settings, item, theme) {
51310
+ const [topLeft, topRight, bottomRight, bottomLeft] = theme.itemBorderRadius;
51311
+ const positive = getValueSpan(item) >= 0;
51312
+ if (settings.orientation === 'portrait') {
51313
+ return positive
51314
+ ? [0, topRight, bottomRight, 0]
51315
+ : [topLeft, 0, 0, bottomLeft];
51316
+ }
51317
+ return positive
51318
+ ? [topLeft, topRight, 0, 0]
51319
+ : [0, 0, bottomRight, bottomLeft];
51320
+ }
51321
+ function getBarSeries(settings, series, index, theme) {
51322
+ const { items } = series;
50991
51323
  const bars = {
50992
51324
  type: 'bar',
50993
- data: items.map((item) => ({
50994
- value: getValueSpan(item),
50995
- itemStyle: {
50996
- color: item.color,
50997
- borderRadius: theme.itemBorderRadius,
50998
- },
50999
- })),
51000
- label: getValueLabel(settings, theme),
51325
+ data: items.map((item) => item
51326
+ ? {
51327
+ value: getValueSpan(item),
51328
+ itemStyle: {
51329
+ color: item.color,
51330
+ borderRadius: theme.itemBorderRadius,
51331
+ },
51332
+ }
51333
+ : null),
51334
+ label: getValueLabel(settings, series, theme),
51001
51335
  cursor: getSeriesCursor(items),
51002
51336
  emphasis: emphasis,
51003
51337
  blur: blur,
51004
51338
  };
51005
- if (items.every((item) => !isRangeItem(item))) {
51339
+ if (!hasRanges(items)) {
51006
51340
  return { series: [bars], seriesIndex: 0 };
51007
51341
  }
51008
51342
  return {
51009
51343
  series: [
51010
- Object.assign(Object.assign({ type: 'bar' }, rangeBase), { data: getRangeStarts(items) }),
51011
- Object.assign(Object.assign({}, bars), stacked),
51344
+ Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { data: getRangeStarts(items) }),
51345
+ Object.assign(Object.assign({}, bars), getRangeStack(index)),
51012
51346
  ],
51013
51347
  seriesIndex: 1,
51014
51348
  };
51015
51349
  }
51016
- function getDotSeries(settings, theme) {
51017
- const { items, orientation } = settings;
51018
- const point = (index, value) => orientation === 'landscape' ? [index, value] : [value, index];
51350
+ function getDotSeries(settings, series, index, theme) {
51351
+ const { items } = series;
51352
+ const { orientation } = settings;
51353
+ const point = (category, value) => orientation === 'landscape' ? [category, value] : [value, category];
51019
51354
  const ends = {
51020
51355
  type: 'scatter',
51021
51356
  symbolSize: DOT_SIZE,
51022
- data: items.map((item, index) => ({
51023
- value: point(index, getMaximumValue(item)),
51024
- itemStyle: { color: item.color },
51025
- })),
51026
- label: getValueLabel(settings, theme),
51357
+ data: items.map((item, category) => item
51358
+ ? {
51359
+ value: point(category, getMaximumValue(item)),
51360
+ itemStyle: { color: item.color },
51361
+ }
51362
+ : null),
51363
+ label: getValueLabel(settings, series, theme),
51027
51364
  cursor: getSeriesCursor(items),
51028
51365
  emphasis: emphasis,
51029
51366
  blur: blur,
51030
51367
  };
51031
- if (items.every((item) => !isRangeItem(item))) {
51368
+ if (!hasRanges(items)) {
51032
51369
  return { series: [ends], seriesIndex: 0 };
51033
51370
  }
51034
- const connectors = Object.assign(Object.assign({ type: 'bar' }, stacked), { silent: true, barWidth: CONNECTOR_WIDTH, data: items.map((item) => ({
51035
- value: isRangeItem(item) ? getValueSpan(item) : null,
51036
- itemStyle: { color: item.color },
51037
- })) });
51371
+ const connectors = Object.assign(Object.assign({ type: 'bar' }, getRangeStack(index)), { cursor: getSeriesCursor(items), emphasis: { disabled: true }, barWidth: CONNECTOR_WIDTH, barGap: '-100%', data: items.map((item) => item && isRangeItem(item)
51372
+ ? {
51373
+ value: getValueSpan(item),
51374
+ itemStyle: { color: item.color },
51375
+ }
51376
+ : null) });
51038
51377
  const starts = {
51039
51378
  type: 'scatter',
51040
- silent: true,
51379
+ cursor: getSeriesCursor(items),
51380
+ emphasis: { disabled: true },
51041
51381
  symbolSize: DOT_SIZE,
51042
- data: items.map((item, index) => ({
51043
- value: isRangeItem(item)
51044
- ? point(index, getMinimumValue(item))
51045
- : [null, null],
51046
- itemStyle: { color: item.color },
51047
- })),
51382
+ data: items.map((item, category) => item && isRangeItem(item)
51383
+ ? {
51384
+ value: point(category, getMinimumValue(item)),
51385
+ itemStyle: { color: item.color },
51386
+ }
51387
+ : null),
51048
51388
  };
51049
51389
  return {
51050
51390
  series: [
51051
- Object.assign(Object.assign({ type: 'bar' }, rangeBase), { data: getRangeStarts(items) }),
51391
+ Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { barGap: '-100%', data: getRangeStarts(items) }),
51052
51392
  connectors,
51053
51393
  starts,
51054
51394
  ends,
@@ -51056,38 +51396,63 @@ function getDotSeries(settings, theme) {
51056
51396
  seriesIndex: 3,
51057
51397
  };
51058
51398
  }
51059
- function getLineSeries(settings, theme) {
51060
- const { items } = settings;
51061
- const color = theme.lineColor;
51399
+ function getLineSeries(settings, series, index, theme) {
51400
+ var _a;
51401
+ const { items } = series;
51402
+ const color = (_a = series.color) !== null && _a !== void 0 ? _a : theme.lineColor;
51062
51403
  const area = settings.type === 'area';
51063
- const line = {
51064
- type: 'line',
51065
- color: color,
51066
- symbol: 'circle',
51067
- symbolSize: LINE_DOT_SIZE,
51068
- data: items.map((item) => ({
51069
- value: getValueSpan(item),
51070
- itemStyle: { color: item.color },
51071
- })),
51072
- areaStyle: area ? { color: color, opacity: AREA_OPACITY } : undefined,
51073
- label: getValueLabel(settings, theme),
51074
- cursor: getSeriesCursor(items),
51075
- emphasis: emphasis,
51076
- blur: blur,
51077
- };
51078
- if (items.every((item) => !isRangeItem(item))) {
51404
+ const line = Object.assign(Object.assign({ type: 'line', color: color, symbol: 'circle', symbolSize: LINE_DOT_SIZE }, (settings.series &&
51405
+ hasClickableItems(items) && {
51406
+ showAllSymbol: true,
51407
+ labelLayout: { hideOverlap: true },
51408
+ })), { data: items.map((item) => item
51409
+ ? {
51410
+ value: getValueSpan(item),
51411
+ itemStyle: { color: item.color },
51412
+ }
51413
+ : null), areaStyle: area
51414
+ ? { color: color, opacity: getAreaOpacity(settings) }
51415
+ : undefined, label: getValueLabel(settings, series, theme), cursor: getSeriesCursor(items), emphasis: emphasis, blur: blur });
51416
+ if (settings.stacked) {
51417
+ return { series: [Object.assign(Object.assign({}, line), SERIES_STACK)], seriesIndex: 0 };
51418
+ }
51419
+ if (!hasRanges(items)) {
51079
51420
  return { series: [line], seriesIndex: 0 };
51080
51421
  }
51081
- const base = Object.assign(Object.assign({ type: 'line' }, rangeBase), { symbol: 'none', color: color, lineStyle: { opacity: area ? 0 : 1 }, data: getRangeStarts(items) });
51082
- return { series: [base, Object.assign(Object.assign({}, line), stacked)], seriesIndex: 1 };
51422
+ const base = Object.assign(Object.assign({ type: 'line' }, getRangeBase(index)), { symbol: 'none', color: color, lineStyle: { opacity: area ? 0 : 1 }, data: getRangeStarts(items) });
51423
+ return {
51424
+ series: [base, Object.assign(Object.assign({}, line), getRangeStack(index))],
51425
+ seriesIndex: 1,
51426
+ };
51427
+ }
51428
+ function getAreaOpacity(settings) {
51429
+ var _a;
51430
+ return ((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) > 1 && !settings.stacked
51431
+ ? SERIES_AREA_OPACITY
51432
+ : AREA_OPACITY;
51433
+ }
51434
+ function hasClickableItems(items) {
51435
+ return items.some((item) => item === null || item === void 0 ? void 0 : item.clickable);
51436
+ }
51437
+ function hasRanges(items) {
51438
+ return items.some((item) => item && isRangeItem(item));
51083
51439
  }
51084
- const stacked = { stack: 'range', stackStrategy: 'all' };
51085
51440
  // A range is drawn as a stack of an invisible part from zero to its start,
51086
51441
  // and a visible part from its start to its end. Items that are not ranges
51087
- // start at zero.
51088
- const rangeBase = Object.assign(Object.assign({}, stacked), { silent: true, tooltip: hidden, emphasis: { disabled: true }, itemStyle: { color: 'transparent' } });
51442
+ // start at zero. Each series has a stack of its own.
51443
+ function getRangeStack(index) {
51444
+ return { stack: `range${index}`, stackStrategy: 'all' };
51445
+ }
51446
+ function getRangeBase(index) {
51447
+ return Object.assign(Object.assign({}, getRangeStack(index)), { silent: true, tooltip: hidden, emphasis: { disabled: true }, itemStyle: { color: 'transparent' } });
51448
+ }
51089
51449
  function getRangeStarts(items) {
51090
- return items.map((item) => (isRangeItem(item) ? getMinimumValue(item) : 0));
51450
+ return items.map((item) => {
51451
+ if (!item) {
51452
+ return null;
51453
+ }
51454
+ return isRangeItem(item) ? getMinimumValue(item) : 0;
51455
+ });
51091
51456
  }
51092
51457
  function drawScatter(settings, theme) {
51093
51458
  const { items } = settings;
@@ -51117,7 +51482,7 @@ function drawScatter(settings, theme) {
51117
51482
  blur: blur,
51118
51483
  };
51119
51484
  return {
51120
- seriesIndex: 0,
51485
+ seriesIndexes: [0],
51121
51486
  itemsAreSeries: false,
51122
51487
  option: {
51123
51488
  grid: getGrid(theme),
@@ -51146,7 +51511,7 @@ function drawPie(settings, theme) {
51146
51511
  }
51147
51512
  const innerRadius = settings.type === 'doughnut' ? '50%' : 0;
51148
51513
  return {
51149
- seriesIndex: 0,
51514
+ seriesIndexes: [0],
51150
51515
  itemsAreSeries: false,
51151
51516
  option: {
51152
51517
  series: [
@@ -51181,7 +51546,7 @@ function drawProportionBar(settings, theme) {
51181
51546
  const categoryAxis = { type: 'category', data: [''], show: false };
51182
51547
  const landscape = settings.orientation === 'landscape';
51183
51548
  return {
51184
- seriesIndex: 0,
51549
+ seriesIndexes: [0],
51185
51550
  itemsAreSeries: true,
51186
51551
  option: {
51187
51552
  backgroundColor: theme.backgroundColor,
@@ -51210,7 +51575,7 @@ function drawRing(settings, theme) {
51210
51575
  const { items } = settings;
51211
51576
  const whole = getWholeRange(items, settings.maxValue).totalRange;
51212
51577
  return {
51213
- seriesIndex: 0,
51578
+ seriesIndexes: [0],
51214
51579
  itemsAreSeries: false,
51215
51580
  option: {
51216
51581
  polar: { radius: ['20%', '90%'] },
@@ -51247,7 +51612,7 @@ function drawRing(settings, theme) {
51247
51612
  function drawNps(settings, theme) {
51248
51613
  const { items } = settings;
51249
51614
  return {
51250
- seriesIndex: 0,
51615
+ seriesIndexes: [0],
51251
51616
  itemsAreSeries: false,
51252
51617
  option: {
51253
51618
  series: [
@@ -51336,8 +51701,8 @@ function getAxisName(settings, name, theme) {
51336
51701
  nameTextStyle: { color: theme.textColor },
51337
51702
  };
51338
51703
  }
51339
- function getValueLabel(settings, theme) {
51340
- return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(settings.items[dataIndex], settings) });
51704
+ function getValueLabel(settings, series, theme) {
51705
+ return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(series.items[dataIndex], settings) });
51341
51706
  }
51342
51707
  function getLabelStyle(theme) {
51343
51708
  return { color: theme.textColor, textBorderWidth: 0 };
@@ -51353,7 +51718,7 @@ function getPointLabel(settings, item) {
51353
51718
  return parts.join(' ');
51354
51719
  }
51355
51720
  function getSeriesCursor(items) {
51356
- return getCursor(items.some((item) => item.clickable));
51721
+ return getCursor(hasClickableItems(items));
51357
51722
  }
51358
51723
  function getCursor(clickable) {
51359
51724
  return clickable ? 'pointer' : 'default';
@@ -51505,9 +51870,18 @@ function paintToRgba(context, color) {
51505
51870
  return `rgba(${red}, ${green}, ${blue}, ${alpha / MAX_CHANNEL})`;
51506
51871
  }
51507
51872
 
51508
- const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));box-sizing:border-box;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
51873
+ const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));--limel-chart-series-color-1:rgb(var(--color-blue-default));--limel-chart-series-color-2:rgb(var(--color-coral-default));--limel-chart-series-color-3:rgb(var(--color-teal-default));--limel-chart-series-color-4:rgb(var(--color-amber-default));--limel-chart-series-color-5:rgb(var(--color-magenta-default));--limel-chart-series-color-6:rgb(var(--color-green-default));--limel-chart-series-color-7:rgb(var(--color-violet-default));--limel-chart-series-color-8:rgb(var(--color-red-default));box-sizing:border-box;position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}ul{display:flex;flex-wrap:wrap;gap:0.25rem 0.875rem;margin:0 0 0.5rem 0;padding:0;list-style:none;font-size:0.75rem;color:rgb(var(--contrast-1100))}li{display:inline-flex;align-items:center;gap:0.375rem}li>span{flex-shrink:0}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
51509
51874
 
51510
51875
  const orientations = ['horizontal', 'vertical'];
51876
+ const SERIES_COLOR_COUNT = 8;
51877
+ const getDefaultSeriesColor = (index) => `var(--limel-chart-series-color-${(index % SERIES_COLOR_COUNT) + 1})`;
51878
+ const copyItem = (item) => ({
51879
+ text: item.text,
51880
+ value: item.value,
51881
+ formattedValue: item.formattedValue,
51882
+ color: item.color,
51883
+ clickable: item.clickable,
51884
+ });
51511
51885
  const extensions = [
51512
51886
  install$9,
51513
51887
  install$5,
@@ -51554,6 +51928,15 @@ const Chart = class {
51554
51928
  * Applies to `proportion-bar`, `pie`, `doughnut`, and `ring` charts.
51555
51929
  */
51556
51930
  this.displayItemPercentage = true;
51931
+ /**
51932
+ * Stacks the `series` on each other, so that each place on the axis
51933
+ * shows their total, such as the revenue of each product, which adds up
51934
+ * to the revenue of the month. Positive and negative values are stacked
51935
+ * on their own side of zero, and a range adds its extent to the stack.
51936
+ * Applies to `bar`, `line`, and `area` charts, but not when
51937
+ * `valueFormat` is `date`.
51938
+ */
51939
+ this.stacked = false;
51557
51940
  /**
51558
51941
  * Defines how items are visualized in the chart.
51559
51942
  * `stacked-bar` is the old name of `proportion-bar`. It still works, but
@@ -51582,7 +51965,9 @@ const Chart = class {
51582
51965
  /**
51583
51966
  * The item that last had focus, which is the one that Tab returns to.
51584
51967
  */
51585
- this.focusedIndex = 0;
51968
+ this.focusedPosition = { series: 0, index: 0 };
51969
+ this.grid = { categories: [], series: [] };
51970
+ this.seriesColors = [];
51586
51971
  this.themeMayHaveChanged = false;
51587
51972
  this.warnings = new Map();
51588
51973
  this.invalidColors = new Set();
@@ -51601,7 +51986,7 @@ const Chart = class {
51601
51986
  if (!this.drawing) {
51602
51987
  return;
51603
51988
  }
51604
- const item = this.getClickableItem(getItemIndex(this.drawing, event));
51989
+ const item = this.getClickableItem(this.getClickedPosition(event));
51605
51990
  if (!item) {
51606
51991
  return;
51607
51992
  }
@@ -51615,7 +52000,7 @@ const Chart = class {
51615
52000
  this.highlightItemAt(event, false);
51616
52001
  };
51617
52002
  this.handleClick = (event) => {
51618
- const item = this.getClickableItem(this.getRowIndex(event));
52003
+ const item = this.getClickableItem(this.getEventPosition(event));
51619
52004
  if (!item) {
51620
52005
  return;
51621
52006
  }
@@ -51626,13 +52011,13 @@ const Chart = class {
51626
52011
  const orientation = orientations.find((option) => keyboardNavigation.isNavigationKey(event, { orientation: option }));
51627
52012
  if (orientation) {
51628
52013
  event.preventDefault();
51629
- this.focusItem(keyboardNavigation.findNavigationTarget(this.items, event.key, this.getRowIndex(event), { orientation: orientation }));
52014
+ this.focusItem(this.findTarget(event.key, this.getEventPosition(event), orientation));
51630
52015
  return;
51631
52016
  }
51632
52017
  if (event.key !== 'Enter' && event.key !== ' ') {
51633
52018
  return;
51634
52019
  }
51635
- const item = this.getClickableItem(this.getRowIndex(event));
52020
+ const item = this.getClickableItem(this.getEventPosition(event));
51636
52021
  if (!item) {
51637
52022
  return;
51638
52023
  }
@@ -51640,9 +52025,9 @@ const Chart = class {
51640
52025
  this.interact.emit(item);
51641
52026
  };
51642
52027
  this.handleFocus = (event) => {
51643
- const row = event.currentTarget;
51644
- this.focusedIndex = Number(row.dataset.index);
51645
- this.showItem(row, true);
52028
+ const element = event.currentTarget;
52029
+ this.focusedPosition = this.getPosition(element);
52030
+ this.showItem(element, true);
51646
52031
  };
51647
52032
  this.handleBlur = (event) => {
51648
52033
  this.showItem(event.currentTarget, false);
@@ -51652,10 +52037,17 @@ const Chart = class {
51652
52037
  this.warnAboutOldTypeName();
51653
52038
  }
51654
52039
  componentWillRender() {
52040
+ this.grid = getSeriesGrid({
52041
+ type: this.chartType,
52042
+ items: this.items,
52043
+ series: this.series,
52044
+ });
51655
52045
  this.warnOnChange('axisIncrement', this.getAxisIncrementWarning());
51656
52046
  this.warnOnChange('language', this.getLanguageWarning());
51657
52047
  this.warnOnChange('currency', this.getCurrencyWarning());
51658
52048
  this.warnOnChange('items', this.getDateWarning());
52049
+ this.warnOnChange('series', this.getSeriesWarning());
52050
+ this.warnOnChange('stacked', this.getStackedWarning());
51659
52051
  }
51660
52052
  connectedCallback() {
51661
52053
  this.draw();
@@ -51697,11 +52089,10 @@ const Chart = class {
51697
52089
  return `limel-chart: \`currency\` must be a three-letter code such as \`SEK\` when \`valueFormat\` is \`currency\`, but was ${JSON.stringify(this.currency)}. Writing the values as numbers instead.`;
51698
52090
  }
51699
52091
  getDateWarning() {
51700
- var _a;
51701
52092
  if (this.valueFormat !== 'date') {
51702
52093
  return;
51703
52094
  }
51704
- const wrong = ((_a = this.items) !== null && _a !== void 0 ? _a : [])
52095
+ const wrong = getAllItems(this.grid)
51705
52096
  .flatMap((item) => [item.value].flat())
51706
52097
  .find((value) => !isDate(value));
51707
52098
  if (wrong === undefined) {
@@ -51710,6 +52101,56 @@ const Chart = class {
51710
52101
  const shown = typeof wrong === 'number' ? wrong : JSON.stringify(wrong);
51711
52102
  return `limel-chart: with \`valueFormat\` \`date\`, each value must be a date in milliseconds since 1970, as \`Date.getTime()\` gives, but was ${shown}. Showing it as it is.`;
51712
52103
  }
52104
+ getSeriesWarning() {
52105
+ var _a, _b, _c;
52106
+ if (!((_a = this.series) === null || _a === void 0 ? void 0 : _a.length)) {
52107
+ return;
52108
+ }
52109
+ if (!canDrawSeries(this.chartType)) {
52110
+ const drawn = ((_b = this.items) === null || _b === void 0 ? void 0 : _b.length)
52111
+ ? '`items`'
52112
+ : 'the items of the first series';
52113
+ return `limel-chart: \`series\` can only be drawn by \`bar\`, \`dot\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Drawing ${drawn} instead.`;
52114
+ }
52115
+ if ((_c = this.items) === null || _c === void 0 ? void 0 : _c.length) {
52116
+ return 'limel-chart: both `items` and `series` are set. Drawing `series`, and leaving out `items`.';
52117
+ }
52118
+ }
52119
+ getStackedWarning() {
52120
+ if (!this.stacked) {
52121
+ return;
52122
+ }
52123
+ if (!canStack(this.chartType)) {
52124
+ return `limel-chart: \`stacked\` can only stack the series of \`bar\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Ignoring \`stacked\`.`;
52125
+ }
52126
+ if (this.valueFormat === 'date') {
52127
+ return 'limel-chart: `stacked` cannot stack dates. Ignoring `stacked`.';
52128
+ }
52129
+ if (!this.drawsSeries) {
52130
+ return 'limel-chart: `stacked` stacks the `series` of a chart, but this chart has none. Ignoring `stacked`.';
52131
+ }
52132
+ }
52133
+ get stacksSeries() {
52134
+ return isStacked({
52135
+ type: this.chartType,
52136
+ series: this.series,
52137
+ stacked: this.stacked,
52138
+ valueFormat: this.valueFormat,
52139
+ });
52140
+ }
52141
+ get drawsSeries() {
52142
+ return Boolean(this.drawnSeries);
52143
+ }
52144
+ get drawnSeries() {
52145
+ return getDrawnSeries({ type: this.chartType, series: this.series });
52146
+ }
52147
+ get drawnItems() {
52148
+ return getDrawnItems({
52149
+ type: this.chartType,
52150
+ items: this.items,
52151
+ series: this.series,
52152
+ });
52153
+ }
51713
52154
  get valueStyle() {
51714
52155
  return {
51715
52156
  type: this.chartType,
@@ -51722,7 +52163,6 @@ const Chart = class {
51722
52163
  return this.type === 'stacked-bar' ? 'proportion-bar' : this.type;
51723
52164
  }
51724
52165
  getAxisIncrementWarning() {
51725
- var _a;
51726
52166
  const increment = this.axisIncrement;
51727
52167
  if (increment === undefined ||
51728
52168
  increment === null ||
@@ -51735,7 +52175,7 @@ const Chart = class {
51735
52175
  if (!usesAxisIncrement(this.chartType)) {
51736
52176
  return;
51737
52177
  }
51738
- const range = getAxisRange((_a = this.items) !== null && _a !== void 0 ? _a : [], this.maxValue, increment);
52178
+ const range = getAxisRange(getAxisItems(this.grid, this.stacksSeries), this.maxValue, increment);
51739
52179
  if (range.increment !== increment) {
51740
52180
  return `limel-chart: \`axisIncrement\` ${increment} would divide the axis into more than ${MAX_AXIS_STEPS} steps. Working out a step from the values instead.`;
51741
52181
  }
@@ -51744,7 +52184,19 @@ const Chart = class {
51744
52184
  if (this.loading) {
51745
52185
  return index.h("limel-spinner", { limeBranded: false });
51746
52186
  }
51747
- return (index.h(index.Host, null, index.h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), index.h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), index.h("tbody", null, this.renderItems()))));
52187
+ return (index.h(index.Host, null, this.renderLegend(), index.h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), index.h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), index.h("tbody", null, this.drawsSeries
52188
+ ? this.renderCategories()
52189
+ : this.renderItems()))));
52190
+ }
52191
+ get hasLegend() {
52192
+ var _a, _b;
52193
+ return ((_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1;
52194
+ }
52195
+ renderLegend() {
52196
+ if (!this.hasLegend) {
52197
+ return;
52198
+ }
52199
+ return (index.h("ul", { "aria-hidden": "true" }, this.drawnSeries.map((series, index$1) => (index.h("li", null, index.h("span", { style: getSwatchStyle(this.chartType, this.seriesColors[index$1]) }), series.text)))));
51748
52200
  }
51749
52201
  renderCaption() {
51750
52202
  if (!this.accessibleLabel) {
@@ -51753,7 +52205,18 @@ const Chart = class {
51753
52205
  return index.h("caption", null, this.accessibleLabel);
51754
52206
  }
51755
52207
  renderTableHeader() {
51756
- return (index.h("thead", null, index.h("tr", null, index.h("th", { scope: "col" }, this.itemsLabel), index.h("th", { scope: "col" }, this.valuesLabel))));
52208
+ var _a, _b;
52209
+ const columns = (_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => series.text)) !== null && _b !== void 0 ? _b : [
52210
+ this.valuesLabel,
52211
+ ];
52212
+ return (index.h("thead", null, this.renderSeriesGroupHeader(), index.h("tr", null, index.h("th", { scope: "col" }, this.itemsLabel), columns.map((column) => (index.h("th", { scope: "col" }, column))))));
52213
+ }
52214
+ renderSeriesGroupHeader() {
52215
+ const allSeries = this.drawnSeries;
52216
+ if (!allSeries || !this.accessibleValuesLabel) {
52217
+ return;
52218
+ }
52219
+ return (index.h("tr", null, index.h("td", null), index.h("th", { scope: "col", colSpan: allSeries.length }, this.accessibleValuesLabel)));
51757
52220
  }
51758
52221
  get itemsLabel() {
51759
52222
  var _a;
@@ -51764,13 +52227,46 @@ const Chart = class {
51764
52227
  return ((_a = this.accessibleValuesLabel) !== null && _a !== void 0 ? _a : translations.translations.get('value', this.language));
51765
52228
  }
51766
52229
  renderItems() {
51767
- var _a, _b;
51768
- const tabStop = keyboardNavigation.findTabStop((_a = this.items) !== null && _a !== void 0 ? _a : [], this.focusedIndex);
51769
- return (_b = this.items) === null || _b === void 0 ? void 0 : _b.map((item, index$1) => (index.h("tr", { "data-index": index$1, "aria-description": this.getRowDescription(index$1), tabIndex: index$1 === tabStop ? 0 : -1, role: item.clickable ? 'button' : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("td", null, item.text), index.h("td", null, formatValue(item, this.valueStyle)))));
52230
+ const items = this.drawnItems;
52231
+ const tabStop = keyboardNavigation.findTabStop(items, this.focusedPosition.index);
52232
+ return items.map((item, index$1) => (index.h("tr", { "data-index": index$1, "aria-description": this.getRowDescription(index$1), tabIndex: index$1 === tabStop ? 0 : -1, role: item.clickable ? 'button' : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("td", null, item.text), index.h("td", null, formatValue(item, this.valueStyle)))));
51770
52233
  }
51771
52234
  getRowDescription(index) {
51772
- const label = getItemLabel(Object.assign(Object.assign({}, this.valueStyle), { items: this.items, maxValue: this.maxValue, displayItemPercentage: this.displayItemPercentage }), index);
51773
- return label === this.items[index].text ? undefined : label;
52235
+ const items = this.drawnItems;
52236
+ const label = getItemLabel(Object.assign(Object.assign({}, this.valueStyle), { items: items, maxValue: this.maxValue, displayItemPercentage: this.displayItemPercentage }), index);
52237
+ return label === items[index].text ? undefined : label;
52238
+ }
52239
+ renderCategories() {
52240
+ const grid = this.grid;
52241
+ const tabStop = this.findTabStopInGrid(grid);
52242
+ return grid.categories.map((category, index$1) => (index.h("tr", null, index.h("th", { scope: "row" }, category), grid.series.map((series, seriesIndex) => this.renderCell(series.items[index$1], { series: seriesIndex, index: index$1 }, tabStop)))));
52243
+ }
52244
+ renderCell(item, position, tabStop) {
52245
+ if (!item) {
52246
+ return index.h("td", null);
52247
+ }
52248
+ const isTabStop = position.series === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.series) &&
52249
+ position.index === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.index);
52250
+ return (index.h("td", { "data-series": position.series, "data-index": position.index, tabIndex: isTabStop ? 0 : -1, role: item.clickable ? 'button' : undefined, "aria-label": item.clickable ? this.getButtonLabel(item, position) : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, formatValue(item, this.valueStyle)));
52251
+ }
52252
+ getButtonLabel(item, position) {
52253
+ return [
52254
+ this.grid.categories[position.index],
52255
+ this.grid.series[position.series].text,
52256
+ formatValue(item, this.valueStyle),
52257
+ ].join(', ');
52258
+ }
52259
+ findTabStopInGrid(grid) {
52260
+ const focused = this.focusedPosition;
52261
+ if (getItemAt(grid, focused)) {
52262
+ return focused;
52263
+ }
52264
+ const first = { series: 0, index: 0 };
52265
+ const series = getNearestSeries(grid, first);
52266
+ if (series === undefined) {
52267
+ return;
52268
+ }
52269
+ return Object.assign(Object.assign({}, first), { series: series });
51774
52270
  }
51775
52271
  draw() {
51776
52272
  var _a;
@@ -51847,20 +52343,23 @@ const Chart = class {
51847
52343
  this.chart.on('mouseout', this.handleChartOut);
51848
52344
  }
51849
52345
  updateChart() {
51850
- var _a, _b;
52346
+ var _a, _b, _c, _d;
51851
52347
  const settings = this.getSettings();
51852
52348
  const drawnSettings = JSON.stringify(settings);
51853
52349
  if (drawnSettings === this.drawnSettings && !this.themeMayHaveChanged) {
51854
52350
  return;
51855
52351
  }
51856
52352
  this.themeMayHaveChanged = false;
51857
- (_a = this.themeReader) !== null && _a !== void 0 ? _a : (this.themeReader = createThemeReader(this.host.shadowRoot));
51858
- (_b = this.stopWatchingTheme) !== null && _b !== void 0 ? _b : (this.stopWatchingTheme = watchTheme(this.host, this.handleThemeChange));
51859
- const theme = this.themeReader.theme();
52353
+ (_a = this.stopWatchingTheme) !== null && _a !== void 0 ? _a : (this.stopWatchingTheme = watchTheme(this.host, this.handleThemeChange));
52354
+ const theme = this.getThemeReader().theme();
51860
52355
  const coloredSettings = this.withItemColors(settings, theme);
51861
52356
  const drawnTheme = JSON.stringify({
51862
52357
  theme: theme,
51863
52358
  itemColors: coloredSettings.items.map((item) => item.color),
52359
+ seriesColors: (_b = coloredSettings.series) === null || _b === void 0 ? void 0 : _b.map((series) => [
52360
+ series.color,
52361
+ ...series.items.map((item) => item.color),
52362
+ ]),
51864
52363
  });
51865
52364
  if (drawnSettings === this.drawnSettings &&
51866
52365
  drawnTheme === this.drawnTheme) {
@@ -51870,9 +52369,10 @@ const Chart = class {
51870
52369
  this.drawnTheme = drawnTheme;
51871
52370
  this.drawing = drawChart(coloredSettings, theme, this.itemSpace);
51872
52371
  this.chart.setOption(this.drawing.option, { notMerge: true });
51873
- const focusedRow = this.host.shadowRoot.activeElement;
51874
- if (focusedRow instanceof HTMLElement && focusedRow.dataset.index) {
51875
- this.showItem(focusedRow, true);
52372
+ this.showSeriesColors((_d = (_c = coloredSettings.series) === null || _c === void 0 ? void 0 : _c.map((series) => series.color)) !== null && _d !== void 0 ? _d : []);
52373
+ const focused = this.host.shadowRoot.activeElement;
52374
+ if (focused instanceof HTMLElement && focused.dataset.index) {
52375
+ this.showItem(focused, true);
51876
52376
  }
51877
52377
  }
51878
52378
  fitItemTextsToSize() {
@@ -51892,33 +52392,74 @@ const Chart = class {
51892
52392
  }
51893
52393
  getSettings() {
51894
52394
  var _a;
51895
- return Object.assign(Object.assign({ items: ((_a = this.items) !== null && _a !== void 0 ? _a : []).map((item) => ({
51896
- text: item.text,
51897
- value: item.value,
51898
- formattedValue: item.formattedValue,
51899
- color: item.color,
51900
- clickable: item.clickable,
51901
- })) }, this.valueStyle), { orientation: this.orientation, maxValue: this.maxValue, axisIncrement: this.axisIncrement, displayAxisLabels: this.displayAxisLabels, itemsLabel: this.itemsLabel, valuesLabel: this.valuesLabel, displayItemText: this.displayItemText, displayItemValue: this.displayItemValue, displayItemPercentage: this.displayItemPercentage });
52395
+ return Object.assign(Object.assign({ items: this.drawnItems.map((item) => copyItem(item)), series: (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => {
52396
+ var _a;
52397
+ return ({
52398
+ text: series.text,
52399
+ color: series.color,
52400
+ items: ((_a = series.items) !== null && _a !== void 0 ? _a : []).map((item) => copyItem(item)),
52401
+ });
52402
+ }), stacked: this.stacksSeries }, this.valueStyle), { orientation: this.orientation, maxValue: this.maxValue, axisIncrement: this.axisIncrement, displayAxisLabels: this.displayAxisLabels, itemsLabel: this.itemsLabel, valuesLabel: this.valuesLabel, displayItemText: this.displayItemText, displayItemValue: this.displayItemValue, displayItemPercentage: this.displayItemPercentage });
51902
52403
  }
51903
52404
  withItemColors(settings, theme) {
51904
- return Object.assign(Object.assign({}, settings), { items: settings.items.map((item) => (Object.assign(Object.assign({}, item), { color: this.getItemColor(item, theme) }))) });
52405
+ var _a;
52406
+ const seriesOfItems = getSeriesOfDrawnItems({
52407
+ type: this.chartType,
52408
+ items: this.items,
52409
+ series: this.series,
52410
+ });
52411
+ const itemColor = seriesOfItems
52412
+ ? this.getSeriesColor(seriesOfItems, 0, theme)
52413
+ : theme.itemColor;
52414
+ const itemFallback = seriesOfItems
52415
+ ? 'the color of its series'
52416
+ : 'the default item color';
52417
+ return Object.assign(Object.assign({}, settings), { items: settings.items.map((item) => {
52418
+ var _a;
52419
+ return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', itemFallback)) !== null && _a !== void 0 ? _a : itemColor }));
52420
+ }), series: (_a = settings.series) === null || _a === void 0 ? void 0 : _a.map((series, index) => {
52421
+ const color = this.getSeriesColor(series, index, theme);
52422
+ return Object.assign(Object.assign({}, series), { color: color, items: series.items.map((item) => {
52423
+ var _a;
52424
+ return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', 'the color of its series')) !== null && _a !== void 0 ? _a : color }));
52425
+ }) });
52426
+ }) });
52427
+ }
52428
+ getSeriesColor(series, index, theme) {
52429
+ var _a, _b;
52430
+ return ((_b = (_a = this.readColor(series.color, 'series', 'the default series color')) !== null && _a !== void 0 ? _a : this.getThemeReader().color(getDefaultSeriesColor(index))) !== null && _b !== void 0 ? _b : theme.itemColor);
51905
52431
  }
51906
- getItemColor(item, theme) {
51907
- if (!item.color) {
51908
- return theme.itemColor;
52432
+ showSeriesColors(colors) {
52433
+ const shown = this.seriesColors;
52434
+ const same = colors.length === shown.length &&
52435
+ colors.every((color, index) => color === shown[index]);
52436
+ if (same) {
52437
+ return;
51909
52438
  }
51910
- const color = this.themeReader.color(item.color);
51911
- if (color) {
51912
- return color;
52439
+ this.seriesColors = colors;
52440
+ if (this.hasLegend) {
52441
+ index.forceUpdate(this);
52442
+ }
52443
+ }
52444
+ readColor(color, owner, fallback) {
52445
+ if (!color) {
52446
+ return;
51913
52447
  }
51914
- if (!this.invalidColors.has(item.color)) {
51915
- this.invalidColors.add(item.color);
51916
- const hint = item.color.includes('var(')
52448
+ const resolved = this.getThemeReader().color(color);
52449
+ if (!resolved && !this.invalidColors.has(color)) {
52450
+ this.invalidColors.add(color);
52451
+ const hint = color.includes('var(')
51917
52452
  ? ' Check that its variables are set, and that they make a color.'
51918
52453
  : '';
51919
- console.warn(`limel-chart: the color of an item must be a CSS color, but was \`${item.color}\`.${hint} Using the default item color instead.`);
52454
+ const article = owner === 'item' ? 'an' : 'a';
52455
+ console.warn(`limel-chart: the color of ${article} ${owner} must be a CSS color, but was \`${color}\`.${hint} Using ${fallback} instead.`);
51920
52456
  }
51921
- return theme.itemColor;
52457
+ return resolved;
52458
+ }
52459
+ getThemeReader() {
52460
+ var _a;
52461
+ (_a = this.themeReader) !== null && _a !== void 0 ? _a : (this.themeReader = createThemeReader(this.host.shadowRoot));
52462
+ return this.themeReader;
51922
52463
  }
51923
52464
  observeSize() {
51924
52465
  if (this.resizeObserver || typeof ResizeObserver === 'undefined') {
@@ -51936,40 +52477,102 @@ const Chart = class {
51936
52477
  this.drawnTheme = undefined;
51937
52478
  this.itemSpace = undefined;
51938
52479
  }
52480
+ getClickedPosition(event) {
52481
+ const position = findItem(this.drawing, event);
52482
+ if (event.seriesType !== 'line' || !event.event) {
52483
+ return position;
52484
+ }
52485
+ return Object.assign(Object.assign({}, position), { index: this.getNearestPlace(event.event) });
52486
+ }
52487
+ getNearestPlace(pixel) {
52488
+ const landscape = this.orientation === 'landscape';
52489
+ const place = this.chart.convertFromPixel(landscape ? { xAxisIndex: 0 } : { yAxisIndex: 0 }, landscape ? pixel.offsetX : pixel.offsetY);
52490
+ return Math.round(place);
52491
+ }
51939
52492
  highlightItemAt(event, highlight) {
51940
52493
  if (!this.drawing) {
51941
52494
  return;
51942
52495
  }
51943
- const location = locateItem(this.drawing, getItemIndex(this.drawing, event));
52496
+ const location = locateItem(this.drawing, findItem(this.drawing, event));
51944
52497
  if (location.seriesIndex === event.seriesIndex) {
51945
52498
  return;
51946
52499
  }
51947
52500
  this.chart.dispatchAction(Object.assign({ type: highlight ? 'highlight' : 'downplay' }, location));
51948
52501
  }
51949
- getClickableItem(index) {
51950
- const item = this.items[index];
52502
+ getClickableItem(position) {
52503
+ const item = getItemAt(this.grid, position);
51951
52504
  if (!(item === null || item === void 0 ? void 0 : item.clickable)) {
51952
52505
  return;
51953
52506
  }
51954
52507
  return item;
51955
52508
  }
51956
- getRowIndex(event) {
51957
- return Number(event.currentTarget.dataset.index);
52509
+ getPosition(element) {
52510
+ var _a;
52511
+ return {
52512
+ series: Number((_a = element.dataset.series) !== null && _a !== void 0 ? _a : 0),
52513
+ index: Number(element.dataset.index),
52514
+ };
52515
+ }
52516
+ getEventPosition(event) {
52517
+ return this.getPosition(event.currentTarget);
51958
52518
  }
51959
- focusItem(index) {
51960
- if (index === keyboardNavigation.NO_NAVIGATION_TARGET) {
52519
+ findTarget(key, position, orientation) {
52520
+ if (!this.drawsSeries) {
52521
+ const items = this.drawnItems;
52522
+ const index = keyboardNavigation.findNavigationTarget(items, key, position.index, {
52523
+ orientation: orientation,
52524
+ });
52525
+ return { series: 0, index: index };
52526
+ }
52527
+ const grid = this.grid;
52528
+ if (orientation === 'horizontal') {
52529
+ const items = grid.series.map((series) => series.items[position.index]);
52530
+ const series = keyboardNavigation.findNavigationTarget(items, key, position.series, {
52531
+ orientation: orientation,
52532
+ isDisabled: (item) => !item,
52533
+ });
52534
+ return { series: series, index: position.index };
52535
+ }
52536
+ const index = keyboardNavigation.findNavigationTarget(grid.categories, key, position.index, { orientation: orientation });
52537
+ const series = getNearestSeries(grid, {
52538
+ series: position.series,
52539
+ index: index,
52540
+ });
52541
+ return { series: series !== null && series !== void 0 ? series : keyboardNavigation.NO_NAVIGATION_TARGET, index: index };
52542
+ }
52543
+ focusItem(position) {
52544
+ if (position.series === keyboardNavigation.NO_NAVIGATION_TARGET ||
52545
+ position.index === keyboardNavigation.NO_NAVIGATION_TARGET) {
51961
52546
  return;
51962
52547
  }
51963
- const rows = this.host.shadowRoot.querySelectorAll('tbody tr');
51964
- rows[index].focus();
52548
+ const series = this.drawsSeries
52549
+ ? `[data-series="${position.series}"]`
52550
+ : '';
52551
+ const element = this.host.shadowRoot.querySelector(`tbody [data-index="${position.index}"]${series}`);
52552
+ element === null || element === void 0 ? void 0 : element.focus();
51965
52553
  }
51966
- showItem(row, show) {
52554
+ showItem(element, show) {
51967
52555
  if (!this.chart || !this.drawing) {
51968
52556
  return;
51969
52557
  }
51970
- const location = locateItem(this.drawing, Number(row.dataset.index));
52558
+ const position = this.getPosition(element);
52559
+ const location = locateItem(this.drawing, position);
51971
52560
  this.chart.dispatchAction(Object.assign({ type: show ? 'highlight' : 'downplay' }, location));
51972
- this.chart.dispatchAction(Object.assign({ type: show ? 'showTip' : 'hideTip' }, location));
52561
+ if (!show) {
52562
+ this.chart.dispatchAction(this.drawsSeries
52563
+ ? { type: 'updateAxisPointer', currTrigger: 'leave' }
52564
+ : { type: 'hideTip' });
52565
+ return;
52566
+ }
52567
+ this.chart.dispatchAction(Object.assign({ type: 'showTip' }, (this.drawsSeries
52568
+ ? this.getMiddleOfPlace(position.index)
52569
+ : location)));
52570
+ }
52571
+ getMiddleOfPlace(index) {
52572
+ const { minValue, maxValue } = this.drawing.valueRange;
52573
+ const middle = (minValue + maxValue) / 2;
52574
+ const [x, y] = this.chart.convertToPixel({ gridIndex: 0 }, this.orientation === 'landscape' ? [index, middle] : [middle, index]);
52575
+ return { x: x, y: y };
51973
52576
  }
51974
52577
  get host() { return index.getElement(this); }
51975
52578
  static get watchers() { return {