@wavemaker/react-native-echarts 1.0.0-dev.0 → 1.0.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +360 -3
  2. package/area/area-chart.d.ts +1 -1
  3. package/area/area-chart.d.ts.map +1 -1
  4. package/area/area-chart.js +81 -50
  5. package/area/area-chart.props.d.ts +4 -0
  6. package/area/area-chart.props.d.ts.map +1 -1
  7. package/area/index.d.ts +1 -1
  8. package/area/index.d.ts.map +1 -1
  9. package/axis.d.ts +26 -0
  10. package/axis.d.ts.map +1 -1
  11. package/axis.js +35 -0
  12. package/bubble/bubble-chart.d.ts.map +1 -1
  13. package/bubble/bubble-chart.js +66 -35
  14. package/candlestick/candlestick-chart.d.ts.map +1 -1
  15. package/candlestick/candlestick-chart.js +37 -8
  16. package/cartesian/tooltip/axis-tooltip-presets.d.ts +5 -0
  17. package/cartesian/tooltip/axis-tooltip-presets.d.ts.map +1 -0
  18. package/cartesian/tooltip/axis-tooltip-presets.js +46 -0
  19. package/cartesian/tooltip/axis-tooltip.types.d.ts +38 -0
  20. package/cartesian/tooltip/axis-tooltip.types.d.ts.map +1 -0
  21. package/cartesian/tooltip/axis-tooltip.types.js +4 -0
  22. package/cartesian/tooltip/axis-tooltip.utils.d.ts +10 -0
  23. package/cartesian/tooltip/axis-tooltip.utils.d.ts.map +1 -0
  24. package/cartesian/tooltip/axis-tooltip.utils.js +121 -0
  25. package/cartesian/tooltip/default-axis-tooltip.d.ts +9 -0
  26. package/cartesian/tooltip/default-axis-tooltip.d.ts.map +1 -0
  27. package/cartesian/tooltip/default-axis-tooltip.js +53 -0
  28. package/cartesian/tooltip/index.d.ts +7 -0
  29. package/cartesian/tooltip/index.d.ts.map +1 -0
  30. package/cartesian/tooltip/index.js +4 -0
  31. package/cartesian/tooltip/use-axis-tooltip.d.ts +38 -0
  32. package/cartesian/tooltip/use-axis-tooltip.d.ts.map +1 -0
  33. package/cartesian/tooltip/use-axis-tooltip.js +54 -0
  34. package/column/column-chart.d.ts.map +1 -1
  35. package/column/column-chart.js +93 -33
  36. package/geo/geo-chart.d.ts.map +1 -1
  37. package/geo/geo-chart.js +56 -24
  38. package/geo/geo-chart.props.d.ts +11 -5
  39. package/geo/geo-chart.props.d.ts.map +1 -1
  40. package/geo/index.d.ts +1 -0
  41. package/geo/index.d.ts.map +1 -1
  42. package/geo/index.js +1 -0
  43. package/geo/tooltip/default-geo-tooltip.d.ts +6 -0
  44. package/geo/tooltip/default-geo-tooltip.d.ts.map +1 -0
  45. package/geo/tooltip/default-geo-tooltip.js +47 -0
  46. package/geo/tooltip/geo-item-tooltip-presets.d.ts +5 -0
  47. package/geo/tooltip/geo-item-tooltip-presets.d.ts.map +1 -0
  48. package/geo/tooltip/geo-item-tooltip-presets.js +35 -0
  49. package/geo/tooltip/geo-item-tooltip.types.d.ts +19 -0
  50. package/geo/tooltip/geo-item-tooltip.types.d.ts.map +1 -0
  51. package/geo/tooltip/geo-item-tooltip.types.js +3 -0
  52. package/geo/tooltip/geo-item-tooltip.utils.d.ts +14 -0
  53. package/geo/tooltip/geo-item-tooltip.utils.d.ts.map +1 -0
  54. package/geo/tooltip/geo-item-tooltip.utils.js +220 -0
  55. package/geo/tooltip/index.d.ts +7 -0
  56. package/geo/tooltip/index.d.ts.map +1 -0
  57. package/geo/tooltip/index.js +4 -0
  58. package/geo/tooltip/use-geo-item-tooltip.d.ts +26 -0
  59. package/geo/tooltip/use-geo-item-tooltip.d.ts.map +1 -0
  60. package/geo/tooltip/use-geo-item-tooltip.js +59 -0
  61. package/geo/us-chart.js +1 -1
  62. package/geo/us-states.json +54 -0
  63. package/geo/world.json +1 -0
  64. package/index.d.ts +2 -0
  65. package/index.d.ts.map +1 -1
  66. package/index.js +2 -0
  67. package/legend/echarts-legend-layout.d.ts +20 -0
  68. package/legend/echarts-legend-layout.d.ts.map +1 -0
  69. package/legend/echarts-legend-layout.js +103 -0
  70. package/line/index.d.ts +1 -1
  71. package/line/index.d.ts.map +1 -1
  72. package/line/line-chart.d.ts +1 -1
  73. package/line/line-chart.d.ts.map +1 -1
  74. package/line/line-chart.props.d.ts +5 -0
  75. package/line/line-chart.props.d.ts.map +1 -1
  76. package/package.json +12 -5
  77. package/pie/index.d.ts +1 -0
  78. package/pie/index.d.ts.map +1 -1
  79. package/pie/index.js +1 -0
  80. package/pie/pie-chart.d.ts.map +1 -1
  81. package/pie/pie-chart.js +69 -45
  82. package/pie/pie-chart.props.d.ts +19 -8
  83. package/pie/pie-chart.props.d.ts.map +1 -1
  84. package/pie/tooltip/default-pie-tooltip.d.ts +5 -0
  85. package/pie/tooltip/default-pie-tooltip.d.ts.map +1 -0
  86. package/pie/tooltip/default-pie-tooltip.js +57 -0
  87. package/pie/tooltip/index.d.ts +7 -0
  88. package/pie/tooltip/index.d.ts.map +1 -0
  89. package/pie/tooltip/index.js +4 -0
  90. package/pie/tooltip/pie-item-tooltip-presets.d.ts +5 -0
  91. package/pie/tooltip/pie-item-tooltip-presets.d.ts.map +1 -0
  92. package/pie/tooltip/pie-item-tooltip-presets.js +39 -0
  93. package/pie/tooltip/pie-item-tooltip.types.d.ts +28 -0
  94. package/pie/tooltip/pie-item-tooltip.types.d.ts.map +1 -0
  95. package/pie/tooltip/pie-item-tooltip.types.js +3 -0
  96. package/pie/tooltip/pie-item-tooltip.utils.d.ts +9 -0
  97. package/pie/tooltip/pie-item-tooltip.utils.d.ts.map +1 -0
  98. package/pie/tooltip/pie-item-tooltip.utils.js +139 -0
  99. package/pie/tooltip/use-pie-item-tooltip.d.ts +24 -0
  100. package/pie/tooltip/use-pie-item-tooltip.d.ts.map +1 -0
  101. package/pie/tooltip/use-pie-item-tooltip.js +45 -0
  102. package/props/cartesian.d.ts +50 -13
  103. package/props/cartesian.d.ts.map +1 -1
  104. package/props/common.d.ts +2 -0
  105. package/props/common.d.ts.map +1 -1
  106. package/radar/index.d.ts +1 -0
  107. package/radar/index.d.ts.map +1 -1
  108. package/radar/index.js +1 -0
  109. package/radar/radar-chart.d.ts.map +1 -1
  110. package/radar/radar-chart.js +59 -12
  111. package/radar/radar-chart.props.d.ts +20 -2
  112. package/radar/radar-chart.props.d.ts.map +1 -1
  113. package/radar/tooltip/default-radar-tooltip.d.ts +6 -0
  114. package/radar/tooltip/default-radar-tooltip.d.ts.map +1 -0
  115. package/radar/tooltip/default-radar-tooltip.js +47 -0
  116. package/radar/tooltip/index.d.ts +7 -0
  117. package/radar/tooltip/index.d.ts.map +1 -0
  118. package/radar/tooltip/index.js +4 -0
  119. package/radar/tooltip/radar-item-tooltip-presets.d.ts +5 -0
  120. package/radar/tooltip/radar-item-tooltip-presets.d.ts.map +1 -0
  121. package/radar/tooltip/radar-item-tooltip-presets.js +50 -0
  122. package/radar/tooltip/radar-item-tooltip.types.d.ts +28 -0
  123. package/radar/tooltip/radar-item-tooltip.types.d.ts.map +1 -0
  124. package/radar/tooltip/radar-item-tooltip.types.js +3 -0
  125. package/radar/tooltip/radar-item-tooltip.utils.d.ts +9 -0
  126. package/radar/tooltip/radar-item-tooltip.utils.d.ts.map +1 -0
  127. package/radar/tooltip/radar-item-tooltip.utils.js +77 -0
  128. package/radar/tooltip/use-radar-item-tooltip.d.ts +22 -0
  129. package/radar/tooltip/use-radar-item-tooltip.d.ts.map +1 -0
  130. package/radar/tooltip/use-radar-item-tooltip.js +43 -0
  131. package/radial/index.d.ts +1 -0
  132. package/radial/index.d.ts.map +1 -1
  133. package/radial/index.js +1 -0
  134. package/radial/radial-chart.d.ts.map +1 -1
  135. package/radial/radial-chart.js +44 -16
  136. package/radial/radial-chart.props.d.ts +16 -3
  137. package/radial/radial-chart.props.d.ts.map +1 -1
  138. package/radial/tooltip/default-radial-tooltip.d.ts +6 -0
  139. package/radial/tooltip/default-radial-tooltip.d.ts.map +1 -0
  140. package/radial/tooltip/default-radial-tooltip.js +52 -0
  141. package/radial/tooltip/index.d.ts +7 -0
  142. package/radial/tooltip/index.d.ts.map +1 -0
  143. package/radial/tooltip/index.js +4 -0
  144. package/radial/tooltip/radial-item-tooltip-presets.d.ts +5 -0
  145. package/radial/tooltip/radial-item-tooltip-presets.d.ts.map +1 -0
  146. package/radial/tooltip/radial-item-tooltip-presets.js +43 -0
  147. package/radial/tooltip/radial-item-tooltip.types.d.ts +23 -0
  148. package/radial/tooltip/radial-item-tooltip.types.d.ts.map +1 -0
  149. package/radial/tooltip/radial-item-tooltip.types.js +3 -0
  150. package/radial/tooltip/radial-item-tooltip.utils.d.ts +9 -0
  151. package/radial/tooltip/radial-item-tooltip.utils.d.ts.map +1 -0
  152. package/radial/tooltip/radial-item-tooltip.utils.js +122 -0
  153. package/radial/tooltip/use-radial-item-tooltip.d.ts +22 -0
  154. package/radial/tooltip/use-radial-item-tooltip.d.ts.map +1 -0
  155. package/radial/tooltip/use-radial-item-tooltip.js +43 -0
  156. package/scatter/index.d.ts +1 -0
  157. package/scatter/index.d.ts.map +1 -1
  158. package/scatter/index.js +1 -0
  159. package/scatter/scatter-chart.d.ts.map +1 -1
  160. package/scatter/scatter-chart.js +64 -22
  161. package/scatter/scatter-chart.props.d.ts +7 -1
  162. package/scatter/scatter-chart.props.d.ts.map +1 -1
  163. package/scatter/tooltip/default-scatter-tooltip.d.ts +8 -0
  164. package/scatter/tooltip/default-scatter-tooltip.d.ts.map +1 -0
  165. package/scatter/tooltip/default-scatter-tooltip.js +57 -0
  166. package/scatter/tooltip/index.d.ts +7 -0
  167. package/scatter/tooltip/index.d.ts.map +1 -0
  168. package/scatter/tooltip/index.js +4 -0
  169. package/scatter/tooltip/scatter-item-tooltip-presets.d.ts +5 -0
  170. package/scatter/tooltip/scatter-item-tooltip-presets.d.ts.map +1 -0
  171. package/scatter/tooltip/scatter-item-tooltip-presets.js +49 -0
  172. package/scatter/tooltip/scatter-item-tooltip.types.d.ts +22 -0
  173. package/scatter/tooltip/scatter-item-tooltip.types.d.ts.map +1 -0
  174. package/scatter/tooltip/scatter-item-tooltip.types.js +3 -0
  175. package/scatter/tooltip/scatter-item-tooltip.utils.d.ts +9 -0
  176. package/scatter/tooltip/scatter-item-tooltip.utils.d.ts.map +1 -0
  177. package/scatter/tooltip/scatter-item-tooltip.utils.js +83 -0
  178. package/scatter/tooltip/use-scatter-item-tooltip.d.ts +25 -0
  179. package/scatter/tooltip/use-scatter-item-tooltip.d.ts.map +1 -0
  180. package/scatter/tooltip/use-scatter-item-tooltip.js +46 -0
  181. package/tooltip/chart-pointer-tooltip-overlay.d.ts +11 -0
  182. package/tooltip/chart-pointer-tooltip-overlay.d.ts.map +1 -0
  183. package/tooltip/chart-pointer-tooltip-overlay.js +88 -0
  184. package/tooltip/chart-tooltip-preset-shells.d.ts +66 -0
  185. package/tooltip/chart-tooltip-preset-shells.d.ts.map +1 -0
  186. package/tooltip/chart-tooltip-preset-shells.js +409 -0
  187. package/tooltip/index.d.ts +7 -0
  188. package/tooltip/index.d.ts.map +1 -0
  189. package/tooltip/index.js +1 -0
