@cloudscape-design/chart-components 1.0.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 (246) hide show
  1. package/LICENSE +175 -0
  2. package/NOTICE +1 -0
  3. package/README.md +25 -0
  4. package/cartesian-chart/chart-cartesian-internal.d.ts +10 -0
  5. package/cartesian-chart/chart-cartesian-internal.js +99 -0
  6. package/cartesian-chart/chart-cartesian-internal.js.map +1 -0
  7. package/cartesian-chart/chart-series-cartesian.d.ts +7 -0
  8. package/cartesian-chart/chart-series-cartesian.js +95 -0
  9. package/cartesian-chart/chart-series-cartesian.js.map +1 -0
  10. package/cartesian-chart/index.d.ts +5 -0
  11. package/cartesian-chart/index.js +133 -0
  12. package/cartesian-chart/index.js.map +1 -0
  13. package/cartesian-chart/interfaces.d.ts +166 -0
  14. package/cartesian-chart/interfaces.js +4 -0
  15. package/cartesian-chart/interfaces.js.map +1 -0
  16. package/cartesian-chart/test-classes/styles.css.js +6 -0
  17. package/cartesian-chart/test-classes/styles.scoped.css +7 -0
  18. package/cartesian-chart/test-classes/styles.selectors.js +7 -0
  19. package/core/chart-api/chart-extra-axis-titles.d.ts +10 -0
  20. package/core/chart-api/chart-extra-axis-titles.js +42 -0
  21. package/core/chart-api/chart-extra-axis-titles.js.map +1 -0
  22. package/core/chart-api/chart-extra-context.d.ts +41 -0
  23. package/core/chart-api/chart-extra-context.js +93 -0
  24. package/core/chart-api/chart-extra-context.js.map +1 -0
  25. package/core/chart-api/chart-extra-highlight.d.ts +20 -0
  26. package/core/chart-api/chart-extra-highlight.js +205 -0
  27. package/core/chart-api/chart-extra-highlight.js.map +1 -0
  28. package/core/chart-api/chart-extra-legend.d.ts +27 -0
  29. package/core/chart-api/chart-extra-legend.js +118 -0
  30. package/core/chart-api/chart-extra-legend.js.map +1 -0
  31. package/core/chart-api/chart-extra-navigation.d.ts +84 -0
  32. package/core/chart-api/chart-extra-navigation.js +470 -0
  33. package/core/chart-api/chart-extra-navigation.js.map +1 -0
  34. package/core/chart-api/chart-extra-nodata.d.ts +15 -0
  35. package/core/chart-api/chart-extra-nodata.js +45 -0
  36. package/core/chart-api/chart-extra-nodata.js.map +1 -0
  37. package/core/chart-api/chart-extra-pointer.d.ts +33 -0
  38. package/core/chart-api/chart-extra-pointer.js +173 -0
  39. package/core/chart-api/chart-extra-pointer.js.map +1 -0
  40. package/core/chart-api/chart-extra-tooltip.d.ts +33 -0
  41. package/core/chart-api/chart-extra-tooltip.js +209 -0
  42. package/core/chart-api/chart-extra-tooltip.js.map +1 -0
  43. package/core/chart-api/index.d.ts +75 -0
  44. package/core/chart-api/index.js +383 -0
  45. package/core/chart-api/index.js.map +1 -0
  46. package/core/chart-container.d.ts +20 -0
  47. package/core/chart-container.js +55 -0
  48. package/core/chart-container.js.map +1 -0
  49. package/core/chart-core.d.ts +7 -0
  50. package/core/chart-core.js +287 -0
  51. package/core/chart-core.js.map +1 -0
  52. package/core/components/core-application.d.ts +6 -0
  53. package/core/components/core-application.js +16 -0
  54. package/core/components/core-application.js.map +1 -0
  55. package/core/components/core-filters.d.ts +9 -0
  56. package/core/components/core-filters.js +22 -0
  57. package/core/components/core-filters.js.map +1 -0
  58. package/core/components/core-legend.d.ts +13 -0
  59. package/core/components/core-legend.js +27 -0
  60. package/core/components/core-legend.js.map +1 -0
  61. package/core/components/core-no-data.d.ts +6 -0
  62. package/core/components/core-no-data.js +48 -0
  63. package/core/components/core-no-data.js.map +1 -0
  64. package/core/components/core-slots.d.ts +7 -0
  65. package/core/components/core-slots.js +11 -0
  66. package/core/components/core-slots.js.map +1 -0
  67. package/core/components/core-tooltip.d.ts +7 -0
  68. package/core/components/core-tooltip.js +183 -0
  69. package/core/components/core-tooltip.js.map +1 -0
  70. package/core/components/core-vertical-axis-title.d.ts +5 -0
  71. package/core/components/core-vertical-axis-title.js +15 -0
  72. package/core/components/core-vertical-axis-title.js.map +1 -0
  73. package/core/formatters.d.ts +2 -0
  74. package/core/formatters.js +113 -0
  75. package/core/formatters.js.map +1 -0
  76. package/core/i18n-utils.d.ts +21 -0
  77. package/core/i18n-utils.js +18 -0
  78. package/core/i18n-utils.js.map +1 -0
  79. package/core/interfaces.d.ts +436 -0
  80. package/core/interfaces.js +4 -0
  81. package/core/interfaces.js.map +1 -0
  82. package/core/styles.css.js +25 -0
  83. package/core/styles.scoped.css +115 -0
  84. package/core/styles.selectors.js +26 -0
  85. package/core/test-classes/styles.css.js +33 -0
  86. package/core/test-classes/styles.scoped.css +34 -0
  87. package/core/test-classes/styles.selectors.js +34 -0
  88. package/core/utils.d.ts +45 -0
  89. package/core/utils.js +262 -0
  90. package/core/utils.js.map +1 -0
  91. package/index.d.ts +4 -0
  92. package/index.js +5 -0
  93. package/index.js.map +1 -0
  94. package/internal/api-docs/components/cartesian-chart.js +571 -0
  95. package/internal/api-docs/components/index.d.ts +3 -0
  96. package/internal/api-docs/components/index.js +4 -0
  97. package/internal/api-docs/components/interfaces.d.ts +81 -0
  98. package/internal/api-docs/components/pie-chart.js +430 -0
  99. package/internal/api-docs/test-utils-doc/dom.js +4 -0
  100. package/internal/api-docs/test-utils-doc/selectors.js +4 -0
  101. package/internal/base-component/get-data-attributes.d.ts +1 -0
  102. package/internal/base-component/get-data-attributes.js +12 -0
  103. package/internal/base-component/get-data-attributes.js.map +1 -0
  104. package/internal/base-component/use-base-component.d.ts +13 -0
  105. package/internal/base-component/use-base-component.js +18 -0
  106. package/internal/base-component/use-base-component.js.map +1 -0
  107. package/internal/base-component/use-telemetry.d.ts +2 -0
  108. package/internal/base-component/use-telemetry.js +8 -0
  109. package/internal/base-component/use-telemetry.js.map +1 -0
  110. package/internal/chart-styles.d.ts +88 -0
  111. package/internal/chart-styles.js +145 -0
  112. package/internal/chart-styles.js.map +1 -0
  113. package/internal/components/chart-legend/index.d.ts +14 -0
  114. package/internal/components/chart-legend/index.js +245 -0
  115. package/internal/components/chart-legend/index.js.map +1 -0
  116. package/internal/components/chart-legend/styles.css.js +22 -0
  117. package/internal/components/chart-legend/styles.scoped.css +233 -0
  118. package/internal/components/chart-legend/styles.selectors.js +23 -0
  119. package/internal/components/chart-legend/test-classes/styles.css.js +11 -0
  120. package/internal/components/chart-legend/test-classes/styles.scoped.css +12 -0
  121. package/internal/components/chart-legend/test-classes/styles.selectors.js +12 -0
  122. package/internal/components/chart-series-filter/index.d.ts +17 -0
  123. package/internal/components/chart-series-filter/index.js +14 -0
  124. package/internal/components/chart-series-filter/index.js.map +1 -0
  125. package/internal/components/interfaces.d.ts +17 -0
  126. package/internal/components/interfaces.js +4 -0
  127. package/internal/components/interfaces.js.map +1 -0
  128. package/internal/components/series-details/index.d.ts +23 -0
  129. package/internal/components/series-details/index.js +45 -0
  130. package/internal/components/series-details/index.js.map +1 -0
  131. package/internal/components/series-details/styles.css.js +22 -0
  132. package/internal/components/series-details/styles.scoped.css +150 -0
  133. package/internal/components/series-details/styles.selectors.js +23 -0
  134. package/internal/components/series-details/test-classes/styles.css.js +10 -0
  135. package/internal/components/series-details/test-classes/styles.scoped.css +11 -0
  136. package/internal/components/series-details/test-classes/styles.selectors.js +11 -0
  137. package/internal/components/series-marker/index.d.ts +8 -0
  138. package/internal/components/series-marker/index.js +45 -0
  139. package/internal/components/series-marker/index.js.map +1 -0
  140. package/internal/components/series-marker/interfaces.d.ts +1 -0
  141. package/internal/components/series-marker/interfaces.js +4 -0
  142. package/internal/components/series-marker/interfaces.js.map +1 -0
  143. package/internal/components/series-marker/render-marker.d.ts +3 -0
  144. package/internal/components/series-marker/render-marker.js +74 -0
  145. package/internal/components/series-marker/render-marker.js.map +1 -0
  146. package/internal/components/series-marker/styles.css.js +7 -0
  147. package/internal/components/series-marker/styles.scoped.css +55 -0
  148. package/internal/components/series-marker/styles.selectors.js +8 -0
  149. package/internal/environment.d.ts +4 -0
  150. package/internal/environment.js +5 -0
  151. package/internal/environment.json +7 -0
  152. package/internal/events/index.d.ts +23 -0
  153. package/internal/events/index.js +41 -0
  154. package/internal/events/index.js.map +1 -0
  155. package/internal/generated/styles/tokens.d.ts +756 -0
  156. package/internal/generated/styles/tokens.js +756 -0
  157. package/internal/generated/theming/index.cjs +12584 -0
  158. package/internal/generated/theming/index.cjs.d.ts +2399 -0
  159. package/internal/generated/theming/index.d.ts +2399 -0
  160. package/internal/generated/theming/index.js +12584 -0
  161. package/internal/manifest.json +3 -0
  162. package/internal/styles.css.js +6 -0
  163. package/internal/styles.scoped.css +13 -0
  164. package/internal/styles.selectors.js +7 -0
  165. package/internal/utils/apply-display-name.d.ts +1 -0
  166. package/internal/utils/apply-display-name.js +6 -0
  167. package/internal/utils/apply-display-name.js.map +1 -0
  168. package/internal/utils/async-store.d.ts +19 -0
  169. package/internal/utils/async-store.js +58 -0
  170. package/internal/utils/async-store.js.map +1 -0
  171. package/internal/utils/chart-series.d.ts +8 -0
  172. package/internal/utils/chart-series.js +11 -0
  173. package/internal/utils/chart-series.js.map +1 -0
  174. package/internal/utils/renderer-utils.d.ts +17 -0
  175. package/internal/utils/renderer-utils.js +95 -0
  176. package/internal/utils/renderer-utils.js.map +1 -0
  177. package/internal/utils/series-data.d.ts +2 -0
  178. package/internal/utils/series-data.js +8 -0
  179. package/internal/utils/series-data.js.map +1 -0
  180. package/internal/utils/test-i18n-provider.d.ts +8 -0
  181. package/internal/utils/test-i18n-provider.js +8 -0
  182. package/internal/utils/test-i18n-provider.js.map +1 -0
  183. package/internal/utils/use-previous.d.ts +4 -0
  184. package/internal/utils/use-previous.js +14 -0
  185. package/internal/utils/use-previous.js.map +1 -0
  186. package/internal/utils/utils.d.ts +16 -0
  187. package/internal/utils/utils.js +49 -0
  188. package/internal/utils/utils.js.map +1 -0
  189. package/internal-do-not-use/core-chart/index.d.ts +4 -0
  190. package/internal-do-not-use/core-chart/index.js +13 -0
  191. package/internal-do-not-use/core-chart/index.js.map +1 -0
  192. package/internal-do-not-use/core-legend/index.d.ts +2 -0
  193. package/internal-do-not-use/core-legend/index.js +11 -0
  194. package/internal-do-not-use/core-legend/index.js.map +1 -0
  195. package/package.json +106 -0
  196. package/pie-chart/chart-inner-area.d.ts +10 -0
  197. package/pie-chart/chart-inner-area.js +63 -0
  198. package/pie-chart/chart-inner-area.js.map +1 -0
  199. package/pie-chart/chart-pie-internal.d.ts +11 -0
  200. package/pie-chart/chart-pie-internal.js +103 -0
  201. package/pie-chart/chart-pie-internal.js.map +1 -0
  202. package/pie-chart/index.d.ts +5 -0
  203. package/pie-chart/index.js +48 -0
  204. package/pie-chart/index.js.map +1 -0
  205. package/pie-chart/interfaces.d.ts +101 -0
  206. package/pie-chart/interfaces.js +4 -0
  207. package/pie-chart/interfaces.js.map +1 -0
  208. package/pie-chart/test-classes/styles.css.js +8 -0
  209. package/pie-chart/test-classes/styles.scoped.css +9 -0
  210. package/pie-chart/test-classes/styles.selectors.js +9 -0
  211. package/test-utils/dom/cartesian-chart/index.d.ts +14 -0
  212. package/test-utils/dom/cartesian-chart/index.js +24 -0
  213. package/test-utils/dom/cartesian-chart/index.js.map +1 -0
  214. package/test-utils/dom/cartesian-chart/tooltip.d.ts +28 -0
  215. package/test-utils/dom/cartesian-chart/tooltip.js +48 -0
  216. package/test-utils/dom/cartesian-chart/tooltip.js.map +1 -0
  217. package/test-utils/dom/index.d.ts +46 -0
  218. package/test-utils/dom/index.js +35 -0
  219. package/test-utils/dom/index.js.map +1 -0
  220. package/test-utils/dom/internal/base.d.ts +93 -0
  221. package/test-utils/dom/internal/base.js +146 -0
  222. package/test-utils/dom/internal/base.js.map +1 -0
  223. package/test-utils/dom/internal/core.d.ts +14 -0
  224. package/test-utils/dom/internal/core.js +37 -0
  225. package/test-utils/dom/internal/core.js.map +1 -0
  226. package/test-utils/dom/pie-chart/index.d.ts +17 -0
  227. package/test-utils/dom/pie-chart/index.js +29 -0
  228. package/test-utils/dom/pie-chart/index.js.map +1 -0
  229. package/test-utils/selectors/cartesian-chart/index.d.ts +14 -0
  230. package/test-utils/selectors/cartesian-chart/index.js +24 -0
  231. package/test-utils/selectors/cartesian-chart/index.js.map +1 -0
  232. package/test-utils/selectors/cartesian-chart/tooltip.d.ts +28 -0
  233. package/test-utils/selectors/cartesian-chart/tooltip.js +48 -0
  234. package/test-utils/selectors/cartesian-chart/tooltip.js.map +1 -0
  235. package/test-utils/selectors/index.d.ts +46 -0
  236. package/test-utils/selectors/index.js +32 -0
  237. package/test-utils/selectors/index.js.map +1 -0
  238. package/test-utils/selectors/internal/base.d.ts +93 -0
  239. package/test-utils/selectors/internal/base.js +146 -0
  240. package/test-utils/selectors/internal/base.js.map +1 -0
  241. package/test-utils/selectors/internal/core.d.ts +14 -0
  242. package/test-utils/selectors/internal/core.js +37 -0
  243. package/test-utils/selectors/internal/core.js.map +1 -0
  244. package/test-utils/selectors/pie-chart/index.d.ts +17 -0
  245. package/test-utils/selectors/pie-chart/index.js +29 -0
  246. package/test-utils/selectors/pie-chart/index.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cartesian-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EACE,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,SAAS,EACpB,iBAAiB,GAAG,IAAI,EACxB,0BAA0B,GAAG,KAAK,EAClC,GAAG,KAAK,EACY,EACtB,GAAuC,EACvC,EAAE;IACF,0FAA0F;IAC1F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,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AE,cAAc,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAQ;IAER,OAAO;QACL,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;QAChB,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK;QAClB,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,YAAY,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY;QAChC,UAAU,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU;QAC5B,cAAc,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc;KAChC,CAAC;AACT,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA4C;;IAE5C,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI;QACjC,SAAS,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,QAAQ;QACzC,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,MAA0C;;IAE1C,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PointDataItemType, RangeDataItemOptions } from \"../core/interfaces\";\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalCartesianChart } from \"./chart-cartesian-internal\";\nimport { CartesianChartProps } from \"./interfaces\";\n\nexport type { CartesianChartProps };\n\nconst CartesianChart = forwardRef(\n (\n {\n fitHeight = false,\n inverted = false,\n stacking = undefined,\n emphasizeBaseline = true,\n verticalAxisTitlePlacement = \"top\",\n ...props\n }: CartesianChartProps,\n ref: React.Ref<CartesianChartProps.Ref>,\n ) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series, stacking);\n const xAxis = transformXAxisOptions(props.xAxis);\n const yAxis = transformYAxisOptions(props.yAxis);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"CartesianChart\", {\n props: { fitHeight, inverted, stacking, emphasizeBaseline, verticalAxisTitlePlacement },\n metadata: {},\n });\n\n return (\n <InternalCartesianChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n inverted={inverted}\n stacking={stacking}\n emphasizeBaseline={emphasizeBaseline}\n verticalAxisTitlePlacement={verticalAxisTitlePlacement}\n series={series}\n xAxis={xAxis}\n yAxis={yAxis}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n },\n);\n\napplyDisplayName(CartesianChart, \"CartesianChart\");\n\nexport default CartesianChart;\n\nfunction transformSeries(\n untransformedSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): CartesianChartProps.SeriesOptions[] {\n const transformedSeries: CartesianChartProps.SeriesOptions[] = [];\n function transformSingleSeries(s: CartesianChartProps.SeriesOptions): null | CartesianChartProps.SeriesOptions {\n switch (s.type) {\n case \"area\":\n case \"areaspline\":\n case \"line\":\n case \"spline\":\n return transformLineLikeSeries(s);\n case \"column\":\n return transformColumnSeries(s);\n case \"scatter\":\n return transformScatterSeries(s);\n case \"errorbar\":\n return transformErrorBarSeries(s, untransformedSeries, stacking);\n case \"x-threshold\":\n case \"y-threshold\":\n return transformThresholdSeries(s);\n default:\n return null;\n }\n }\n for (const series of untransformedSeries) {\n const transformed = transformSingleSeries(series);\n if (transformed) {\n transformedSeries.push(transformed);\n }\n }\n return transformedSeries;\n}\n\nfunction transformLineLikeSeries<\n S extends\n | CartesianChartProps.AreaSeriesOptions\n | CartesianChartProps.AreaSplineSeriesOptions\n | CartesianChartProps.LineSeriesOptions\n | CartesianChartProps.SplineSeriesOptions,\n>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, data } as S;\n}\n\nfunction transformColumnSeries<S extends CartesianChartProps.ColumnSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, data } as S;\n}\n\nfunction transformScatterSeries<S extends CartesianChartProps.ScatterSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n const marker = s.marker ?? {};\n return { type: s.type, id: s.id, name: s.name, color: s.color, data, marker } as S;\n}\n\nfunction transformThresholdSeries<\n S extends CartesianChartProps.XThresholdSeriesOptions | CartesianChartProps.YThresholdSeriesOptions,\n>(s: S): null | S {\n return { type: s.type, id: s.id, name: s.name, color: s.color, value: s.value } as S;\n}\n\nfunction transformErrorBarSeries(\n series: CartesianChartProps.ErrorBarSeriesOptions,\n allSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): null | CartesianChartProps.ErrorBarSeriesOptions {\n // Highcharts only supports error bars for non-stacked series.\n // See: https://github.com/highcharts/highcharts/issues/23080.\n if (stacking) {\n warnOnce(\"CartesianChart\", \"Error bars are not supported for stacked series.\");\n return null;\n }\n // We only support error bars that are linked to some other series. It is only possible to link it\n // using series ID (but not name), or by using \":previous\" pseudo-selector.\n // See: https://api.highcharts.com/highcharts/series.errorbar.linkedTo.\n const linkedSeries =\n series.linkedTo === \":previous\"\n ? allSeries[allSeries.indexOf(series) - 1]\n : allSeries.find(({ id }) => id === series.linkedTo);\n // The non-linked error bars are not supported: those will not appear in our custom legend and tooltip,\n // so we remove them from the series array. We also do not support linking them to other error bars,\n // or our custom threshold series.\n if (!linkedSeries || [\"errorbar\", \"x-threshold\", \"y-threshold\"].includes(linkedSeries.type)) {\n warnOnce(\n \"CartesianChart\",\n 'The `linkedTo` property of \"errorbar\" series points to a missing, or unsupported series.',\n );\n return null;\n }\n const data = transformRangeData(series.data);\n return { type: series.type, id: series.id, name: series.name, color: series.color, linkedTo: series.linkedTo, data };\n}\n\nfunction transformPointData(data: readonly PointDataItemType[]): readonly PointDataItemType[] {\n return data.map((d) => (d && typeof d === \"object\" ? { x: d.x, y: d.y } : d));\n}\n\nfunction transformRangeData(data: readonly RangeDataItemOptions[]): readonly RangeDataItemOptions[] {\n return data.map((d) => ({ x: d.x, low: d.low, high: d.high }));\n}\n\nfunction transformXAxisOptions(axis?: CartesianChartProps.XAxisOptions): CartesianChartProps.XAxisOptions {\n return transformAxisOptions(axis);\n}\n\nfunction transformYAxisOptions(axis?: CartesianChartProps.YAxisOptions): CartesianChartProps.YAxisOptions {\n return { ...transformAxisOptions(axis), reversedStacks: axis?.reversedStacks };\n}\n\nfunction transformAxisOptions<O extends CartesianChartProps.XAxisOptions | CartesianChartProps.YAxisOptions>(\n axis?: O,\n): O {\n return {\n type: axis?.type,\n title: axis?.title,\n min: axis?.min,\n max: axis?.max,\n tickInterval: axis?.tickInterval,\n categories: axis?.categories,\n valueFormatter: axis?.valueFormatter,\n } as O;\n}\n\nfunction transformTooltip(\n tooltip?: CartesianChartProps.TooltipOptions,\n): SomeRequired<CartesianChartProps.TooltipOptions, \"enabled\" | \"placement\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n placement: tooltip?.placement ?? \"middle\",\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(\n legend?: CartesianChartProps.LegendOptions,\n): SomeRequired<CartesianChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}
