@rowsncolumns/charts 27.0.34 → 28.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cjs/atoms/pivot-chart.atom.d.ts +14 -0
  2. package/dist/cjs/atoms/pivot-chart.atom.d.ts.map +1 -0
  3. package/dist/cjs/atoms/pivot-chart.atom.js +9 -0
  4. package/dist/cjs/basic-chart/basic-chart.d.ts +1 -1
  5. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  6. package/dist/cjs/basic-chart/basic-chart.js +863 -371
  7. package/dist/cjs/components/dialogs/pivot-chart-dialog.d.ts +39 -0
  8. package/dist/cjs/components/dialogs/pivot-chart-dialog.d.ts.map +1 -0
  9. package/dist/cjs/components/dialogs/pivot-chart-dialog.js +100 -0
  10. package/dist/cjs/components/editors/chart-editor.d.ts +13 -1
  11. package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
  12. package/dist/cjs/components/editors/chart-editor.js +225 -59
  13. package/dist/cjs/config.d.ts.map +1 -1
  14. package/dist/cjs/config.js +149 -12
  15. package/dist/cjs/hooks/use-charts.d.ts +21 -6
  16. package/dist/cjs/hooks/use-charts.d.ts.map +1 -1
  17. package/dist/cjs/hooks/use-charts.js +13 -1
  18. package/dist/cjs/hooks/use-on-create-chart.d.ts.map +1 -1
  19. package/dist/cjs/hooks/use-on-create-chart.js +7 -1
  20. package/dist/cjs/hooks/use-on-move-chart-to-sheet.d.ts +12 -0
  21. package/dist/cjs/hooks/use-on-move-chart-to-sheet.d.ts.map +1 -0
  22. package/dist/cjs/hooks/use-on-move-chart-to-sheet.js +26 -0
  23. package/dist/cjs/hooks/use-on-move-chart.d.ts +1 -1
  24. package/dist/cjs/hooks/use-on-move-chart.d.ts.map +1 -1
  25. package/dist/cjs/hooks/use-on-move-chart.js +2 -2
  26. package/dist/cjs/hooks/use-on-resize-chart.d.ts +1 -1
  27. package/dist/cjs/hooks/use-on-resize-chart.d.ts.map +1 -1
  28. package/dist/cjs/hooks/use-on-resize-chart.js +2 -2
  29. package/dist/cjs/index.d.ts +11 -0
  30. package/dist/cjs/index.d.ts.map +1 -1
  31. package/dist/cjs/index.js +34 -1
  32. package/dist/cjs/interface/create-chart.d.ts.map +1 -1
  33. package/dist/cjs/interface/create-chart.js +33 -42
  34. package/dist/cjs/interface/delete-chart.d.ts.map +1 -1
  35. package/dist/cjs/interface/delete-chart.js +4 -0
  36. package/dist/cjs/interface/move-chart-to-sheet.d.ts +13 -0
  37. package/dist/cjs/interface/move-chart-to-sheet.d.ts.map +1 -0
  38. package/dist/cjs/interface/move-chart-to-sheet.js +136 -0
  39. package/dist/cjs/interface/move-chart.d.ts +2 -2
  40. package/dist/cjs/interface/move-chart.d.ts.map +1 -1
  41. package/dist/cjs/interface/move-chart.js +7 -1
  42. package/dist/cjs/interface/resize-chart.d.ts +2 -2
  43. package/dist/cjs/interface/resize-chart.d.ts.map +1 -1
  44. package/dist/cjs/interface/resize-chart.js +7 -1
  45. package/dist/cjs/interface/update-chart.d.ts.map +1 -1
  46. package/dist/cjs/interface/update-chart.js +4 -0
  47. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts +1 -1
  48. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  49. package/dist/cjs/plotly/basic-chart/basic-chart.js +970 -585
  50. package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
  51. package/dist/cjs/plotly/basic-chart/helpers.js +3 -0
  52. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  53. package/dist/cjs/types.d.ts +7 -0
  54. package/dist/cjs/types.d.ts.map +1 -1
  55. package/dist/cjs/utils/axis-number-format.d.ts +69 -0
  56. package/dist/cjs/utils/axis-number-format.d.ts.map +1 -0
  57. package/dist/cjs/utils/axis-number-format.js +217 -0
  58. package/dist/cjs/utils/category-levels.d.ts +27 -0
  59. package/dist/cjs/utils/category-levels.d.ts.map +1 -0
  60. package/dist/cjs/utils/category-levels.js +80 -0
  61. package/dist/cjs/utils/chart-image.d.ts +8 -0
  62. package/dist/cjs/utils/chart-image.d.ts.map +1 -0
  63. package/dist/cjs/utils/chart-image.js +28 -0
  64. package/dist/cjs/utils/chart-orientation.d.ts +67 -0
  65. package/dist/cjs/utils/chart-orientation.d.ts.map +1 -0
  66. package/dist/cjs/utils/chart-orientation.js +265 -0
  67. package/dist/cjs/utils/chart-spec-utils.d.ts +3 -0
  68. package/dist/cjs/utils/chart-spec-utils.d.ts.map +1 -1
  69. package/dist/cjs/utils/chart-spec-utils.js +12 -4
  70. package/dist/cjs/utils/chart-styles.d.ts +75 -0
  71. package/dist/cjs/utils/chart-styles.d.ts.map +1 -0
  72. package/dist/cjs/utils/chart-styles.js +283 -0
  73. package/dist/cjs/utils/empty-cells.d.ts +30 -0
  74. package/dist/cjs/utils/empty-cells.d.ts.map +1 -0
  75. package/dist/cjs/utils/empty-cells.js +91 -0
  76. package/dist/cjs/utils/overrides.d.ts +6 -1
  77. package/dist/cjs/utils/overrides.d.ts.map +1 -1
  78. package/dist/cjs/utils/overrides.js +19 -7
  79. package/dist/cjs/utils/pie-explosion.d.ts +30 -0
  80. package/dist/cjs/utils/pie-explosion.d.ts.map +1 -0
  81. package/dist/cjs/utils/pie-explosion.js +55 -0
  82. package/dist/cjs/utils/plotly-click.d.ts +34 -0
  83. package/dist/cjs/utils/plotly-click.d.ts.map +1 -0
  84. package/dist/cjs/utils/plotly-click.js +49 -0
  85. package/dist/cjs/utils/plotly-surface.d.ts +14 -0
  86. package/dist/cjs/utils/plotly-surface.d.ts.map +1 -0
  87. package/dist/cjs/utils/plotly-surface.js +64 -0
  88. package/dist/cjs/utils/plotly-title.d.ts +12 -0
  89. package/dist/cjs/utils/plotly-title.d.ts.map +1 -0
  90. package/dist/cjs/utils/plotly-title.js +24 -0
  91. package/dist/cjs/utils/series-click.d.ts +39 -0
  92. package/dist/cjs/utils/series-click.d.ts.map +1 -0
  93. package/dist/cjs/utils/series-click.js +75 -0
  94. package/dist/cjs/utils/three-d.d.ts +17 -1
  95. package/dist/cjs/utils/three-d.d.ts.map +1 -1
  96. package/dist/cjs/utils/three-d.js +32 -4
  97. package/dist/esm/atoms/pivot-chart.atom.d.ts +14 -0
  98. package/dist/esm/atoms/pivot-chart.atom.d.ts.map +1 -0
  99. package/dist/esm/atoms/pivot-chart.atom.js +4 -0
  100. package/dist/esm/basic-chart/basic-chart.d.ts +1 -1
  101. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  102. package/dist/esm/basic-chart/basic-chart.js +680 -178
  103. package/dist/esm/components/dialogs/pivot-chart-dialog.d.ts +39 -0
  104. package/dist/esm/components/dialogs/pivot-chart-dialog.d.ts.map +1 -0
  105. package/dist/esm/components/dialogs/pivot-chart-dialog.js +89 -0
  106. package/dist/esm/components/editors/chart-editor.d.ts +13 -1
  107. package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
  108. package/dist/esm/components/editors/chart-editor.js +164 -20
  109. package/dist/esm/config.d.ts.map +1 -1
  110. package/dist/esm/config.js +149 -12
  111. package/dist/esm/hooks/use-charts.d.ts +21 -6
  112. package/dist/esm/hooks/use-charts.d.ts.map +1 -1
  113. package/dist/esm/hooks/use-charts.js +13 -1
  114. package/dist/esm/hooks/use-on-create-chart.d.ts.map +1 -1
  115. package/dist/esm/hooks/use-on-create-chart.js +7 -1
  116. package/dist/esm/hooks/use-on-move-chart-to-sheet.d.ts +12 -0
  117. package/dist/esm/hooks/use-on-move-chart-to-sheet.d.ts.map +1 -0
  118. package/dist/esm/hooks/use-on-move-chart-to-sheet.js +19 -0
  119. package/dist/esm/hooks/use-on-move-chart.d.ts +1 -1
  120. package/dist/esm/hooks/use-on-move-chart.d.ts.map +1 -1
  121. package/dist/esm/hooks/use-on-move-chart.js +2 -2
  122. package/dist/esm/hooks/use-on-resize-chart.d.ts +1 -1
  123. package/dist/esm/hooks/use-on-resize-chart.d.ts.map +1 -1
  124. package/dist/esm/hooks/use-on-resize-chart.js +2 -2
  125. package/dist/esm/index.d.ts +11 -0
  126. package/dist/esm/index.d.ts.map +1 -1
  127. package/dist/esm/index.js +14 -0
  128. package/dist/esm/interface/create-chart.d.ts.map +1 -1
  129. package/dist/esm/interface/create-chart.js +36 -58
  130. package/dist/esm/interface/delete-chart.d.ts.map +1 -1
  131. package/dist/esm/interface/delete-chart.js +4 -0
  132. package/dist/esm/interface/move-chart-to-sheet.d.ts +13 -0
  133. package/dist/esm/interface/move-chart-to-sheet.d.ts.map +1 -0
  134. package/dist/esm/interface/move-chart-to-sheet.js +126 -0
  135. package/dist/esm/interface/move-chart.d.ts +2 -2
  136. package/dist/esm/interface/move-chart.d.ts.map +1 -1
  137. package/dist/esm/interface/move-chart.js +7 -1
  138. package/dist/esm/interface/resize-chart.d.ts +2 -2
  139. package/dist/esm/interface/resize-chart.d.ts.map +1 -1
  140. package/dist/esm/interface/resize-chart.js +7 -1
  141. package/dist/esm/interface/update-chart.d.ts.map +1 -1
  142. package/dist/esm/interface/update-chart.js +4 -0
  143. package/dist/esm/plotly/basic-chart/basic-chart.d.ts +1 -1
  144. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  145. package/dist/esm/plotly/basic-chart/basic-chart.js +858 -463
  146. package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
  147. package/dist/esm/plotly/basic-chart/helpers.js +3 -0
  148. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  149. package/dist/esm/types.d.ts +7 -0
  150. package/dist/esm/types.d.ts.map +1 -1
  151. package/dist/esm/utils/axis-number-format.d.ts +69 -0
  152. package/dist/esm/utils/axis-number-format.d.ts.map +1 -0
  153. package/dist/esm/utils/axis-number-format.js +170 -0
  154. package/dist/esm/utils/category-levels.d.ts +27 -0
  155. package/dist/esm/utils/category-levels.d.ts.map +1 -0
  156. package/dist/esm/utils/category-levels.js +65 -0
  157. package/dist/esm/utils/chart-image.d.ts +8 -0
  158. package/dist/esm/utils/chart-image.d.ts.map +1 -0
  159. package/dist/esm/utils/chart-image.js +24 -0
  160. package/dist/esm/utils/chart-orientation.d.ts +67 -0
  161. package/dist/esm/utils/chart-orientation.d.ts.map +1 -0
  162. package/dist/esm/utils/chart-orientation.js +234 -0
  163. package/dist/esm/utils/chart-spec-utils.d.ts +3 -0
  164. package/dist/esm/utils/chart-spec-utils.d.ts.map +1 -1
  165. package/dist/esm/utils/chart-spec-utils.js +10 -2
  166. package/dist/esm/utils/chart-styles.d.ts +75 -0
  167. package/dist/esm/utils/chart-styles.d.ts.map +1 -0
  168. package/dist/esm/utils/chart-styles.js +357 -0
  169. package/dist/esm/utils/empty-cells.d.ts +30 -0
  170. package/dist/esm/utils/empty-cells.d.ts.map +1 -0
  171. package/dist/esm/utils/empty-cells.js +67 -0
  172. package/dist/esm/utils/overrides.d.ts +6 -1
  173. package/dist/esm/utils/overrides.d.ts.map +1 -1
  174. package/dist/esm/utils/overrides.js +14 -2
  175. package/dist/esm/utils/pie-explosion.d.ts +30 -0
  176. package/dist/esm/utils/pie-explosion.d.ts.map +1 -0
  177. package/dist/esm/utils/pie-explosion.js +43 -0
  178. package/dist/esm/utils/plotly-click.d.ts +34 -0
  179. package/dist/esm/utils/plotly-click.d.ts.map +1 -0
  180. package/dist/esm/utils/plotly-click.js +44 -0
  181. package/dist/esm/utils/plotly-surface.d.ts +14 -0
  182. package/dist/esm/utils/plotly-surface.d.ts.map +1 -0
  183. package/dist/esm/utils/plotly-surface.js +45 -0
  184. package/dist/esm/utils/plotly-title.d.ts +12 -0
  185. package/dist/esm/utils/plotly-title.d.ts.map +1 -0
  186. package/dist/esm/utils/plotly-title.js +20 -0
  187. package/dist/esm/utils/series-click.d.ts +39 -0
  188. package/dist/esm/utils/series-click.d.ts.map +1 -0
  189. package/dist/esm/utils/series-click.js +66 -0
  190. package/dist/esm/utils/three-d.d.ts +17 -1
  191. package/dist/esm/utils/three-d.d.ts.map +1 -1
  192. package/dist/esm/utils/three-d.js +29 -3
  193. package/package.json +16 -12
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../plotly/basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,qBAAqB,GAChC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KACvC,MA+DF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;;;;;;;;CAgBzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAChC,MAAM,GAAG,SA0BX,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,YAejE,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../plotly/basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,qBAAqB,GAChC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KACvC,MAmEF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;;;;;;;;CAgBzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAChC,MAAM,GAAG,SA0BX,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,YAejE,CAAC"}
@@ -13,6 +13,9 @@ var chartTypeToPlotlyType = function (type) {
13
13
  return "bar";
14
14
  case "pie":
15
15
  return "pie";
16
+ // Doughnut is a pie trace with `hole` set (see basic-chart.tsx).
17
+ case "doughnut":
18
+ return "pie";
16
19
  case "treemap":
17
20
  return "treemap";
18
21
  case "sunburst":
@@ -1 +1 @@
1
- {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/chart-spec-utils.ts","../../utils/echarts-gl-loader.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
1
+ {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/echarts-gl-loader.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
@@ -14,6 +14,13 @@ export type EChartComponentProps = ChartComponentProps & {
14
14
  * Get all effective values from a series
15
15
  */
16
16
  getSeriesValuesFromRange: ReturnType<typeof useSpreadsheetState>["getSeriesValuesFromRange"];
17
+ /**
18
+ * Get the effective cell formats of a range. Feeds Excel's "Linked to
19
+ * source" number format for value-axis tick labels, data labels and
20
+ * tooltips. Without it only an explicit axis `numberFormatPattern` is
21
+ * honored.
22
+ */
23
+ getFormattingFromRange?: ReturnType<typeof useSpreadsheetState>["getFormattingFromRange"];
17
24
  /**
18
25
  * Request edit chart
19
26
  * @param chart
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC;CAC7E,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,UAAU,CACjC,OAAO,mBAAmB,CAC3B,CAAC,wBAAwB,CAAC,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC;CAC7E,CAAC"}
@@ -0,0 +1,69 @@
1
+ import type { ChartData, HIDDEN_DIMENSION_STRATEGY, Maybe, SheetRange } from "@rowsncolumns/spreadsheet";
2
+ type RangeFormatReader = (sheetRange: SheetRange, hiddenDimensionStrategy?: HIDDEN_DIMENSION_STRATEGY) => unknown[];
3
+ /**
4
+ * `General` (or nothing) means "let the renderer pick" — it carries no
5
+ * formatting. So does the bare-`#` shape the engines infer when a plain
6
+ * number is typed (`#`, `#.0`): Excel leaves such cells General, and `#`
7
+ * would blank every fractional tick below 0.5.
8
+ */
9
+ export declare const isGeneralNumberFormat: (pattern: Maybe<string> | undefined) => boolean;
10
+ /**
11
+ * The number format of a series' source cells — the first formatted cell of
12
+ * its first source range, matching Excel which links the axis to the first
13
+ * series' cell format.
14
+ */
15
+ export declare const resolveSourceNumberFormat: (sources: SheetRange[] | undefined, getFormattingFromRange: RangeFormatReader | undefined, hiddenDimensionStrategy?: HIDDEN_DIMENSION_STRATEGY | null) => string | undefined;
16
+ /**
17
+ * Effective number format of one value axis: the axis' explicit
18
+ * `numberFormatPattern` wins, else the format of the first series bound to
19
+ * that axis ("Linked to source"), else `undefined` (renderer default).
20
+ */
21
+ export declare const resolveValueAxisNumberFormat: ({ axisOptions, series, getFormattingFromRange, hiddenDimensionStrategy, }: {
22
+ axisOptions: Maybe<{
23
+ numberFormatPattern?: Maybe<string>;
24
+ }> | undefined;
25
+ series: Pick<ChartData, "sources">[];
26
+ getFormattingFromRange: RangeFormatReader | undefined;
27
+ hiddenDimensionStrategy?: HIDDEN_DIMENSION_STRATEGY | null;
28
+ }) => string | undefined;
29
+ /** Format one numeric value through the resolved pattern; non-numbers pass through. */
30
+ export declare const formatAxisValue: (pattern: string | undefined, value: unknown) => string;
31
+ /** echarts `axisLabel.formatter` / `tooltip.valueFormatter` for a value axis. */
32
+ export declare const valueAxisLabelFormatter: (pattern: string | undefined) => ((value: unknown) => string) | undefined;
33
+ /**
34
+ * echarts `tooltip.valueFormatter` for a series whose data items are
35
+ * tuples (candlestick, 3-D points): every number formats through the
36
+ * pattern; `undefined` when there is no pattern so echarts keeps its
37
+ * default.
38
+ */
39
+ export declare const tooltipValueFormatter: (pattern: string | undefined) => ((value: unknown) => string | string[]) | undefined;
40
+ /**
41
+ * Excel's data labels and tooltips are linked to *each series' own* source
42
+ * cells, not to the axis: a revenue series formatted `$#,##0` next to a
43
+ * margin series formatted `0.0%` labels each with its own pattern. One
44
+ * entry per `spec.series`, `undefined` where the cells are General.
45
+ */
46
+ export declare const resolveSeriesNumberFormats: (series: Pick<ChartData, "sources">[] | undefined, getFormattingFromRange: RangeFormatReader | undefined, hiddenDimensionStrategy?: HIDDEN_DIMENSION_STRATEGY | null) => (string | undefined)[];
47
+ /** echarts pie / doughnut tooltip: `name: value (percent%)` with the value formatted. */
48
+ export declare const circularTooltipFormatter: (pattern: string | undefined) => (params: {
49
+ name?: string;
50
+ value?: unknown;
51
+ percent?: number;
52
+ }) => string;
53
+ export type PlotlyTickFormat = {
54
+ tickformat?: string;
55
+ tickprefix?: string;
56
+ ticksuffix?: string;
57
+ };
58
+ /**
59
+ * Translate the numeric subset of a SpreadsheetML pattern into plotly's
60
+ * d3-format axis settings (`tickformat` + literal prefix / suffix). Plotly
61
+ * has no per-tick callback, so only patterns made of digit placeholders,
62
+ * grouping, decimals, `%` and quoted / currency literals convert; anything
63
+ * else (dates, fractions, scientific, text sections) returns `undefined`
64
+ * and the axis keeps plotly's default labels. Only the first (positive)
65
+ * section is used — plotly applies one format to every tick.
66
+ */
67
+ export declare const numberFormatToPlotlyTicks: (pattern: string | undefined) => PlotlyTickFormat | undefined;
68
+ export {};
69
+ //# sourceMappingURL=axis-number-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis-number-format.d.ts","sourceRoot":"","sources":["../../../utils/axis-number-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,yBAAyB,EACzB,KAAK,EACL,UAAU,EACX,MAAM,2BAA2B,CAAC;AAWnC,KAAK,iBAAiB,GAAG,CACvB,UAAU,EAAE,UAAU,EACtB,uBAAuB,CAAC,EAAE,yBAAyB,KAChD,OAAO,EAAE,CAAC;AAMf;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,YAGjC,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACpC,SAAS,UAAU,EAAE,GAAG,SAAS,EACjC,wBAAwB,iBAAiB,GAAG,SAAS,EACrD,0BAA0B,yBAAyB,GAAG,IAAI,KACzD,MAAM,GAAG,SAWX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,2EAK1C;IACD,WAAW,EAAE,KAAK,CAAC;QAAE,mBAAmB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IACxE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IACrC,sBAAsB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtD,uBAAuB,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;CAC5D,KAAG,MAAM,GAAG,SAQZ,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,GAAG,SAAS,EAC3B,OAAO,OAAO,KACb,MAIF,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,GAAG,SAAS,cAC/C,OAAO,wBAAgD,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,GAAG,SAAS,cAEnD,OAAO,mCAIN,CAAC;AAEhB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GACrC,QAAQ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAChD,wBAAwB,iBAAiB,GAAG,SAAS,EACrD,0BAA0B,yBAAyB,GAAG,IAAI,KACzD,CAAC,MAAM,GAAG,SAAS,CAAC,EAOpB,CAAC;AAEJ,yFAAyF;AACzF,eAAO,MAAM,wBAAwB,GAClC,SAAS,MAAM,GAAG,SAAS,MAC3B,QAAQ;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,WAGvD,CAAC;AAET,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GACpC,SAAS,MAAM,GAAG,SAAS,KAC1B,gBAAgB,GAAG,SA4DrB,CAAC"}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.numberFormatToPlotlyTicks = exports.circularTooltipFormatter = exports.resolveSeriesNumberFormats = exports.tooltipValueFormatter = exports.valueAxisLabelFormatter = exports.formatAxisValue = exports.resolveValueAxisNumberFormat = exports.resolveSourceNumberFormat = exports.isGeneralNumberFormat = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var utils_1 = require("@rowsncolumns/utils");
6
+ var patternOf = function (format) {
7
+ var _a;
8
+ return (_a = format === null || format === void 0 ? void 0 : format.numberFormat) === null || _a === void 0 ? void 0 : _a.pattern;
9
+ };
10
+ /**
11
+ * `General` (or nothing) means "let the renderer pick" — it carries no
12
+ * formatting. So does the bare-`#` shape the engines infer when a plain
13
+ * number is typed (`#`, `#.0`): Excel leaves such cells General, and `#`
14
+ * would blank every fractional tick below 0.5.
15
+ */
16
+ var isGeneralNumberFormat = function (pattern) {
17
+ return !pattern ||
18
+ pattern.trim().toLowerCase() === "general" ||
19
+ /^#+(\.[#0]*)?$/.test(pattern.trim());
20
+ };
21
+ exports.isGeneralNumberFormat = isGeneralNumberFormat;
22
+ /**
23
+ * The number format of a series' source cells — the first formatted cell of
24
+ * its first source range, matching Excel which links the axis to the first
25
+ * series' cell format.
26
+ */
27
+ var resolveSourceNumberFormat = function (sources, getFormattingFromRange, hiddenDimensionStrategy) {
28
+ var e_1, _a;
29
+ var _b;
30
+ var source = sources === null || sources === void 0 ? void 0 : sources[0];
31
+ if (!source || !getFormattingFromRange)
32
+ return undefined;
33
+ try {
34
+ for (var _c = tslib_1.__values((_b = getFormattingFromRange(source, hiddenDimensionStrategy !== null && hiddenDimensionStrategy !== void 0 ? hiddenDimensionStrategy : undefined)) !== null && _b !== void 0 ? _b : []), _d = _c.next(); !_d.done; _d = _c.next()) {
35
+ var format = _d.value;
36
+ var pattern = patternOf(format);
37
+ if (!(0, exports.isGeneralNumberFormat)(pattern))
38
+ return pattern !== null && pattern !== void 0 ? pattern : undefined;
39
+ }
40
+ }
41
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
42
+ finally {
43
+ try {
44
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
45
+ }
46
+ finally { if (e_1) throw e_1.error; }
47
+ }
48
+ return undefined;
49
+ };
50
+ exports.resolveSourceNumberFormat = resolveSourceNumberFormat;
51
+ /**
52
+ * Effective number format of one value axis: the axis' explicit
53
+ * `numberFormatPattern` wins, else the format of the first series bound to
54
+ * that axis ("Linked to source"), else `undefined` (renderer default).
55
+ */
56
+ var resolveValueAxisNumberFormat = function (_a) {
57
+ var _b;
58
+ var axisOptions = _a.axisOptions, series = _a.series, getFormattingFromRange = _a.getFormattingFromRange, hiddenDimensionStrategy = _a.hiddenDimensionStrategy;
59
+ var explicit = axisOptions === null || axisOptions === void 0 ? void 0 : axisOptions.numberFormatPattern;
60
+ if (explicit)
61
+ return (0, exports.isGeneralNumberFormat)(explicit) ? undefined : explicit;
62
+ return (0, exports.resolveSourceNumberFormat)((_b = series[0]) === null || _b === void 0 ? void 0 : _b.sources, getFormattingFromRange, hiddenDimensionStrategy);
63
+ };
64
+ exports.resolveValueAxisNumberFormat = resolveValueAxisNumberFormat;
65
+ /** Format one numeric value through the resolved pattern; non-numbers pass through. */
66
+ var formatAxisValue = function (pattern, value) {
67
+ if (value === undefined || value === null)
68
+ return "";
69
+ if (pattern && typeof value === "number")
70
+ return (0, utils_1.ssfFormat)(pattern, value);
71
+ return String(value);
72
+ };
73
+ exports.formatAxisValue = formatAxisValue;
74
+ /** echarts `axisLabel.formatter` / `tooltip.valueFormatter` for a value axis. */
75
+ var valueAxisLabelFormatter = function (pattern) {
76
+ return pattern ? function (value) { return (0, exports.formatAxisValue)(pattern, value); } : undefined;
77
+ };
78
+ exports.valueAxisLabelFormatter = valueAxisLabelFormatter;
79
+ /**
80
+ * echarts `tooltip.valueFormatter` for a series whose data items are
81
+ * tuples (candlestick, 3-D points): every number formats through the
82
+ * pattern; `undefined` when there is no pattern so echarts keeps its
83
+ * default.
84
+ */
85
+ var tooltipValueFormatter = function (pattern) {
86
+ return pattern
87
+ ? function (value) {
88
+ return Array.isArray(value)
89
+ ? value.map(function (entry) { return (0, exports.formatAxisValue)(pattern, entry); })
90
+ : (0, exports.formatAxisValue)(pattern, value);
91
+ }
92
+ : undefined;
93
+ };
94
+ exports.tooltipValueFormatter = tooltipValueFormatter;
95
+ /**
96
+ * Excel's data labels and tooltips are linked to *each series' own* source
97
+ * cells, not to the axis: a revenue series formatted `$#,##0` next to a
98
+ * margin series formatted `0.0%` labels each with its own pattern. One
99
+ * entry per `spec.series`, `undefined` where the cells are General.
100
+ */
101
+ var resolveSeriesNumberFormats = function (series, getFormattingFromRange, hiddenDimensionStrategy) {
102
+ return (series !== null && series !== void 0 ? series : []).map(function (entry) {
103
+ return (0, exports.resolveSourceNumberFormat)(entry === null || entry === void 0 ? void 0 : entry.sources, getFormattingFromRange, hiddenDimensionStrategy);
104
+ });
105
+ };
106
+ exports.resolveSeriesNumberFormats = resolveSeriesNumberFormats;
107
+ /** echarts pie / doughnut tooltip: `name: value (percent%)` with the value formatted. */
108
+ var circularTooltipFormatter = function (pattern) {
109
+ return function (params) {
110
+ var _a, _b;
111
+ return "".concat((_a = params.name) !== null && _a !== void 0 ? _a : "", ": ").concat((0, exports.formatAxisValue)(pattern, params.value), " (").concat((_b = params.percent) !== null && _b !== void 0 ? _b : "", "%)");
112
+ };
113
+ };
114
+ exports.circularTooltipFormatter = circularTooltipFormatter;
115
+ /**
116
+ * Translate the numeric subset of a SpreadsheetML pattern into plotly's
117
+ * d3-format axis settings (`tickformat` + literal prefix / suffix). Plotly
118
+ * has no per-tick callback, so only patterns made of digit placeholders,
119
+ * grouping, decimals, `%` and quoted / currency literals convert; anything
120
+ * else (dates, fractions, scientific, text sections) returns `undefined`
121
+ * and the axis keeps plotly's default labels. Only the first (positive)
122
+ * section is used — plotly applies one format to every tick.
123
+ */
124
+ var numberFormatToPlotlyTicks = function (pattern) {
125
+ var _a;
126
+ if ((0, exports.isGeneralNumberFormat)(pattern))
127
+ return undefined;
128
+ var section = firstSection(pattern);
129
+ var prefix = "";
130
+ var suffix = "";
131
+ var digits = "";
132
+ var percent = false;
133
+ var seenDigit = false;
134
+ for (var i = 0; i < section.length; i++) {
135
+ var ch = section[i];
136
+ var literal = function (text) {
137
+ if (seenDigit)
138
+ suffix += text;
139
+ else
140
+ prefix += text;
141
+ };
142
+ if (ch === '"') {
143
+ var end = section.indexOf('"', i + 1);
144
+ if (end === -1)
145
+ return undefined;
146
+ literal(section.slice(i + 1, end));
147
+ i = end;
148
+ }
149
+ else if (ch === "\\") {
150
+ literal((_a = section[i + 1]) !== null && _a !== void 0 ? _a : "");
151
+ i += 1;
152
+ }
153
+ else if (ch === "[") {
154
+ var end = section.indexOf("]", i + 1);
155
+ if (end === -1)
156
+ return undefined;
157
+ var token = section.slice(i + 1, end);
158
+ // `[$€-407]` locale currency → the symbol; color / condition tokens
159
+ // carry no text.
160
+ if (token.startsWith("$")) {
161
+ var dash = token.indexOf("-");
162
+ literal(dash === -1 ? token.slice(1) : token.slice(1, dash));
163
+ }
164
+ i = end;
165
+ }
166
+ else if (ch === "_") {
167
+ literal(" ");
168
+ i += 1;
169
+ }
170
+ else if (ch === "*") {
171
+ i += 1;
172
+ }
173
+ else if (ch === "#" || ch === "0" || ch === "," || ch === ".") {
174
+ if (seenDigit && suffix)
175
+ return undefined;
176
+ seenDigit = true;
177
+ digits += ch;
178
+ }
179
+ else if (ch === "%") {
180
+ if (!seenDigit)
181
+ return undefined;
182
+ percent = true;
183
+ }
184
+ else if ("$€£¥₹ -+()/:".includes(ch)) {
185
+ literal(ch);
186
+ }
187
+ else {
188
+ return undefined;
189
+ }
190
+ }
191
+ if (!seenDigit)
192
+ return undefined;
193
+ var _b = tslib_1.__read(digits.split("."), 2), _c = _b[1], fraction = _c === void 0 ? "" : _c;
194
+ var grouping = digits.includes(",") ? "," : "";
195
+ var decimals = fraction.replace(/[^0#]/g, "").length;
196
+ var tickformat = "".concat(grouping, ".").concat(decimals).concat(percent ? "%" : "f");
197
+ var result = { tickformat: tickformat };
198
+ if (prefix)
199
+ result.tickprefix = prefix;
200
+ if (suffix)
201
+ result.ticksuffix = suffix;
202
+ return result;
203
+ };
204
+ exports.numberFormatToPlotlyTicks = numberFormatToPlotlyTicks;
205
+ var firstSection = function (pattern) {
206
+ var quoted = false;
207
+ for (var i = 0; i < pattern.length; i++) {
208
+ var ch = pattern[i];
209
+ if (ch === '"')
210
+ quoted = !quoted;
211
+ else if (ch === "\\")
212
+ i += 1;
213
+ else if (ch === ";" && !quoted)
214
+ return pattern.slice(0, i);
215
+ }
216
+ return pattern;
217
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Hierarchical (multi-level) category axes — what Excel draws for a PivotChart
3
+ * over nested row fields: the leaf items along the axis with their parent
4
+ * labels grouped underneath. `ChartSpec.categoryLevels` carries the levels
5
+ * outermost first, the last one being the plotted categories.
6
+ */
7
+ export type CategoryLevels = {
8
+ /** Outer levels, outermost first; each aligned to `leaf` (a parent label repeats per leaf). */
9
+ outer: string[][];
10
+ /** The plotted categories. */
11
+ leaf: string[];
12
+ };
13
+ /** The resolved level values → the axis shape, or `undefined` when there is nothing to group. */
14
+ export declare const resolveCategoryLevels: (levels: ReadonlyArray<ReadonlyArray<unknown>> | undefined | null) => CategoryLevels | undefined;
15
+ /** plotly `multicategory` x: the outer levels first, the leaf labels last. */
16
+ export declare const plotlyMulticategoryX: (levels: CategoryLevels) => string[][];
17
+ /** Index of the first leaf of every run of equal labels in `level`. */
18
+ export declare const groupStarts: (level: ReadonlyArray<string>) => number[];
19
+ /**
20
+ * echarts has no multi-level category axis: the leaf axis is the real one
21
+ * (`base` — the caller's styled category axis, series bind to it) and every
22
+ * outer level becomes a label-only axis below it whose ticks sit on the group
23
+ * boundaries and whose label is written once per group, at the group's first
24
+ * leaf.
25
+ */
26
+ export declare const echartsGroupedCategoryAxes: <T extends Record<string, unknown>>(levels: CategoryLevels, base: T, labelOffset?: number) => Array<Record<string, unknown>>;
27
+ //# sourceMappingURL=category-levels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category-levels.d.ts","sourceRoot":"","sources":["../../../utils/category-levels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,+FAA+F;IAC/F,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;IAClB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAKF,iGAAiG;AACjG,eAAO,MAAM,qBAAqB,GAChC,QAAQ,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,KAC/D,cAAc,GAAG,SAQnB,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,GAAI,QAAQ,cAAc,KAAG,MAAM,EAAE,EAGrE,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,WAAW,GAAI,OAAO,aAAa,CAAC,MAAM,CAAC,KAAG,MAAM,EAIzD,CAAC;AAET;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1E,QAAQ,cAAc,EACtB,MAAM,CAAC,EACP,oBAAgB,KACf,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4B/B,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * Hierarchical (multi-level) category axes — what Excel draws for a PivotChart
4
+ * over nested row fields: the leaf items along the axis with their parent
5
+ * labels grouped underneath. `ChartSpec.categoryLevels` carries the levels
6
+ * outermost first, the last one being the plotted categories.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.echartsGroupedCategoryAxes = exports.groupStarts = exports.plotlyMulticategoryX = exports.resolveCategoryLevels = void 0;
10
+ var tslib_1 = require("tslib");
11
+ var text = function (value) {
12
+ return value === null || value === undefined ? "" : String(value);
13
+ };
14
+ /** The resolved level values → the axis shape, or `undefined` when there is nothing to group. */
15
+ var resolveCategoryLevels = function (levels) {
16
+ if (!levels || levels.length === 0)
17
+ return undefined;
18
+ var leaf = levels[levels.length - 1].map(text);
19
+ if (leaf.length === 0)
20
+ return undefined;
21
+ var outer = levels
22
+ .slice(0, -1)
23
+ .map(function (level) { return leaf.map(function (_, index) { return text(level[index]); }); });
24
+ return { outer: outer, leaf: leaf };
25
+ };
26
+ exports.resolveCategoryLevels = resolveCategoryLevels;
27
+ /** plotly `multicategory` x: the outer levels first, the leaf labels last. */
28
+ var plotlyMulticategoryX = function (levels) { return tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(levels.outer), false), [
29
+ levels.leaf,
30
+ ], false); };
31
+ exports.plotlyMulticategoryX = plotlyMulticategoryX;
32
+ /** Index of the first leaf of every run of equal labels in `level`. */
33
+ var groupStarts = function (level) {
34
+ return level.reduce(function (starts, label, index) {
35
+ if (index === 0 || label !== level[index - 1])
36
+ starts.push(index);
37
+ return starts;
38
+ }, []);
39
+ };
40
+ exports.groupStarts = groupStarts;
41
+ /**
42
+ * echarts has no multi-level category axis: the leaf axis is the real one
43
+ * (`base` — the caller's styled category axis, series bind to it) and every
44
+ * outer level becomes a label-only axis below it whose ticks sit on the group
45
+ * boundaries and whose label is written once per group, at the group's first
46
+ * leaf.
47
+ */
48
+ var echartsGroupedCategoryAxes = function (levels, base, labelOffset) {
49
+ if (labelOffset === void 0) { labelOffset = 24; }
50
+ var axes = [tslib_1.__assign(tslib_1.__assign({}, base), { data: levels.leaf })];
51
+ // Innermost outer level sits closest to the leaf axis.
52
+ tslib_1.__spreadArray([], tslib_1.__read(levels.outer), false).reverse().forEach(function (level, depth) {
53
+ var _a, _b;
54
+ var starts = new Set((0, exports.groupStarts)(level));
55
+ axes.push({
56
+ type: "category",
57
+ position: (_a = base.position) !== null && _a !== void 0 ? _a : "bottom",
58
+ offset: labelOffset * (depth + 1),
59
+ data: levels.leaf.map(function (_, index) { return "".concat(index); }),
60
+ show: (_b = base.show) !== null && _b !== void 0 ? _b : true,
61
+ axisLine: { show: false },
62
+ splitLine: { show: false },
63
+ axisTick: {
64
+ show: true,
65
+ length: labelOffset,
66
+ interval: function (index) { return starts.has(index); },
67
+ alignWithLabel: false,
68
+ },
69
+ axisLabel: {
70
+ interval: 0,
71
+ formatter: function (_, index) {
72
+ return starts.has(index) ? level[index] : "";
73
+ },
74
+ },
75
+ nameLocation: "middle",
76
+ });
77
+ });
78
+ return axes;
79
+ };
80
+ exports.echartsGroupedCategoryAxes = echartsGroupedCategoryAxes;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A `data:image/png;base64,…` URL (what echarts' `getDataURL` and plotly's
3
+ * `toImage` hand back) as a Blob for the clipboard / print pipeline.
4
+ * Decoded locally so no fetch is needed. `undefined` for anything that is
5
+ * not a base64 data URL.
6
+ */
7
+ export declare const dataUrlToBlob: (dataUrl: string | undefined) => Blob | undefined;
8
+ //# sourceMappingURL=chart-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-image.d.ts","sourceRoot":"","sources":["../../../utils/chart-image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,IAAI,GAAG,SAalE,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataUrlToBlob = void 0;
4
+ /**
5
+ * A `data:image/png;base64,…` URL (what echarts' `getDataURL` and plotly's
6
+ * `toImage` hand back) as a Blob for the clipboard / print pipeline.
7
+ * Decoded locally so no fetch is needed. `undefined` for anything that is
8
+ * not a base64 data URL.
9
+ */
10
+ var dataUrlToBlob = function (dataUrl) {
11
+ if (!dataUrl)
12
+ return undefined;
13
+ var match = /^data:([^;,]+)?(;base64)?,([\s\S]*)$/.exec(dataUrl);
14
+ if (!match || !match[2])
15
+ return undefined;
16
+ var mime = match[1] || "image/png";
17
+ try {
18
+ var binary = atob(match[3]);
19
+ var bytes = new Uint8Array(binary.length);
20
+ for (var i = 0; i < binary.length; i++)
21
+ bytes[i] = binary.charCodeAt(i);
22
+ return new Blob([bytes], { type: mime });
23
+ }
24
+ catch (_a) {
25
+ return undefined;
26
+ }
27
+ };
28
+ exports.dataUrlToBlob = dataUrlToBlob;
@@ -0,0 +1,67 @@
1
+ import type { ChartData, EmbeddedChart, HIDDEN_DIMENSION_STRATEGY, SheetRange } from "@rowsncolumns/spreadsheet";
2
+ type ChartSpec = EmbeddedChart["spec"];
3
+ export type SeriesOrientation = NonNullable<ChartSpec["seriesOrientation"]>;
4
+ /** Formatted text of one cell — the series name / category label source. */
5
+ export type ChartCellLabelGetter = (sheetId: number, rowIndex: number, columnIndex: number) => string | null | undefined;
6
+ /**
7
+ * Adapt a range reader (the renderers' `getDomainValuesFromRange`) into
8
+ * the single-cell label getter the orientation helpers take.
9
+ */
10
+ export declare const cellLabelGetterFromRangeReader: (readRange: (range: SheetRange, hiddenStrategy?: HIDDEN_DIMENSION_STRATEGY | null) => readonly unknown[]) => ChartCellLabelGetter;
11
+ /**
12
+ * Which way a chart's series run. The explicit flag wins; otherwise a
13
+ * chart whose every series is a single row spanning several columns is
14
+ * Excel's series-in-rows shape (OOXML carries no flag — each `<c:ser>` is
15
+ * its own reference — so imported charts are read this way).
16
+ */
17
+ export declare const inferSeriesOrientation: (spec: ChartSpec) => SeriesOrientation;
18
+ export declare const flipSeriesOrientation: (orientation: SeriesOrientation) => SeriesOrientation;
19
+ /**
20
+ * Excel's chart wizard picks series-in-rows when the selection is wider
21
+ * than it is tall.
22
+ */
23
+ export declare const pickSeriesOrientationForRange: (range: Omit<SheetRange, "sheetId">) => SeriesOrientation;
24
+ /**
25
+ * Split a data range the way Excel's chart wizard does. Series in
26
+ * columns: the first column (beneath the header row) is the category
27
+ * axis and every further column is one series named by its header cell.
28
+ * Series in rows is the transpose: the first row (right of the header
29
+ * column) is the category axis and every further row is a series named
30
+ * by its first cell. A range only one row (column) tall still yields a
31
+ * one-cell-deep axis so the chart has something to plot.
32
+ */
33
+ export declare const deriveChartSeriesFromRange: ({ range, orientation, getFormattedValue, }: {
34
+ range: SheetRange;
35
+ orientation: SeriesOrientation;
36
+ getFormattedValue?: ChartCellLabelGetter;
37
+ }) => {
38
+ domains: ChartData[];
39
+ series: ChartData[];
40
+ };
41
+ /**
42
+ * The block the series tile when they form one rectangle: every series
43
+ * is a single source on the same sheet, all single columns sharing one
44
+ * row span (series in columns) or all single rows sharing one column
45
+ * span (series in rows), and adjacent to each other in order. Undefined
46
+ * for anything else — there is no meaningful transpose of scattered
47
+ * sources.
48
+ */
49
+ export declare const rectangularSeriesBounds: (spec: ChartSpec, orientation: SeriesOrientation) => SheetRange | undefined;
50
+ /** Whether `switchRowColumn` has a transpose to offer for this chart. */
51
+ export declare const canSwitchRowColumn: (spec: ChartSpec) => boolean;
52
+ /**
53
+ * Excel's "Switch Row/Column". With a `dataRange` the series and
54
+ * category axis are re-derived from it the other way round. Without one,
55
+ * rectangular series sources are transposed: each row (column) of the
56
+ * block becomes a series, named after the old category cell beside it,
57
+ * and the old series names become the categories (Excel's behaviour —
58
+ * the names are carried as inline values because the spec stores them
59
+ * as text, not as a cell reference). Per-series presentation (colours,
60
+ * trendlines, …) does not survive the transpose, as in Excel. Returns
61
+ * undefined when the sources cannot be transposed.
62
+ */
63
+ export declare const switchRowColumn: (spec: ChartSpec, { getFormattedValue }?: {
64
+ getFormattedValue?: ChartCellLabelGetter;
65
+ }) => ChartSpec | undefined;
66
+ export {};
67
+ //# sourceMappingURL=chart-orientation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-orientation.d.ts","sourceRoot":"","sources":["../../../utils/chart-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAInC,KAAK,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEvC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAE5E,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,8BAA8B,GAEvC,WAAW,CACT,KAAK,EAAE,UAAU,EACjB,cAAc,CAAC,EAAE,yBAAyB,GAAG,IAAI,KAC9C,SAAS,OAAO,EAAE,KACtB,oBAaF,CAAC;AAOJ;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,SAAS,KAAG,iBAQxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,aAAa,iBAAiB,KAC7B,iBAAkE,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GACxC,OAAO,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,KACjC,iBAIY,CAAC;AAEhB;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GAAI,4CAIxC;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;CAC1C,KAAG;IAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAA;CA4D9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,SAAS,EACf,aAAa,iBAAiB,KAC7B,UAAU,GAAG,SAsCf,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,KAAG,OAIrC,CAAC;AAEjB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,SAAS,EACf,wBAAuB;IAAE,iBAAiB,CAAC,EAAE,oBAAoB,CAAA;CAAO,KACvE,SAAS,GAAG,SA8Ed,CAAC"}