@@ -1,4 +1,7 @@
1
1
  import type { CartesianChartProps, CartesianChartSelectEvent } from '../props/cartesian';
2
+ import type { ChartTooltipOption } from '../tooltip';
3
+ /** @deprecated Use {@link ChartTooltipOption} from `../tooltip`. */
4
+ export type AreaChartTooltip = ChartTooltipOption;
2
5
  /**
3
6
  * Area/line/bar series data shape:
4
7
  * - Single series: number[]
@@ -14,6 +17,7 @@ export type SeriesData = number[] | [string | number, number][] | Array<{
14
17
  }>;
15
18
  /** @deprecated Use {@link CartesianChartSelectEvent} from `../props/cartesian`. */
16
19
  export type AreaChartSelectEvent = CartesianChartSelectEvent;
20
+ export type { AxisTooltipParams as AreaChartAxisTooltipParams, AxisTooltipSeriesItem as AreaChartTooltipSeriesItem, } from '../cartesian/tooltip/axis-tooltip.types';
17
21
  /**
18
22
  * Props for AreaChart.
19
23
  * common -> cartesian -> area
@@ -1 +1 @@
1
- {"version":3,"file":"area-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,EAAE,GACR,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,GAC3B,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GACxC,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAAE,CAAC,CAAC;AAEhE,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IACtG;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;CACjD"}
1
+ {"version":3,"file":"area-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,EAAE,GACR,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,GAC3B,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GACxC,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAAE,CAAC,CAAC;AAEhE,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAE7D,YAAY,EACV,iBAAiB,IAAI,0BAA0B,EAC/C,qBAAqB,IAAI,0BAA0B,GACpD,MAAM,yCAAyC,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IACtG;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;CACjD"}
package/area/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { AreaChart } from './area-chart';
2
- export type { AreaChartProps, AreaChartSelectEvent, SeriesData, } from './area-chart.props';
2
+ export type { AreaChartProps, AreaChartSelectEvent, AreaChartAxisTooltipParams, AreaChartTooltip, AreaChartTooltipSeriesItem, SeriesData, } from './area-chart.props';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,UAAU,GACX,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAC"}
package/axis.d.ts CHANGED
@@ -1,3 +1,29 @@
1
1
  export declare const getAxisByMinMax: (min?: number, max?: number, interval?: number) => number[];
2
2
  export declare const getAxis: (data: number[]) => number[];
3
+ /**
4
+ * Maps explicit Cartesian Y (value) axis props to axis `min` / `max` / `interval`.
5
+ * When all three are omitted, returns `undefined` so the chart library chooses the scale.
6
+ */
7
+ export declare function valueAxisBoundsFromProps(params: {
8
+ minY?: number;
9
+ maxY?: number;
10
+ intervalY?: number;
11
+ }): {
12
+ min?: number;
13
+ max?: number;
14
+ interval?: number;
15
+ } | undefined;
16
+ /**
17
+ * Maps explicit Cartesian X-axis props to axis `min` / `max` / `interval`.
18
+ * When all three are omitted, returns `undefined` so the chart library chooses the scale.
19
+ */
20
+ export declare function xAxisBoundsFromProps(params: {
21
+ minX?: number;
22
+ maxX?: number;
23
+ intervalX?: number;
24
+ }): {
25
+ min?: number;
26
+ max?: number;
27
+ interval?: number;
28
+ } | undefined;
3
29
  //# sourceMappingURL=axis.d.ts.map