@@ -0,0 +1,166 @@
1
+ /// <reference types="react" />
2
+ import * as CoreTypes from "../core/interfaces";
3
+ import { NonCancelableEventHandler } from "../internal/events";
4
+ export interface CartesianChartProps extends CoreTypes.BaseChartOptions, CoreTypes.CoreCartesianOptions, CoreTypes.WithCartesianI18nStrings {
5
+ /**
6
+ * Inverts X and Y axes. Use it to show horizontal columns (bars).
7
+ * This property corresponds to [chart.inverted](https://api.highcharts.com/highcharts/chart.inverted).
8
+ */
9
+ inverted?: boolean;
10
+ /**
11
+ * Enables series stacking behavior. Use it for column- or area- series.
12
+ * This property corresponds to "normal" stacking type in Highcharts ([plotOptions.series.stacking](https://api.highcharts.com/highcharts/plotOptions.series.stacking)).
13
+ */
14
+ stacking?: "normal";
15
+ /**
16
+ * Defines series options of the chart.
17
+ * This property corresponds to [series](https://api.highcharts.com/highcharts/series), and extends it
18
+ * with two additional series types: "x-threshold", and "y-threshold".
19
+ *
20
+ * Supported types:
21
+ * * [area](https://api.highcharts.com/highcharts/series.area).
22
+ * * [areaspline](https://api.highcharts.com/highcharts/series.areaspline).
23
+ * * [column](https://api.highcharts.com/highcharts/series.column).
24
+ * * [errorbar](https://api.highcharts.com/highcharts/series.errorbar) - requires "highcharts/highcharts-more" module.
25
+ * * [line](https://api.highcharts.com/highcharts/series.line).
26
+ * * [scatter](https://api.highcharts.com/highcharts/series.scatter).
27
+ * * [spline](https://api.highcharts.com/highcharts/series.spline).
28
+ * * x-threshold - The line-like series to represent x-axis threshold (vertical, when `inverted=false`).
29
+ * * y-threshold - The line-like series to represent y-axis threshold (horizontal, when `inverted=false`).
30
+ */
31
+ series: readonly CartesianChartProps.SeriesOptions[];
32
+ /**
33
+ * Defines tooltip options of the chart, including:
34
+ * * `enabled` - (optional, boolean) - Hides the tooltip when set to false.
35
+ * * `size` - (optional, "small" | "medium" | "large") - Specifies max tooltip size.
36
+ * * `placement` - (optional, "middle" | "outside") - Specifies preferred tooltip placement.
37
+ * * `point` - (optional, function) - Customizes tooltip series point rendering.
38
+ * * `header` - (optional, function) - Renders a custom tooltip header.
39
+ * * `body` - (optional, function) - Renders a custom tooltip body.
40
+ * * `footer` - (optional, function) - Renders a custom tooltip footer.
41
+ */
42
+ tooltip?: CartesianChartProps.TooltipOptions;
43
+ /**
44
+ * Defines options of the chart's x axis.
45
+ * This property corresponds to [xAxis](https://api.highcharts.com/highcharts/xAxis), and extends it
46
+ * with a custom value formatter.
47
+ *
48
+ * Supported options:
49
+ * * `title` (optional, string) - Axis title.
50
+ * * `type` (optional, "linear" | "datetime" | "category" | "logarithmic") - Axis type.
51
+ * * * "linear" - Uses continuous proportional values scale.
52
+ * * * "datetime" - Similar to linear, but takes epoch time as values.
53
+ * * * "category" - Uses discrete scale, requires `categories` to be set.
54
+ * * * "logarithmic" - Uses continuous logarithmic values scale.
55
+ * * `min` (optional, number) - Axis min value boundary.
56
+ * * `max` (optional, number) - Axis max value boundary.
57
+ * * `tickInterval` (optional, number) - Distance between axis ticks.
58
+ * * `categories` (optional, Array<string>) - Predefined list of values, used for categorical axis type.
59
+ * * `valueFormatter` (optional, function) - Takes axis tick as input and returns a formatted string. This formatter also
60
+ * applies to the tooltip header.
61
+ */
62
+ xAxis?: CartesianChartProps.XAxisOptions;
63
+ /**
64
+ * Defines options of the chart's y axis.
65
+ * This property corresponds to [xAxis](https://api.highcharts.com/highcharts/yAxis), and extends it
66
+ * with a custom value formatter.
67
+ *
68
+ * Supported options:
69
+ * * `title` (optional, string) - Axis title.
70
+ * * `type` (optional, "linear" | "datetime" | "category" | "logarithmic") - Axis type.
71
+ * * * "linear" - Uses continuous proportional values scale.
72
+ * * * "datetime" - Similar to linear, but takes epoch time as values.
73
+ * * * "category" - Uses discrete scale, requires `categories` to be set.
74
+ * * * "logarithmic" - Uses continuous logarithmic values scale.
75
+ * * `min` (optional, number) - Axis min value boundary.
76
+ * * `max` (optional, number) - Axis max value boundary.
77
+ * * `tickInterval` (optional, number) - Distance between axis ticks.
78
+ * * `categories` (optional, Array<string>) - Predefined list of values, used for categorical axis type.
79
+ * * `reversedStacks` (optional, boolean) - Reverts series order in stacked series.
80
+ * * `valueFormatter` (optional, function) - Takes axis tick as input and returns a formatted string. This formatter also
81
+ * applies to the tooltip points values.
82
+ */
83
+ yAxis?: CartesianChartProps.YAxisOptions;
84
+ /**
85
+ * Specifies which series to show using their IDs. By default, all series are visible and managed by the component.
86
+ * If a series doesn't have an ID, its name is used. When using this property, manage state updates with `onVisibleSeriesChange`.
87
+ */
88
+ visibleSeries?: readonly string[];
89
+ /**
90
+ * A callback function, triggered when series visibility changes as a result of user interaction with the legend or filter.
91
+ */
92
+ onVisibleSeriesChange?: NonCancelableEventHandler<{
93
+ visibleSeries: string[];
94
+ }>;
95
+ }
96
+ export declare namespace CartesianChartProps {
97
+ export interface Ref {
98
+ /**
99
+ * Controls series visibility and works with both controlled and uncontrolled visibility modes.
100
+ */
101
+ setVisibleSeries(visibleSeries: readonly string[]): void;
102
+ /**
103
+ * Functions similarly to `setVisibleSeries`, but applies to all series and doesn't require series IDs as input.
104
+ * Use this when implementing clear-filter actions in no-match states.
105
+ */
106
+ showAllSeries(): void;
107
+ }
108
+ export type SeriesOptions = AreaSeriesOptions | AreaSplineSeriesOptions | ColumnSeriesOptions | ErrorBarSeriesOptions | LineSeriesOptions | ScatterSeriesOptions | SplineSeriesOptions | XThresholdSeriesOptions | YThresholdSeriesOptions;
109
+ export type AreaSeriesOptions = CoreTypes.AreaSeriesOptions;
110
+ export type AreaSplineSeriesOptions = CoreTypes.AreaSplineSeriesOptions;
111
+ export type ColumnSeriesOptions = CoreTypes.ColumnSeriesOptions;
112
+ export type ErrorBarSeriesOptions = CoreTypes.ErrorBarSeriesOptions;
113
+ export type LineSeriesOptions = CoreTypes.LineSeriesOptions;
114
+ export type ScatterSeriesOptions = CoreTypes.ScatterSeriesOptions;
115
+ export type SplineSeriesOptions = CoreTypes.SplineSeriesOptions;
116
+ export type XThresholdSeriesOptions = CoreTypes.XThresholdSeriesOptions;
117
+ export type YThresholdSeriesOptions = CoreTypes.YThresholdSeriesOptions;
118
+ interface AxisOptions {
119
+ title?: string;
120
+ type?: "linear" | "datetime" | "category" | "logarithmic";
121
+ min?: number;
122
+ max?: number;
123
+ tickInterval?: number;
124
+ categories?: string[];
125
+ valueFormatter?: (value: null | number) => string;
126
+ }
127
+ export type XAxisOptions = AxisOptions;
128
+ export interface YAxisOptions extends AxisOptions {
129
+ reversedStacks?: boolean;
130
+ }
131
+ export interface TooltipOptions {
132
+ enabled?: boolean;
133
+ placement?: "middle" | "outside";
134
+ size?: "small" | "medium" | "large";
135
+ point?: (props: TooltipPointRenderProps) => TooltipPointFormatted;
136
+ header?: (props: TooltipHeaderRenderProps) => React.ReactNode;
137
+ body?: (props: TooltipBodyRenderProps) => React.ReactNode;
138
+ footer?: (props: TooltipFooterRenderProps) => React.ReactNode;
139
+ }
140
+ export type TooltipHeaderRenderProps = TooltipSlotRenderProps;
141
+ export type TooltipBodyRenderProps = TooltipSlotRenderProps;
142
+ export type TooltipFooterRenderProps = TooltipSlotRenderProps;
143
+ export interface TooltipSlotRenderProps {
144
+ x: number;
145
+ items: TooltipPointItem[];
146
+ }
147
+ export interface TooltipPointRenderProps {
148
+ item: TooltipPointItem;
149
+ }
150
+ export interface TooltipPointItem {
151
+ x: number;
152
+ y: number | null;
153
+ errorRanges: {
154
+ low: number;
155
+ high: number;
156
+ series: CartesianChartProps.ErrorBarSeriesOptions;
157
+ }[];
158
+ series: NonErrorBarSeriesOptions;
159
+ }
160
+ export type TooltipPointFormatted = CoreTypes.BaseTooltipPointFormatted;
161
+ export type LegendOptions = CoreTypes.BaseLegendOptions;
162
+ export type FilterOptions = CoreTypes.BaseFilterOptions;
163
+ export type NoDataOptions = CoreTypes.BaseNoDataOptions;
164
+ export {};
165
+ }
166
+ export type NonErrorBarSeriesOptions = Exclude<CartesianChartProps.SeriesOptions, CartesianChartProps.ErrorBarSeriesOptions>;
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cartesian-chart/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport * as CoreTypes from \"../core/interfaces\";\nimport { NonCancelableEventHandler } from \"../internal/events\";\n\n// CartesianChartProps is the type for CartesianChart React component properties. Unlike in Highcharts API,\n// we pass options directly to the component, instead of grouping them all into a single \"options\" property.\n// We do still organize related options in groups, e.g.: \"SeriesOptions\", \"TooltipOptions\".\nexport interface CartesianChartProps\n extends CoreTypes.BaseChartOptions,\n CoreTypes.CoreCartesianOptions,\n CoreTypes.WithCartesianI18nStrings {\n /**\n * Inverts X and Y axes. Use it to show horizontal columns (bars).\n * This property corresponds to [chart.inverted](https://api.highcharts.com/highcharts/chart.inverted).\n */\n inverted?: boolean;\n\n /**\n * Enables series stacking behavior. Use it for column- or area- series.\n * This property corresponds to \"normal\" stacking type in Highcharts ([plotOptions.series.stacking](https://api.highcharts.com/highcharts/plotOptions.series.stacking)).\n */\n stacking?: \"normal\";\n\n /**\n * Defines series options of the chart.\n * This property corresponds to [series](https://api.highcharts.com/highcharts/series), and extends it\n * with two additional series types: \"x-threshold\", and \"y-threshold\".\n *\n * Supported types:\n * * [area](https://api.highcharts.com/highcharts/series.area).\n * * [areaspline](https://api.highcharts.com/highcharts/series.areaspline).\n * * [column](https://api.highcharts.com/highcharts/series.column).\n * * [errorbar](https://api.highcharts.com/highcharts/series.errorbar) - requires \"highcharts/highcharts-more\" module.\n * * [line](https://api.highcharts.com/highcharts/series.line).\n * * [scatter](https://api.highcharts.com/highcharts/series.scatter).\n * * [spline](https://api.highcharts.com/highcharts/series.spline).\n * * x-threshold - The line-like series to represent x-axis threshold (vertical, when `inverted=false`).\n * * y-threshold - The line-like series to represent y-axis threshold (horizontal, when `inverted=false`).\n */\n series: readonly CartesianChartProps.SeriesOptions[];\n\n /**\n * Defines tooltip options of the chart, including:\n * * `enabled` - (optional, boolean) - Hides the tooltip when set to false.\n * * `size` - (optional, \"small\" | \"medium\" | \"large\") - Specifies max tooltip size.\n * * `placement` - (optional, \"middle\" | \"outside\") - Specifies preferred tooltip placement.\n * * `point` - (optional, function) - Customizes tooltip series point rendering.\n * * `header` - (optional, function) - Renders a custom tooltip header.\n * * `body` - (optional, function) - Renders a custom tooltip body.\n * * `footer` - (optional, function) - Renders a custom tooltip footer.\n */\n tooltip?: CartesianChartProps.TooltipOptions;\n\n /**\n * Defines options of the chart's x axis.\n * This property corresponds to [xAxis](https://api.highcharts.com/highcharts/xAxis), and extends it\n * with a custom value formatter.\n *\n * Supported options:\n * * `title` (optional, string) - Axis title.\n * * `type` (optional, \"linear\" | \"datetime\" | \"category\" | \"logarithmic\") - Axis type.\n * * * \"linear\" - Uses continuous proportional values scale.\n * * * \"datetime\" - Similar to linear, but takes epoch time as values.\n * * * \"category\" - Uses discrete scale, requires `categories` to be set.\n * * * \"logarithmic\" - Uses continuous logarithmic values scale.\n * * `min` (optional, number) - Axis min value boundary.\n * * `max` (optional, number) - Axis max value boundary.\n * * `tickInterval` (optional, number) - Distance between axis ticks.\n * * `categories` (optional, Array<string>) - Predefined list of values, used for categorical axis type.\n * * `valueFormatter` (optional, function) - Takes axis tick as input and returns a formatted string. This formatter also\n * applies to the tooltip header.\n */\n xAxis?: CartesianChartProps.XAxisOptions;\n\n /**\n * Defines options of the chart's y axis.\n * This property corresponds to [xAxis](https://api.highcharts.com/highcharts/yAxis), and extends it\n * with a custom value formatter.\n *\n * Supported options:\n * * `title` (optional, string) - Axis title.\n * * `type` (optional, \"linear\" | \"datetime\" | \"category\" | \"logarithmic\") - Axis type.\n * * * \"linear\" - Uses continuous proportional values scale.\n * * * \"datetime\" - Similar to linear, but takes epoch time as values.\n * * * \"category\" - Uses discrete scale, requires `categories` to be set.\n * * * \"logarithmic\" - Uses continuous logarithmic values scale.\n * * `min` (optional, number) - Axis min value boundary.\n * * `max` (optional, number) - Axis max value boundary.\n * * `tickInterval` (optional, number) - Distance between axis ticks.\n * * `categories` (optional, Array<string>) - Predefined list of values, used for categorical axis type.\n * * `reversedStacks` (optional, boolean) - Reverts series order in stacked series.\n * * `valueFormatter` (optional, function) - Takes axis tick as input and returns a formatted string. This formatter also\n * applies to the tooltip points values.\n */\n yAxis?: CartesianChartProps.YAxisOptions;\n\n /**\n * Specifies which series to show using their IDs. By default, all series are visible and managed by the component.\n * If a series doesn't have an ID, its name is used. When using this property, manage state updates with `onVisibleSeriesChange`.\n */\n visibleSeries?: readonly string[];\n\n /**\n * A callback function, triggered when series visibility changes as a result of user interaction with the legend or filter.\n */\n onVisibleSeriesChange?: NonCancelableEventHandler<{ visibleSeries: string[] }>;\n}\n\nexport namespace CartesianChartProps {\n export interface Ref {\n /**\n * Controls series visibility and works with both controlled and uncontrolled visibility modes.\n */\n setVisibleSeries(visibleSeries: readonly string[]): void;\n /**\n * Functions similarly to `setVisibleSeries`, but applies to all series and doesn't require series IDs as input.\n * Use this when implementing clear-filter actions in no-match states.\n */\n showAllSeries(): void;\n }\n\n export type SeriesOptions =\n | AreaSeriesOptions\n | AreaSplineSeriesOptions\n | ColumnSeriesOptions\n | ErrorBarSeriesOptions\n | LineSeriesOptions\n | ScatterSeriesOptions\n | SplineSeriesOptions\n | XThresholdSeriesOptions\n | YThresholdSeriesOptions;\n\n export type AreaSeriesOptions = CoreTypes.AreaSeriesOptions;\n export type AreaSplineSeriesOptions = CoreTypes.AreaSplineSeriesOptions;\n export type ColumnSeriesOptions = CoreTypes.ColumnSeriesOptions;\n export type ErrorBarSeriesOptions = CoreTypes.ErrorBarSeriesOptions;\n export type LineSeriesOptions = CoreTypes.LineSeriesOptions;\n export type ScatterSeriesOptions = CoreTypes.ScatterSeriesOptions;\n export type SplineSeriesOptions = CoreTypes.SplineSeriesOptions;\n export type XThresholdSeriesOptions = CoreTypes.XThresholdSeriesOptions;\n export type YThresholdSeriesOptions = CoreTypes.YThresholdSeriesOptions;\n\n interface AxisOptions {\n title?: string;\n type?: \"linear\" | \"datetime\" | \"category\" | \"logarithmic\";\n min?: number;\n max?: number;\n tickInterval?: number;\n categories?: string[];\n valueFormatter?: (value: null | number) => string;\n }\n\n export type XAxisOptions = AxisOptions;\n\n export interface YAxisOptions extends AxisOptions {\n reversedStacks?: boolean;\n }\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\";\n size?: \"small\" | \"medium\" | \"large\";\n point?: (props: TooltipPointRenderProps) => TooltipPointFormatted;\n header?: (props: TooltipHeaderRenderProps) => React.ReactNode;\n body?: (props: TooltipBodyRenderProps) => React.ReactNode;\n footer?: (props: TooltipFooterRenderProps) => React.ReactNode;\n }\n export type TooltipHeaderRenderProps = TooltipSlotRenderProps;\n export type TooltipBodyRenderProps = TooltipSlotRenderProps;\n export type TooltipFooterRenderProps = TooltipSlotRenderProps;\n export interface TooltipSlotRenderProps {\n x: number;\n items: TooltipPointItem[];\n }\n export interface TooltipPointRenderProps {\n item: TooltipPointItem;\n }\n export interface TooltipPointItem {\n x: number;\n y: number | null;\n errorRanges: { low: number; high: number; series: CartesianChartProps.ErrorBarSeriesOptions }[];\n series: NonErrorBarSeriesOptions;\n }\n export type TooltipPointFormatted = CoreTypes.BaseTooltipPointFormatted;\n\n export type LegendOptions = CoreTypes.BaseLegendOptions;\n\n export type FilterOptions = CoreTypes.BaseFilterOptions;\n\n export type NoDataOptions = CoreTypes.BaseNoDataOptions;\n}\n\n// Internal types\n\nexport type NonErrorBarSeriesOptions = Exclude<\n CartesianChartProps.SeriesOptions,\n CartesianChartProps.ErrorBarSeriesOptions\n>;\n"]}
@@ -0,0 +1,6 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "root": "awsui_root_1rzjv_im8v7_5"
5
+ };
6
+
@@ -0,0 +1,7 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ .awsui_root_1rzjv_im8v7_5:not(#\9) {
6
+ /* used in test-utils */
7
+ }
@@ -0,0 +1,7 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {
5
+ "root": "awsui_root_1rzjv_im8v7_5"
6
+ };
7
+
@@ -0,0 +1,10 @@
1
+ import AsyncStore from "../../internal/utils/async-store";
2
+ import { ChartExtraContext } from "./chart-extra-context";
3
+ export interface ReactiveAxisTitlesState {
4
+ verticalAxesTitles: readonly string[];
5
+ }
6
+ export declare class ChartExtraAxisTitles extends AsyncStore<ReactiveAxisTitlesState> {
7
+ private context;
8
+ constructor(context: ChartExtraContext);
9
+ onChartRender: () => void;
10
+ }
@@ -0,0 +1,42 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import AsyncStore from "../../internal/utils/async-store";
4
+ import { getChartSeries } from "../../internal/utils/chart-series";
5
+ import { castArray, isEqualArrays } from "../../internal/utils/utils";
6
+ // Chart helper to fetch chart vertical axis labels for them to be rendered in a slot above the chart.
7
+ // See: https://github.com/highcharts/highcharts/issues/23174.
8
+ export class ChartExtraAxisTitles extends AsyncStore {
9
+ constructor(context) {
10
+ super({ verticalAxesTitles: [] });
11
+ this.onChartRender = () => {
12
+ const nextTitles = getVerticalAxesTitles(this.context.chart());
13
+ const currentTitles = this.get().verticalAxesTitles;
14
+ if (!isEqualArrays(currentTitles, nextTitles, (s1, s2) => s1 === s2)) {
15
+ this.set(() => ({ verticalAxesTitles: nextTitles }));
16
+ }
17
+ };
18
+ this.context = context;
19
+ }
20
+ }
21
+ function getVerticalAxesTitles(chart) {
22
+ var _a, _b, _c;
23
+ const isInverted = !!((_a = chart.options.chart) === null || _a === void 0 ? void 0 : _a.inverted);
24
+ const hasSeries = getChartSeries(chart.series).filter((s) => s.type !== "pie").length > 0;
25
+ // We extract multiple titles as there can be multiple axes. This supports up to 2 axes by
26
+ // using space-between placement of the labels in the corresponding component.
27
+ let titles = [];
28
+ if (hasSeries && isInverted) {
29
+ titles = ((_b = castArray(chart.options.xAxis)) !== null && _b !== void 0 ? _b : [])
30
+ .filter((axis) => axis.visible)
31
+ .map((axis) => { var _a, _b; return (_b = (_a = axis.title) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ""; })
32
+ .filter(Boolean);
33
+ }
34
+ if (hasSeries && !isInverted) {
35
+ titles = ((_c = castArray(chart.options.yAxis)) !== null && _c !== void 0 ? _c : [])
36
+ .filter((axis) => axis.visible)
37
+ .map((axis) => { var _a, _b; return (_b = (_a = axis.title) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ""; })
38
+ .filter(Boolean);
39
+ }
40
+ return titles;
41
+ }
42
+ //# sourceMappingURL=chart-extra-axis-titles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-extra-axis-titles.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-axis-titles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQtE,sGAAsG;AACtG,8DAA8D;AAC9D,MAAM,OAAO,oBAAqB,SAAQ,UAAmC;IAE3E,YAAY,OAA0B;QACpC,KAAK,CAAC,EA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I,mCAAI,EAAE,CAAA,EAAA,CAAC;aACrC,MAAM,CAAC,OAAO,CAAC,CAAC;KACpB;IACD,IAAI,SAAS,IAAI,CAAC,UAAU,EAAE;QAC5B,MAAM,GAAG,CAAC,MAAA,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;aAC5C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;aAC9B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,IAAI,mCAAI,EAAE,CAAA,EAAA,CAAC;aACrC,MAAM,CAAC,OAAO,CAAC,CAAC;KACpB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { castArray, isEqualArrays } from \"../../internal/utils/utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\n// The reactive state is used to propagate changes to the corresponding vertical axis titles React component.\nexport interface ReactiveAxisTitlesState {\n verticalAxesTitles: readonly string[];\n}\n\n// Chart helper to fetch chart vertical axis labels for them to be rendered in a slot above the chart.\n// See: https://github.com/highcharts/highcharts/issues/23174.\nexport class ChartExtraAxisTitles extends AsyncStore<ReactiveAxisTitlesState> {\n private context: ChartExtraContext;\n constructor(context: ChartExtraContext) {\n super({ verticalAxesTitles: [] });\n this.context = context;\n }\n\n public onChartRender = () => {\n const nextTitles = getVerticalAxesTitles(this.context.chart());\n const currentTitles = this.get().verticalAxesTitles;\n if (!isEqualArrays(currentTitles, nextTitles, (s1, s2) => s1 === s2)) {\n this.set(() => ({ verticalAxesTitles: nextTitles }));\n }\n };\n}\n\nfunction getVerticalAxesTitles(chart: Highcharts.Chart) {\n const isInverted = !!chart.options.chart?.inverted;\n const hasSeries = getChartSeries(chart.series).filter((s) => s.type !== \"pie\").length > 0;\n\n // We extract multiple titles as there can be multiple axes. This supports up to 2 axes by\n // using space-between placement of the labels in the corresponding component.\n let titles: string[] = [];\n if (hasSeries && isInverted) {\n titles = (castArray(chart.options.xAxis) ?? [])\n .filter((axis) => axis.visible)\n .map((axis) => axis.title?.text ?? \"\")\n .filter(Boolean);\n }\n if (hasSeries && !isInverted) {\n titles = (castArray(chart.options.yAxis) ?? [])\n .filter((axis) => axis.visible)\n .map((axis) => axis.title?.text ?? \"\")\n .filter(Boolean);\n }\n return titles;\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import type Highcharts from "highcharts";
2
+ import { NonCancelableEventHandler } from "../../internal/events";
3
+ import { ChartLabels } from "../i18n-utils";
4
+ import { CoreChartProps, Rect } from "../interfaces";
5
+ export interface ChartExtraContext {
6
+ settings: ChartExtraContext.Settings;
7
+ handlers: ChartExtraContext.Handlers;
8
+ state: ChartExtraContext.State;
9
+ derived: ChartExtraContext.DerivedState;
10
+ chartOrNull: null | Highcharts.Chart;
11
+ chart: () => Highcharts.Chart;
12
+ }
13
+ export declare namespace ChartExtraContext {
14
+ interface Settings {
15
+ chartId: string;
16
+ noDataEnabled: boolean;
17
+ legendEnabled: boolean;
18
+ tooltipEnabled: boolean;
19
+ keyboardNavigationEnabled: boolean;
20
+ labels: ChartLabels;
21
+ }
22
+ interface Handlers {
23
+ onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;
24
+ onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;
25
+ onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;
26
+ }
27
+ interface State {
28
+ visibleItems?: readonly string[];
29
+ }
30
+ interface DerivedState {
31
+ allX: number[];
32
+ getAllXInSeries: (series: Highcharts.Series) => number[];
33
+ getPointsByX: (x: number) => Highcharts.Point[];
34
+ groupRects: {
35
+ group: Highcharts.Point[];
36
+ rect: Rect;
37
+ }[];
38
+ }
39
+ }
40
+ export declare function createChartContext(): ChartExtraContext;
41
+ export declare function updateChartContext(context: ChartExtraContext, chart: Highcharts.Chart): void;
@@ -0,0 +1,93 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { getChartSeries } from "../../internal/utils/chart-series";
4
+ import { getSeriesData } from "../../internal/utils/series-data";
5
+ import { getGroupRect, isSeriesStacked } from "../utils";
6
+ // The context is created when the chart component is rendered for the first time.
7
+ // On every subsequent render the settings and state are updated directly in the context object.
8
+ export function createChartContext() {
9
+ return {
10
+ settings: {
11
+ chartId: "",
12
+ noDataEnabled: false,
13
+ legendEnabled: false,
14
+ tooltipEnabled: false,
15
+ keyboardNavigationEnabled: false,
16
+ labels: {},
17
+ },
18
+ handlers: {},
19
+ state: {},
20
+ chart: () => {
21
+ // Before the first chart render there is no chart instance, which is required for most of the utilities.
22
+ // Instead of doing null checks in each utility, an attempt to access the chart instance before it is ready
23
+ // will cause an exception, indicating an logical error in the code.
24
+ throw new Error("Invariant violation: using chart API before initialization.");
25
+ },
26
+ chartOrNull: null,
27
+ derived: { allX: [], getAllXInSeries: () => [], getPointsByX: () => [], groupRects: [] },
28
+ };
29
+ }
30
+ // The update method is called on every chart render, before any other initialization code.
31
+ // This ensures the context state is up to date and can be used for subsequent computations.
32
+ export function updateChartContext(context, chart) {
33
+ context.chart = () => chart;
34
+ context.chartOrNull = chart;
35
+ context.derived = computeDerivedState(chart);
36
+ }
37
+ function computeDerivedState(chart) {
38
+ const allXSet = new Set();
39
+ const allXInSeries = new WeakMap();
40
+ const pointsByX = new Map();
41
+ const getXPoints = (x) => { var _a; return (_a = pointsByX.get(x)) !== null && _a !== void 0 ? _a : []; };
42
+ const addPoint = (point) => {
43
+ const xPoints = getXPoints(point.x);
44
+ xPoints.push(point);
45
+ pointsByX.set(point.x, xPoints);
46
+ };
47
+ const compareX = (a, b) => a - b;
48
+ for (const s of getChartSeries(chart.series)) {
49
+ const seriesX = new Set();
50
+ if (s.visible) {
51
+ for (const d of getSeriesData(s.data)) {
52
+ // Points with y=null represent the absence of value, there is no need to include them and those
53
+ // should have no impact on computed rects or navigation.
54
+ // Although "d" can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints
55
+ // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)
56
+ if (d.visible && d.y !== null) {
57
+ seriesX.add(d.x);
58
+ allXSet.add(d.x);
59
+ addPoint(d);
60
+ }
61
+ }
62
+ }
63
+ allXInSeries.set(s, Array.from(seriesX).sort(compareX));
64
+ }
65
+ for (const [, points] of pointsByX) {
66
+ sortPoints(points);
67
+ }
68
+ const allX = Array.from(allXSet).sort(compareX);
69
+ return {
70
+ allX,
71
+ getAllXInSeries: (s) => { var _a; return (_a = allXInSeries.get(s)) !== null && _a !== void 0 ? _a : []; },
72
+ getPointsByX: (x) => { var _a; return (_a = pointsByX.get(x)) !== null && _a !== void 0 ? _a : []; },
73
+ // Group rects are computed for every available x coordinate, each including at least one point with matching x value.
74
+ // They enclose all matching points of the group and are used to match hover position and place the tooltip or focus outline.
75
+ groupRects: allX.map((x) => ({
76
+ group: getXPoints(x),
77
+ rect: getGroupRect(getXPoints(x)),
78
+ })),
79
+ };
80
+ }
81
+ // The points are sorted to ensure consistent navigation, including inverted chart orientation.
82
+ // The order of series in grouped column charts is kept, while stacked series are sorted by their
83
+ // respective positions in the plot.
84
+ function sortPoints(group) {
85
+ var _a, _b;
86
+ const reversed = !!((_b = (_a = group[0]) === null || _a === void 0 ? void 0 : _a.series.yAxis) === null || _b === void 0 ? void 0 : _b.reversed);
87
+ group.sort((a, b) => {
88
+ const ay = a.plotY === undefined || (a.series.type === "column" && !isSeriesStacked(a.series)) ? 0 : a.plotY;
89
+ const by = b.plotY === undefined || (b.series.type === "column" && !isSeriesStacked(b.series)) ? 0 : b.plotY;
90
+ return !reversed ? ay - by : by - ay;
91
+ });
92
+ }
93
+ //# sourceMappingURL=chart-extra-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-extra-context.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA4CzD,kFAAkF;AAClF,gGAAgG;AAChG,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,QAAQ,EAAE;YACR,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;YACrB,yBAAyB,EAAE,KAAK;YAChC,MAAM,EAAE,EAAE;SACX;QACD,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,GAAG,EAAE;YACV,yGAAyG;YACzG,2GAA2G;YAC3G,oEAAoE;YACpE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;KACzF,CAAC;AACJ,CAAC;AAED,2FAA2F;AAC3F,4FAA4F;AAC5F,MAAM,UAAU,kBAAkB,CAAC,OAA0B,EAAE,KAAuB;IACpF,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;IAC5B,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;IAC5B,OAAO,CAAC,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,SAA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AM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { NonCancelableEventHandler } from \"../../internal/events\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { getSeriesData } from \"../../internal/utils/series-data\";\nimport { ChartLabels } from \"../i18n-utils\";\nimport { CoreChartProps, Rect } from \"../interfaces\";\nimport { getGroupRect, isSeriesStacked } from \"../utils\";\n\n// Chart API context is used for dependency injection for chart utilities.\n// It is initialized on chart render, and includes the chart instance, consumer\n// settings and state, and derived state, which is computed from the chart instance\n// on each render, and reused across utilities to avoid duplicate work.\n\nexport interface ChartExtraContext {\n settings: ChartExtraContext.Settings;\n handlers: ChartExtraContext.Handlers;\n state: ChartExtraContext.State;\n derived: ChartExtraContext.DerivedState;\n chartOrNull: null | Highcharts.Chart;\n chart: () => Highcharts.Chart;\n}\n\nexport namespace ChartExtraContext {\n export interface Settings {\n chartId: string;\n noDataEnabled: boolean;\n legendEnabled: boolean;\n tooltipEnabled: boolean;\n keyboardNavigationEnabled: boolean;\n labels: ChartLabels;\n }\n\n export interface Handlers {\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n }\n\n export interface State {\n visibleItems?: readonly string[];\n }\n\n export interface DerivedState {\n allX: number[];\n getAllXInSeries: (series: Highcharts.Series) => number[];\n getPointsByX: (x: number) => Highcharts.Point[];\n groupRects: { group: Highcharts.Point[]; rect: Rect }[];\n }\n}\n\n// The context is created when the chart component is rendered for the first time.\n// On every subsequent render the settings and state are updated directly in the context object.\nexport function createChartContext(): ChartExtraContext {\n return {\n settings: {\n chartId: \"\",\n noDataEnabled: false,\n legendEnabled: false,\n tooltipEnabled: false,\n keyboardNavigationEnabled: false,\n labels: {},\n },\n handlers: {},\n state: {},\n chart: () => {\n // Before the first chart render there is no chart instance, which is required for most of the utilities.\n // Instead of doing null checks in each utility, an attempt to access the chart instance before it is ready\n // will cause an exception, indicating an logical error in the code.\n throw new Error(\"Invariant violation: using chart API before initialization.\");\n },\n chartOrNull: null,\n derived: { allX: [], getAllXInSeries: () => [], getPointsByX: () => [], groupRects: [] },\n };\n}\n\n// The update method is called on every chart render, before any other initialization code.\n// This ensures the context state is up to date and can be used for subsequent computations.\nexport function updateChartContext(context: ChartExtraContext, chart: Highcharts.Chart) {\n context.chart = () => chart;\n context.chartOrNull = chart;\n context.derived = computeDerivedState(chart);\n}\n\nfunction computeDerivedState(chart: Highcharts.Chart): ChartExtraContext.DerivedState {\n const allXSet = new Set<number>();\n const allXInSeries = new WeakMap<Highcharts.Series, number[]>();\n const pointsByX = new Map<number, Highcharts.Point[]>();\n const getXPoints = (x: number) => pointsByX.get(x) ?? [];\n const addPoint = (point: Highcharts.Point) => {\n const xPoints = getXPoints(point.x);\n xPoints.push(point);\n pointsByX.set(point.x, xPoints);\n };\n const compareX = (a: number, b: number) => a - b;\n\n for (const s of getChartSeries(chart.series)) {\n const seriesX = new Set<number>();\n if (s.visible) {\n for (const d of getSeriesData(s.data)) {\n // Points with y=null represent the absence of value, there is no need to include them and those\n // should have no impact on computed rects or navigation.\n\n // Although \"d\" can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints\n // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)\n if (d.visible && d.y !== null) {\n seriesX.add(d.x);\n allXSet.add(d.x);\n addPoint(d);\n }\n }\n }\n allXInSeries.set(s, Array.from(seriesX).sort(compareX));\n }\n for (const [, points] of pointsByX) {\n sortPoints(points);\n }\n const allX = Array.from(allXSet).sort(compareX);\n return {\n allX,\n getAllXInSeries: (s) => allXInSeries.get(s) ?? [],\n getPointsByX: (x) => pointsByX.get(x) ?? [],\n // Group rects are computed for every available x coordinate, each including at least one point with matching x value.\n // They enclose all matching points of the group and are used to match hover position and place the tooltip or focus outline.\n groupRects: allX.map((x) => ({\n group: getXPoints(x),\n rect: getGroupRect(getXPoints(x)),\n })),\n };\n}\n\n// The points are sorted to ensure consistent navigation, including inverted chart orientation.\n// The order of series in grouped column charts is kept, while stacked series are sorted by their\n// respective positions in the plot.\nfunction sortPoints(group: Highcharts.Point[]) {\n const reversed = !!group[0]?.series.yAxis?.reversed;\n group.sort((a, b) => {\n const ay = a.plotY === undefined || (a.series.type === \"column\" && !isSeriesStacked(a.series)) ? 0 : a.plotY;\n const by = b.plotY === undefined || (b.series.type === \"column\" && !isSeriesStacked(b.series)) ? 0 : b.plotY;\n return !reversed ? ay - by : by - ay;\n });\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type Highcharts from "highcharts";
2
+ import { ChartExtraContext } from "./chart-extra-context";
3
+ export declare class ChartExtraHighlight {
4
+ private context;
5
+ constructor(context: ChartExtraContext);
6
+ private seriesState;
7
+ private pointState;
8
+ onChartRender(): void;
9
+ highlightChartItems: (itemIds: readonly string[]) => void;
10
+ highlightChartGroup: (points: readonly Highcharts.Point[]) => void;
11
+ highlightChartPoint: (point: Highcharts.Point) => void;
12
+ clearChartItemsHighlight: () => void;
13
+ private setSeriesState;
14
+ private setPointState;
15
+ private restoreHighlightState;
16
+ private updateStoredSeriesState;
17
+ private updateStoredPointState;
18
+ private getPointKey;
19
+ private overrideStateSetters;
20
+ }