package/axis.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../components/chart/axis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,YAAO,EAAE,YAAS,EAAE,WAAW,MAAM,aAUpE,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,aAIrC,CAAA"}
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../components/chart/axis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,YAAO,EAAE,YAAS,EAAE,WAAW,MAAM,aAUpE,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,aAIrC,CAAA;AAiBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMhE"}
package/axis.js CHANGED
@@ -14,3 +14,38 @@ export const getAxis = (data) => {
14
14
  const max = Math.max(...data);
15
15
  return getAxisByMinMax(min, max);
16
16
  };
17
+ function axisMinMaxIntervalFromFields(params) {
18
+ const out = {};
19
+ if (params.min !== undefined)
20
+ out.min = params.min;
21
+ if (params.max !== undefined)
22
+ out.max = params.max;
23
+ if (params.interval !== undefined)
24
+ out.interval = params.interval;
25
+ if (out.min === undefined && out.max === undefined && out.interval === undefined) {
26
+ return undefined;
27
+ }
28
+ return out;
29
+ }
30
+ /**
31
+ * Maps explicit Cartesian Y (value) axis props to axis `min` / `max` / `interval`.
32
+ * When all three are omitted, returns `undefined` so the chart library chooses the scale.
33
+ */
34
+ export function valueAxisBoundsFromProps(params) {
35
+ return axisMinMaxIntervalFromFields({
36
+ min: params.minY,
37
+ max: params.maxY,
38
+ interval: params.intervalY,
39
+ });
40
+ }
41
+ /**
42
+ * Maps explicit Cartesian X-axis props to axis `min` / `max` / `interval`.
43
+ * When all three are omitted, returns `undefined` so the chart library chooses the scale.
44
+ */
45
+ export function xAxisBoundsFromProps(params) {
46
+ return axisMinMaxIntervalFromFields({
47
+ min: params.minX,
48
+ max: params.maxX,
49
+ interval: params.intervalX,
50
+ });
51
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"bubble-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/bubble/bubble-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,+CAA+C;AAC/C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAkV/E,eAAO,MAAM,WAAW;;;;;;;CAEtB,CAAC"}
1
+ {"version":3,"file":"bubble-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/bubble/bubble-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,OAAO,KAAqC,MAAM,OAAO,CAAC;AAY1D,+CAA+C;AAC/C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAwY/E,eAAO,MAAM,WAAW;;;;;;;CAEtB,CAAC"}
@@ -5,6 +5,11 @@ import { ScatterChart as EChartsScatterChart } from 'echarts/charts';
5
5
  import { GridComponent, LegendComponent, TooltipComponent, } from 'echarts/components';
6
6
  import * as echarts from 'echarts/core';
7
7
  import React, { useEffect, useMemo, useRef } from 'react';
8
+ import { View } from 'react-native';
9
+ import { valueAxisBoundsFromProps, xAxisBoundsFromProps } from '../axis';
10
+ import { echartsLegendLayoutFragment, mergeCartesianGridForLegend, } from '../legend/echarts-legend-layout';
11
+ import { axisTooltipShowContentFlag } from '../cartesian/tooltip';
12
+ import { createScatterTooltipPreset, useScatterItemTooltip } from '../scatter/tooltip';
8
13
  echarts.use([
9
14
  TooltipComponent,
10
15
  GridComponent,
@@ -18,12 +23,31 @@ function scaleSize(value, dataMin, dataMax, outMin, outMax) {
18
23
  const t = (value - dataMin) / (dataMax - dataMin);
19
24
  return outMin + t * (outMax - outMin);
20
25
  }
21
- const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', sizeRange = [8, 50], showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, boundaryGap = false, grid, showLegend = false, showHighlighter = true, xAxisTickLabelFormatter, yAxisTickLabelFormatter, xAxisLabel, yAxisLabel, onSelect, ...props }) => {
26
+ const DEFAULT_SIZE_RANGE = [8, 50];
27
+ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', sizeRange = DEFAULT_SIZE_RANGE, showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, boundaryGap = false, grid, showLegend = true, legendPosition = 'bottom', showHighlighter = true, tooltip = 'card', xAxisTickLabelFormatter, yAxisTickLabelFormatter, xAxisLabel, yAxisLabel, minX, maxX, intervalX, minY, maxY, intervalY, onSelect, renderTooltip, ...props }) => {
22
28
  const { theme } = useChartTheme(props.theme, props.colors);
23
29
  const chartRef = useRef(null);
24
30
  const onSelectRef = useRef(onSelect);
25
31
  onSelectRef.current = onSelect;
26
32
  const selectContextRef = useRef({ normalizedSeries: [] });
33
+ const themeSeriesRef = useRef(theme.series);
34
+ themeSeriesRef.current = theme.series;
35
+ const tooltipOverlayActive = renderTooltip != null || tooltip !== 'none';
36
+ const renderTooltipFn = useMemo(() => {
37
+ if (renderTooltip != null)
38
+ return renderTooltip;
39
+ if (tooltip === 'none')
40
+ return () => null;
41
+ return createScatterTooltipPreset(tooltip);
42
+ }, [renderTooltip, tooltip]);
43
+ const { attachScatterItemTooltipListeners, renderScatterTooltipOverlay } = useScatterItemTooltip({
44
+ active: tooltipOverlayActive,
45
+ renderTooltip: renderTooltipFn,
46
+ contextRef: selectContextRef,
47
+ themeSeriesRef,
48
+ width,
49
+ height,
50
+ });
27
51
  const normalizedSeries = useMemo(() => {
28
52
  if (!Array.isArray(data) || data.length === 0)
29
53
  return [];
@@ -52,42 +76,35 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
52
76
  return [];
53
77
  }, [data]);
54
78
  const hasNamedSeries = useMemo(() => normalizedSeries.some((s) => 'name' in s && s.name), [normalizedSeries]);
55
- selectContextRef.current = { normalizedSeries };
79
+ selectContextRef.current = {
80
+ normalizedSeries: normalizedSeries,
81
+ };
82
+ const valueAxisBounds = useMemo(() => valueAxisBoundsFromProps({ minY, maxY, intervalY }), [minY, maxY, intervalY]);
83
+ const xAxisBounds = useMemo(() => xAxisBoundsFromProps({ minX, maxX, intervalX }), [minX, maxX, intervalX]);
56
84
  const option = useMemo(() => {
57
- const tooltipConfig = showHighlighter
85
+ const tooltipConfig = tooltipOverlayActive
58
86
  ? {
59
87
  trigger: 'item',
60
- axisPointer: {
61
- type: 'cross',
62
- lineStyle: {
88
+ ...axisTooltipShowContentFlag(true),
89
+ ...(showHighlighter && {
90
+ axisPointer: {
63
91
  type: 'line',
64
- width: 1,
65
- color: theme.series[0]?.color ?? '#999',
92
+ lineStyle: {
93
+ type: 'line',
94
+ width: 1,
95
+ color: '#00000000',
96
+ },
97
+ label: {
98
+ show: false,
99
+ },
66
100
  },
67
- },
68
- formatter: (params) => {
69
- const p = Array.isArray(params) ? params[0] : params;
70
- const d = p?.data;
71
- if (!d || !Array.isArray(d))
72
- return '';
73
- const name = p.seriesName ? `${p.seriesName}<br/>` : '';
74
- return `${name}x: ${d[0]}, y: ${d[1]}${d[2] != null ? `, size: ${d[2]}` : ''}`;
75
- },
101
+ }),
76
102
  }
77
- : {
78
- trigger: 'item',
79
- formatter: (params) => {
80
- const p = Array.isArray(params) ? params[0] : params;
81
- const d = p?.data;
82
- if (!d || !Array.isArray(d))
83
- return '';
84
- const name = p.seriesName ? `${p.seriesName}<br/>` : '';
85
- return `${name}x: ${d[0]}, y: ${d[1]}${d[2] != null ? `, size: ${d[2]}` : ''}`;
86
- },
87
- };
103
+ : { show: false };
88
104
  const xAxisConfig = {
89
105
  type: 'value',
90
106
  boundaryGap,
107
+ ...(xAxisBounds ?? {}),
91
108
  ...(xAxisLabel != null && xAxisLabel !== '' && {
92
109
  name: xAxisLabel,
93
110
  nameLocation: 'middle',
@@ -109,7 +126,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
109
126
  }
110
127
  : { show: false },
111
128
  axisTick: {
112
- show: showXAxisTicks,
129
+ show: showXAxis && showXAxisTicks,
113
130
  lineStyle: {
114
131
  color: theme.axis.x.tickColor,
115
132
  width: theme.axis.x.tickWidth,
@@ -125,6 +142,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
125
142
  };
126
143
  const yAxisConfig = {
127
144
  type: 'value',
145
+ ...(valueAxisBounds ?? {}),
128
146
  ...(yAxisLabel != null && yAxisLabel !== '' && {
129
147
  name: yAxisLabel,
130
148
  nameLocation: 'middle',
@@ -146,7 +164,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
146
164
  }
147
165
  : { show: false },
148
166
  axisTick: {
149
- show: showYAxisTicks,
167
+ show: showYAxis && showYAxisTicks,
150
168
  lineStyle: {
151
169
  color: theme.axis.y.tickColor,
152
170
  width: theme.axis.y.tickWidth,
@@ -165,6 +183,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
165
183
  data: normalizedSeries
166
184
  .filter((s) => 'name' in s && s.name)
167
185
  .map((s) => s.name),
186
+ ...echartsLegendLayoutFragment(legendPosition),
168
187
  textStyle: {
169
188
  color: theme.legend.textColor,
170
189
  fontSize: theme.legend.fontSize,
@@ -193,7 +212,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
193
212
  itemStyle: { color: seriesColor },
194
213
  emphasis: showHighlighter
195
214
  ? {
196
- focus: 'self',
215
+ focus: 'none',
197
216
  scale: true,
198
217
  itemStyle: {
199
218
  color: seriesColor,
@@ -215,8 +234,10 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
215
234
  };
216
235
  if (legendConfig)
217
236
  config.legend = legendConfig;
218
- if (grid)
219
- config.grid = grid;
237
+ const mergedGrid = mergeCartesianGridForLegend(grid, legendPosition, showLegend, hasNamedSeries);
238
+ if (mergedGrid !== undefined && Object.keys(mergedGrid).length > 0) {
239
+ config.grid = mergedGrid;
240
+ }
220
241
  return config;
221
242
  }, [
222
243
  theme,
@@ -232,19 +253,25 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
232
253
  boundaryGap,
233
254
  grid,
234
255
  showLegend,
256
+ legendPosition,
235
257
  hasNamedSeries,
236
258
  showHighlighter,
259
+ tooltipOverlayActive,
237
260
  xAxisTickLabelFormatter,
238
261
  yAxisTickLabelFormatter,
239
262
  xAxisLabel,
240
263
  yAxisLabel,
264
+ valueAxisBounds,
265
+ xAxisBounds,
241
266
  ]);
242
267
  useEffect(() => {
243
268
  let chart;
269
+ let detachScatterTooltip = () => { };
244
270
  if (chartRef.current) {
245
271
  try {
246
272
  chart = echarts.init(chartRef.current, 'light', { width, height });
247
273
  chart.setOption(option);
274
+ detachScatterTooltip = attachScatterItemTooltipListeners(chart);
248
275
  const handleSeriesClick = (params) => {
249
276
  const cb = onSelectRef.current;
250
277
  if (typeof cb !== 'function')
@@ -287,6 +314,7 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
287
314
  }
288
315
  }
289
316
  return () => {
317
+ detachScatterTooltip();
290
318
  if (chart) {
291
319
  try {
292
320
  chart.dispose();
@@ -296,8 +324,11 @@ const ChartComponent = ({ data, width = 220, height = 350, symbol = 'circle', si
296
324
  }
297
325
  }
298
326
  };
299
- }, [option, width, height]);
300
- return <SkiaChart ref={chartRef} useRNGH/>;
327
+ }, [option, width, height, attachScatterItemTooltipListeners]);
328
+ return (<View style={{ width, height, position: 'relative' }}>
329
+ <SkiaChart ref={chartRef} useRNGH/>
330
+ {renderScatterTooltipOverlay()}
331
+ </View>);
301
332
  };
302
333
  const BubbleChartComponent = withResponsiveContainer(withChartTheme(ChartComponent));
303
334
  export const BubbleChart = Object.assign(BubbleChartComponent, {
@@ -1 +1 @@
1
- {"version":3,"file":"candlestick-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/candlestick/candlestick-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAmB,MAAM,2BAA2B,CAAC;AASxF,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAyUzG,eAAO,MAAM,gBAAgB;;;;;;;CAE3B,CAAC"}
1
+ {"version":3,"file":"candlestick-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/candlestick/candlestick-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAmB,MAAM,2BAA2B,CAAC;AASxF,OAAO,KAAqC,MAAM,OAAO,CAAC;AAK1D,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwWzG,eAAO,MAAM,gBAAgB;;;;;;;CAE3B,CAAC"}
@@ -5,6 +5,8 @@ import { BarChart, CandlestickChart as EChartsCandlestickChart, LineChart } from
5
5
  import { GridComponent, LegendComponent, TooltipComponent, } from 'echarts/components';
6
6
  import * as echarts from 'echarts/core';
7
7
  import React, { useEffect, useMemo, useRef } from 'react';
8
+ import { valueAxisBoundsFromProps, xAxisBoundsFromProps } from '../axis';
9
+ import { echartsLegendLayoutFragment } from '../legend/echarts-legend-layout';
8
10
  echarts.use([
9
11
  TooltipComponent,
10
12
  GridComponent,
@@ -14,25 +16,25 @@ echarts.use([
14
16
  BarChart,
15
17
  LineChart,
16
18
  ]);
17
- const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width = 220, height = 350, boundaryGap = true, showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, grid, showLegend = false, showHighlighter = true, positiveColor = '#008000', negativeColor = '#FF2C2C', xAxisTickLabelFormatter, yAxisTickLabelFormatter, xAxisTicks, xAxisLabel, yAxisLabel, onSelect, ...props }) => {
19
+ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width = 220, height = 350, boundaryGap = true, showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, grid, showLegend = true, legendPosition = 'bottom', showHighlighter = true, positiveColor = '#008000', negativeColor = '#FF2C2C', xAxisTickLabelFormatter, yAxisTickLabelFormatter, xAxisLabel, yAxisLabel, minX, maxX, intervalX, minY, maxY, intervalY, onSelect, ...props }) => {
18
20
  const { theme } = useChartTheme(props.theme, undefined);
19
21
  const chartRef = useRef(null);
20
22
  const onSelectRef = useRef(onSelect);
21
23
  onSelectRef.current = onSelect;
22
24
  const selectContextRef = useRef({ categories: [], ohlcData: [] });
23
25
  const categories = useMemo(() => {
24
- if (xAxisTicks != null && xAxisTicks.length > 0)
25
- return xAxisTicks;
26
26
  if (xAxisData?.length)
27
27
  return xAxisData.map(String);
28
28
  return data.map((_, i) => String(i));
29
- }, [xAxisTicks, xAxisData, data]);
29
+ }, [xAxisData, data]);
30
30
  const hasVolume = volumeData != null && volumeData.length > 0;
31
31
  const hasMA = (ma5?.length ?? 0) > 0 || (ma10?.length ?? 0) > 0 || (ma20?.length ?? 0) > 0;
32
32
  selectContextRef.current = { categories, ohlcData: data };
33
33
  const option = useMemo(() => {
34
34
  if (!data?.length)
35
35
  return { series: [] };
36
+ const valueAxisBounds = valueAxisBoundsFromProps({ minY, maxY, intervalY });
37
+ const xAxisBounds = xAxisBoundsFromProps({ minX, maxX, intervalX });
36
38
  const tooltipConfig = showHighlighter
37
39
  ? {
38
40
  trigger: 'axis',
@@ -47,6 +49,24 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
47
49
  const volumeGrid = hasVolume
48
50
  ? { left: '10%', right: '8%', top: '72%', height: '18%' }
49
51
  : undefined;
52
+ if (showLegend && hasMA) {
53
+ if (legendPosition === 'left') {
54
+ mainGrid.left = '30%';
55
+ if (volumeGrid)
56
+ volumeGrid.left = '30%';
57
+ }
58
+ else if (legendPosition === 'right') {
59
+ mainGrid.right = '30%';
60
+ if (volumeGrid)
61
+ volumeGrid.right = '30%';
62
+ }
63
+ else if (legendPosition === 'top') {
64
+ mainGrid.top = hasVolume ? '18%' : '14%';
65
+ }
66
+ else if (legendPosition === 'bottom' && !hasVolume) {
67
+ mainGrid.bottom = '24%';
68
+ }
69
+ }
50
70
  const xAxisMain = {
51
71
  type: 'category',
52
72
  data: categories,
@@ -66,13 +86,14 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
66
86
  ? { show: true, lineStyle: { color: theme.axis.x.lineColor, width: theme.axis.x.lineWidth } }
67
87
  : { show: false },
68
88
  axisTick: {
69
- show: showXAxisTicks,
89
+ show: showXAxis && showXAxisTicks,
70
90
  lineStyle: { color: theme.axis.x.tickColor, width: theme.axis.x.tickWidth },
71
91
  },
72
92
  splitLine: {
73
93
  show: showXAxisSplitLines,
74
94
  lineStyle: { color: theme.axis.x.splitLineColor, width: theme.axis.x.splitLineWidth },
75
95
  },
96
+ ...(xAxisBounds ?? {}),
76
97
  };
77
98
  if (hasVolume) {
78
99
  xAxisMain.gridIndex = 0;
@@ -80,7 +101,7 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
80
101
  }
81
102
  const yAxisMain = {
82
103
  type: 'value',
83
- scale: true,
104
+ ...(valueAxisBounds ?? { scale: true }),
84
105
  ...(yAxisLabel != null && yAxisLabel !== '' && {
85
106
  name: yAxisLabel,
86
107
  nameLocation: 'middle',
@@ -96,7 +117,7 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
96
117
  ? { show: true, lineStyle: { color: theme.axis.y.lineColor, width: theme.axis.y.lineWidth } }
97
118
  : { show: false },
98
119
  axisTick: {
99
- show: showYAxisTicks,
120
+ show: showYAxis && showYAxisTicks,
100
121
  lineStyle: { color: theme.axis.y.tickColor, width: theme.axis.y.tickWidth },
101
122
  },
102
123
  splitLine: {
@@ -201,6 +222,7 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
201
222
  return ma10?.length;
202
223
  return ma20?.length;
203
224
  }),
225
+ ...echartsLegendLayoutFragment(legendPosition),
204
226
  textStyle: { color: theme.legend.textColor, fontSize: theme.legend.fontSize },
205
227
  backgroundColor: theme.legend.backgroundColor,
206
228
  };
@@ -225,14 +247,21 @@ const ChartComponent = ({ data, xAxisData, volumeData, ma5, ma10, ma20, width =
225
247
  showYAxisSplitLines,
226
248
  grid,
227
249
  showLegend,
250
+ legendPosition,
251
+ hasMA,
228
252
  showHighlighter,
229
253
  positiveColor,
230
254
  negativeColor,
231
255
  xAxisTickLabelFormatter,
232
256
  yAxisTickLabelFormatter,
233
- xAxisTicks,
234
257
  xAxisLabel,
235
258
  yAxisLabel,
259
+ minX,
260
+ maxX,
261
+ intervalX,
262
+ minY,
263
+ maxY,
264
+ intervalY,
236
265
  ]);
237
266
  useEffect(() => {
238
267
  let chart;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { ChartTooltipPreset } from '../../tooltip';
3
+ import type { AxisTooltipParams } from './axis-tooltip.types';
4
+ export declare function createAxisTooltipPreset(preset: ChartTooltipPreset): (params: AxisTooltipParams) => React.ReactElement;
5
+ //# sourceMappingURL=axis-tooltip-presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis-tooltip-presets.d.ts","sourceRoot":"","sources":["../../../../../components/chart/cartesian/tooltip/axis-tooltip-presets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA0D9D,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,kBAAkB,GACzB,CAAC,MAAM,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAYnD"}
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { TooltipPresetCard, TooltipPresetCompact, TooltipPresetKpi, TooltipPresetStriped, } from '../../tooltip/chart-tooltip-preset-shells';
3
+ function axisCardFromParams({ axisValue, series }) {
4
+ return (<TooltipPresetCard categoryTitle={String(axisValue)} seriesRows={series.map((s) => ({
5
+ key: s.seriesIndex,
6
+ swatchColor: s.color ?? '#94a3b8',
7
+ label: s.seriesName,
8
+ value: s.value,
9
+ }))}/>);
10
+ }
11
+ function axisCompactFromParams({ axisValue, series }) {
12
+ const detail = series.map((s) => `${s.seriesName} ${s.value}`).join(' · ');
13
+ return <TooltipPresetCompact emphasis={String(axisValue)} detail={detail} wrap/>;
14
+ }
15
+ function axisKpiFromParams({ axisValue, series }) {
16
+ const primary = series[0];
17
+ const rest = series.slice(1);
18
+ return (<TooltipPresetKpi accentColor={primary?.color ?? '#3b82f6'} minWidth={160} overline={String(axisValue)} metric={primary?.value ?? ''} caption={primary?.seriesName} footerRows={rest.length > 0
19
+ ? rest.map((s) => ({
20
+ key: s.seriesIndex,
21
+ left: s.seriesName,
22
+ right: s.value,
23
+ }))
24
+ : undefined}/>);
25
+ }
26
+ function axisStripedFromParams({ axisValue, series }) {
27
+ return (<TooltipPresetStriped headerTitle={String(axisValue)} rows={series.map((s) => ({
28
+ key: `s-${s.seriesIndex}`,
29
+ leftLabel: s.seriesName,
30
+ leftSwatchColor: s.color ?? '#64748b',
31
+ right: s.value,
32
+ }))}/>);
33
+ }
34
+ export function createAxisTooltipPreset(preset) {
35
+ switch (preset) {
36
+ case 'card':
37
+ return (p) => axisCardFromParams(p);
38
+ case 'compact':
39
+ return (p) => axisCompactFromParams(p);
40
+ case 'kpi':
41
+ return (p) => axisKpiFromParams(p);
42
+ case 'striped':
43
+ return (p) => axisStripedFromParams(p);
44
+ }
45
+ throw new Error(`Unknown tooltip preset: ${String(preset)}`);
46
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Types for axis-triggered tooltips (category axis + one value per series).
3
+ * Used by area, line, column, and bar charts.
4
+ */
5
+ /** One series row at the hovered category index. */
6
+ export interface AxisTooltipSeriesItem {
7
+ seriesName: string;
8
+ value: number;
9
+ seriesIndex: number;
10
+ color?: string;
11
+ }
12
+ /** Axis tooltip fields without pointer position. */
13
+ export interface AxisTooltipContentParams {
14
+ axisValue: string | number;
15
+ dataIndex: number;
16
+ series: AxisTooltipSeriesItem[];
17
+ }
18
+ /** Payload for `renderTooltip` (includes pointer in chart pixel space). */
19
+ export interface AxisTooltipParams extends AxisTooltipContentParams {
20
+ pointerX: number;
21
+ pointerY: number;
22
+ }
23
+ /**
24
+ * Ref snapshot read when `showTip` fires. Keep `categoryAxisData` in sync with the chart’s category axis `data`.
25
+ */
26
+ export interface AxisTooltipContext {
27
+ displaySeries: Array<{
28
+ name?: string;
29
+ data: [string | number, number][] | number[];
30
+ }>;
31
+ categoryAxisData: (string | number)[];
32
+ /**
33
+ * Set when the category axis is Y (horizontal column/bar). `showTip` lists that axis in `dataByAxis`;
34
+ * reading `[0]` would be the value axis and yields a stuck `dataIndex`.
35
+ */
36
+ categoryAxisIsY?: boolean;
37
+ }
38
+ //# sourceMappingURL=axis-tooltip.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis-tooltip.types.d.ts","sourceRoot":"","sources":["../../../../../components/chart/cartesian/tooltip/axis-tooltip.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oDAAoD;AACpD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,2EAA2E;AAC3E,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACtF,gBAAgB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Types for axis-triggered tooltips (category axis + one value per series).
3
+ * Used by area, line, column, and bar charts.
4
+ */
@@ -0,0 +1,10 @@
1
+ import type { AxisTooltipContext, AxisTooltipParams } from './axis-tooltip.types';
2
+ /** Build axis tooltip params from an ECharts `showTip` dispatch payload. */
3
+ export declare function axisTooltipParamsFromShowTipEvent(evt: any, ctx: AxisTooltipContext, seriesTheme: Array<{
4
+ color: string;
5
+ }>): AxisTooltipParams | null;
6
+ /** Spread onto ECharts `tooltip` when using an RN overlay (`showTip` / `hideTip` still fire). */
7
+ export declare function axisTooltipShowContentFlag(useCustomTooltipOverlay: boolean): {
8
+ showContent: boolean;
9
+ };
10
+ //# sourceMappingURL=axis-tooltip.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis-tooltip.utils.d.ts","sourceRoot":"","sources":["../../../../../components/chart/cartesian/tooltip/axis-tooltip.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAyB,MAAM,sBAAsB,CAAC;AAsEzG,4EAA4E;AAC5E,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,kBAAkB,EACvB,WAAW,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACpC,iBAAiB,GAAG,IAAI,CAsD1B;AAED,iGAAiG;AACjG,wBAAgB,0BAA0B,CACxC,uBAAuB,EAAE,OAAO,GAC/B;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAE1B"}