@antv/gpt-vis 1.0.1 → 1.3.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 (172) hide show
  1. package/README.md +113 -36
  2. package/README.zh-CN.md +113 -36
  3. package/dist/cjs/index.d.ts +1 -1
  4. package/dist/cjs/theme/g2.d.ts +9 -0
  5. package/dist/cjs/theme/g2.js +605 -0
  6. package/dist/cjs/theme/g6.d.ts +28 -0
  7. package/dist/cjs/theme/g6.js +124 -0
  8. package/dist/cjs/theme/merge.d.ts +2 -0
  9. package/dist/cjs/theme/merge.js +49 -0
  10. package/dist/cjs/theme/resolve.d.ts +7 -0
  11. package/dist/cjs/theme/resolve.js +58 -0
  12. package/dist/cjs/theme/shared.d.ts +7 -0
  13. package/dist/cjs/theme/shared.js +61 -0
  14. package/dist/cjs/theme/summary.d.ts +11 -0
  15. package/dist/cjs/theme/summary.js +61 -0
  16. package/dist/cjs/theme/table.d.ts +13 -0
  17. package/dist/cjs/theme/table.js +121 -0
  18. package/dist/cjs/types/index.d.ts +8 -5
  19. package/dist/cjs/types/theme.d.ts +107 -0
  20. package/dist/cjs/types/theme.js +17 -0
  21. package/dist/cjs/util/animation.js +6 -1
  22. package/dist/cjs/util/components.d.ts +20 -0
  23. package/dist/cjs/util/components.js +40 -0
  24. package/dist/cjs/util/crosshair-axis-labels.d.ts +7 -2
  25. package/dist/cjs/util/crosshair-axis-labels.js +144 -30
  26. package/dist/cjs/util/html.d.ts +1 -0
  27. package/dist/cjs/util/html.js +29 -0
  28. package/dist/cjs/util/index.d.ts +0 -2
  29. package/dist/cjs/util/index.js +1 -5
  30. package/dist/cjs/util/interaction.d.ts +4 -3
  31. package/dist/cjs/util/interaction.js +14 -1
  32. package/dist/cjs/util/tokens.d.ts +4 -3
  33. package/dist/cjs/util/tokens.js +13 -10
  34. package/dist/cjs/vis/area/index.d.ts +3 -6
  35. package/dist/cjs/vis/area/index.js +43 -30
  36. package/dist/cjs/vis/bar/index.d.ts +5 -5
  37. package/dist/cjs/vis/bar/index.js +34 -20
  38. package/dist/cjs/vis/boxplot/index.d.ts +4 -5
  39. package/dist/cjs/vis/boxplot/index.js +36 -23
  40. package/dist/cjs/vis/column/index.d.ts +5 -5
  41. package/dist/cjs/vis/column/index.js +38 -26
  42. package/dist/cjs/vis/dual-axes/index.d.ts +3 -4
  43. package/dist/cjs/vis/dual-axes/index.js +87 -51
  44. package/dist/cjs/vis/fishbone-diagram/index.d.ts +4 -10
  45. package/dist/cjs/vis/fishbone-diagram/index.js +43 -28
  46. package/dist/cjs/vis/flow-diagram/index.d.ts +4 -6
  47. package/dist/cjs/vis/flow-diagram/index.js +21 -22
  48. package/dist/cjs/vis/funnel/index.d.ts +3 -6
  49. package/dist/cjs/vis/funnel/index.js +77 -58
  50. package/dist/cjs/vis/histogram/index.d.ts +4 -6
  51. package/dist/cjs/vis/histogram/index.js +17 -19
  52. package/dist/cjs/vis/indented-tree/index.d.ts +4 -6
  53. package/dist/cjs/vis/indented-tree/index.js +58 -34
  54. package/dist/cjs/vis/line/index.d.ts +3 -6
  55. package/dist/cjs/vis/line/index.js +43 -22
  56. package/dist/cjs/vis/liquid/index.d.ts +4 -6
  57. package/dist/cjs/vis/liquid/index.js +22 -17
  58. package/dist/cjs/vis/mindmap/index.d.ts +4 -6
  59. package/dist/cjs/vis/mindmap/index.js +43 -25
  60. package/dist/cjs/vis/network-graph/index.d.ts +4 -6
  61. package/dist/cjs/vis/network-graph/index.js +26 -20
  62. package/dist/cjs/vis/organization-chart/index.d.ts +4 -6
  63. package/dist/cjs/vis/organization-chart/index.js +39 -33
  64. package/dist/cjs/vis/pie/index.d.ts +3 -5
  65. package/dist/cjs/vis/pie/index.js +45 -26
  66. package/dist/cjs/vis/radar/index.d.ts +3 -6
  67. package/dist/cjs/vis/radar/index.js +32 -24
  68. package/dist/cjs/vis/sankey/index.d.ts +4 -6
  69. package/dist/cjs/vis/sankey/index.js +17 -7
  70. package/dist/cjs/vis/scatter/index.d.ts +3 -5
  71. package/dist/cjs/vis/scatter/index.js +32 -19
  72. package/dist/cjs/vis/summary/index.js +5 -6
  73. package/dist/cjs/vis/table/index.d.ts +4 -2
  74. package/dist/cjs/vis/table/index.js +56 -8
  75. package/dist/cjs/vis/treemap/index.d.ts +4 -6
  76. package/dist/cjs/vis/treemap/index.js +11 -7
  77. package/dist/cjs/vis/venn/index.d.ts +4 -6
  78. package/dist/cjs/vis/venn/index.js +18 -16
  79. package/dist/cjs/vis/violin/index.d.ts +4 -5
  80. package/dist/cjs/vis/violin/index.js +35 -27
  81. package/dist/cjs/vis/waterfall/index.d.ts +4 -4
  82. package/dist/cjs/vis/waterfall/index.js +48 -39
  83. package/dist/cjs/vis/word-cloud/index.d.ts +3 -5
  84. package/dist/cjs/vis/word-cloud/index.js +18 -12
  85. package/dist/esm/index.d.ts +1 -1
  86. package/dist/esm/theme/g2.d.ts +9 -0
  87. package/dist/esm/theme/g2.js +504 -0
  88. package/dist/esm/theme/g6.d.ts +28 -0
  89. package/dist/esm/theme/g6.js +84 -0
  90. package/dist/esm/theme/merge.d.ts +2 -0
  91. package/dist/esm/theme/merge.js +36 -0
  92. package/dist/esm/theme/resolve.d.ts +7 -0
  93. package/dist/esm/theme/resolve.js +27 -0
  94. package/dist/esm/theme/shared.d.ts +7 -0
  95. package/dist/esm/theme/shared.js +21 -0
  96. package/dist/esm/theme/summary.d.ts +11 -0
  97. package/dist/esm/theme/summary.js +45 -0
  98. package/dist/esm/theme/table.d.ts +13 -0
  99. package/dist/esm/theme/table.js +112 -0
  100. package/dist/esm/types/index.d.ts +8 -5
  101. package/dist/esm/types/theme.d.ts +107 -0
  102. package/dist/esm/types/theme.js +1 -0
  103. package/dist/esm/util/animation.js +12 -2
  104. package/dist/esm/util/components.d.ts +20 -0
  105. package/dist/esm/util/components.js +57 -1
  106. package/dist/esm/util/crosshair-axis-labels.d.ts +7 -2
  107. package/dist/esm/util/crosshair-axis-labels.js +156 -35
  108. package/dist/esm/util/html.d.ts +1 -0
  109. package/dist/esm/util/html.js +3 -0
  110. package/dist/esm/util/index.d.ts +0 -2
  111. package/dist/esm/util/index.js +1 -3
  112. package/dist/esm/util/interaction.d.ts +4 -3
  113. package/dist/esm/util/interaction.js +18 -1
  114. package/dist/esm/util/tokens.d.ts +4 -3
  115. package/dist/esm/util/tokens.js +13 -10
  116. package/dist/esm/vis/area/index.d.ts +3 -6
  117. package/dist/esm/vis/area/index.js +53 -45
  118. package/dist/esm/vis/bar/index.d.ts +5 -5
  119. package/dist/esm/vis/bar/index.js +38 -27
  120. package/dist/esm/vis/boxplot/index.d.ts +4 -5
  121. package/dist/esm/vis/boxplot/index.js +47 -29
  122. package/dist/esm/vis/column/index.d.ts +5 -5
  123. package/dist/esm/vis/column/index.js +46 -36
  124. package/dist/esm/vis/dual-axes/index.d.ts +3 -4
  125. package/dist/esm/vis/dual-axes/index.js +97 -57
  126. package/dist/esm/vis/fishbone-diagram/index.d.ts +4 -10
  127. package/dist/esm/vis/fishbone-diagram/index.js +52 -27
  128. package/dist/esm/vis/flow-diagram/index.d.ts +4 -6
  129. package/dist/esm/vis/flow-diagram/index.js +28 -23
  130. package/dist/esm/vis/funnel/index.d.ts +3 -6
  131. package/dist/esm/vis/funnel/index.js +78 -68
  132. package/dist/esm/vis/histogram/index.d.ts +4 -6
  133. package/dist/esm/vis/histogram/index.js +28 -21
  134. package/dist/esm/vis/indented-tree/index.d.ts +4 -6
  135. package/dist/esm/vis/indented-tree/index.js +59 -52
  136. package/dist/esm/vis/line/index.d.ts +3 -6
  137. package/dist/esm/vis/line/index.js +44 -32
  138. package/dist/esm/vis/liquid/index.d.ts +4 -6
  139. package/dist/esm/vis/liquid/index.js +28 -21
  140. package/dist/esm/vis/mindmap/index.d.ts +4 -6
  141. package/dist/esm/vis/mindmap/index.js +32 -28
  142. package/dist/esm/vis/network-graph/index.d.ts +4 -6
  143. package/dist/esm/vis/network-graph/index.js +37 -22
  144. package/dist/esm/vis/organization-chart/index.d.ts +4 -6
  145. package/dist/esm/vis/organization-chart/index.js +47 -36
  146. package/dist/esm/vis/pie/index.d.ts +3 -5
  147. package/dist/esm/vis/pie/index.js +42 -26
  148. package/dist/esm/vis/radar/index.d.ts +3 -6
  149. package/dist/esm/vis/radar/index.js +28 -20
  150. package/dist/esm/vis/sankey/index.d.ts +4 -6
  151. package/dist/esm/vis/sankey/index.js +20 -10
  152. package/dist/esm/vis/scatter/index.d.ts +3 -5
  153. package/dist/esm/vis/scatter/index.js +32 -21
  154. package/dist/esm/vis/summary/index.js +5 -7
  155. package/dist/esm/vis/table/index.d.ts +4 -2
  156. package/dist/esm/vis/table/index.js +48 -11
  157. package/dist/esm/vis/treemap/index.d.ts +4 -6
  158. package/dist/esm/vis/treemap/index.js +16 -11
  159. package/dist/esm/vis/venn/index.d.ts +4 -6
  160. package/dist/esm/vis/venn/index.js +24 -16
  161. package/dist/esm/vis/violin/index.d.ts +4 -5
  162. package/dist/esm/vis/violin/index.js +45 -37
  163. package/dist/esm/vis/waterfall/index.d.ts +4 -4
  164. package/dist/esm/vis/waterfall/index.js +46 -36
  165. package/dist/esm/vis/word-cloud/index.d.ts +3 -5
  166. package/dist/esm/vis/word-cloud/index.js +24 -17
  167. package/dist/umd/index.min.js +1 -1
  168. package/package.json +1 -1
  169. package/dist/cjs/util/theme.d.ts +0 -20
  170. package/dist/cjs/util/theme.js +0 -372
  171. package/dist/esm/util/theme.d.ts +0 -20
  172. package/dist/esm/util/theme.js +0 -326
@@ -1,4 +1,13 @@
1
+ var _excluded = ["visible", "defaultVisible", "contrast", "style", "transform"];
1
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -64,4 +73,51 @@ export var getColorLegend = function getColorLegend(visible) {
64
73
  return visible ? {
65
74
  color: {}
66
75
  } : false;
67
- };
76
+ };
77
+
78
+ /** Label content and placement belong to the chart; paint comes from the native theme. */
79
+ export function getDataLabels(theme, _ref3) {
80
+ var _theme$label, _theme$innerLabel;
81
+ var visible = _ref3.visible,
82
+ _ref3$defaultVisible = _ref3.defaultVisible,
83
+ defaultVisible = _ref3$defaultVisible === void 0 ? false : _ref3$defaultVisible,
84
+ contrast = _ref3.contrast,
85
+ style = _ref3.style,
86
+ transform = _ref3.transform,
87
+ content = _objectWithoutProperties(_ref3, _excluded);
88
+ if (visible === false) return [];
89
+ if (visible !== true && !defaultVisible) return undefined;
90
+ var paint = contrast === 'inside' ? theme.innerLabel : theme.label;
91
+ var textColor = (_theme$label = theme.label) === null || _theme$label === void 0 ? void 0 : _theme$label.fill;
92
+ var inverseColor = (_theme$innerLabel = theme.innerLabel) === null || _theme$innerLabel === void 0 ? void 0 : _theme$innerLabel.fill;
93
+ var contrastTransform = contrast === 'inside' && textColor !== inverseColor ? [{
94
+ type: 'contrastReverse',
95
+ palette: [textColor, inverseColor]
96
+ }] : [];
97
+ var transforms = [].concat(contrastTransform, _toConsumableArray(transform !== null && transform !== void 0 ? transform : []));
98
+ return [_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, content), transforms.length ? {
99
+ transform: transforms
100
+ } : {}), style), paint)];
101
+ }
102
+
103
+ /** Keep the title plugin's canvas and graph padding in step with its typography. */
104
+ export function getGraphTitle(title, subtitle) {
105
+ var _style$titleFontSize, _style$spacing, _style$subtitleFontSi;
106
+ var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
107
+ if (!title) return {
108
+ plugins: [],
109
+ padding: 20
110
+ };
111
+ var contentHeight = Math.ceil(((_style$titleFontSize = style.titleFontSize) !== null && _style$titleFontSize !== void 0 ? _style$titleFontSize : 16) * 1.2) + (subtitle ? ((_style$spacing = style.spacing) !== null && _style$spacing !== void 0 ? _style$spacing : 8) + Math.ceil(((_style$subtitleFontSi = style.subtitleFontSize) !== null && _style$subtitleFontSi !== void 0 ? _style$subtitleFontSi : 12) * 1.2) : 0);
112
+ return {
113
+ plugins: [_objectSpread(_objectSpread({
114
+ key: 'title',
115
+ type: 'title',
116
+ title: title,
117
+ subtitle: subtitle
118
+ }, style), {}, {
119
+ size: Math.max(44, contentHeight)
120
+ })],
121
+ padding: [Math.max(46, Math.ceil(contentHeight + 24)), 20, 20, 20]
122
+ };
123
+ }
@@ -1,9 +1,14 @@
1
1
  import { type Chart } from '@antv/g2';
2
- import type { VisualizationTheme } from '../types';
2
+ export type CrosshairAxisLabelsOptions = {
3
+ showXLabel?: boolean;
4
+ useStandaloneYLabel?: boolean;
5
+ yAxisPosition?: 'left' | 'right';
6
+ yField?: string;
7
+ };
3
8
  /**
4
9
  * Bridges G2 tooltip crosshairs to axis value tags.
5
10
  *
6
11
  * G2 does not currently expose axis tags for tooltip crosshairs, so this adapter
7
12
  * reads the rule geometry created by G2 5.4 and renders labels with LineCrosshair.
8
13
  */
9
- export declare const bindCrosshairAxisLabels: (chart: Chart, theme: VisualizationTheme) => (() => void);
14
+ export declare const bindCrosshairAxisLabels: (chart: Chart, theme: string, { showXLabel, useStandaloneYLabel, yAxisPosition, yField, }?: CrosshairAxisLabelsOptions) => (() => void);
@@ -11,27 +11,39 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
11
11
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
12
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- import { LineCrosshair } from '@antv/component';
14
+ import { LineCrosshair, Tag } from '@antv/component';
15
15
  import { selectPlotArea } from '@antv/g2';
16
16
  import { CHART_FONT_FAMILY, getChartVisualTokens } from "./tokens";
17
+ var MAX_CROSSHAIR_DECIMAL_PLACES = 6;
18
+ var CROSSHAIR_LABEL_MARGIN = 4;
17
19
  var formatCrosshairAxisValue = function formatCrosshairAxisValue(value, formatter, precision) {
18
20
  if (value === undefined || value === null || value === '') return '';
21
+ var displayValue = value;
19
22
  try {
20
23
  var formatted = formatter === null || formatter === void 0 ? void 0 : formatter(value);
21
- if (formatted !== undefined && formatted !== null) return String(formatted);
24
+ if (formatted !== undefined && formatted !== null) {
25
+ var numericFormatted = typeof formatted === 'number' || typeof formatted === 'string' && formatted.trim() !== '' && Number.isFinite(Number(formatted)) ? Number(formatted) : undefined;
26
+ if (numericFormatted === undefined) return String(formatted);
27
+ displayValue = numericFormatted;
28
+ }
22
29
  } catch (_unused) {
23
30
  // Fall back to the original value when a scale formatter rejects it.
24
31
  }
25
- if (value instanceof Date) return value.toLocaleString();
26
- if (typeof value === 'number' && Number.isFinite(value) && precision !== undefined) {
27
- return value.toFixed(precision);
32
+ if (displayValue instanceof Date) return displayValue.toLocaleString();
33
+ if (typeof displayValue === 'number' && Number.isFinite(displayValue)) {
34
+ if (displayValue !== 0 && Math.abs(displayValue) < Math.pow(10, -MAX_CROSSHAIR_DECIMAL_PLACES)) {
35
+ return Number(displayValue.toPrecision(4)).toString();
36
+ }
37
+ var decimalPlaces = Math.min(Math.max(precision !== null && precision !== void 0 ? precision : MAX_CROSSHAIR_DECIMAL_PLACES, 0), MAX_CROSSHAIR_DECIMAL_PLACES);
38
+ return Number(displayValue.toFixed(decimalPlaces)).toString();
28
39
  }
29
- return String(value);
40
+ return String(displayValue);
30
41
  };
31
42
  var getNumberPrecision = function getNumberPrecision(value) {
32
43
  var _coefficient$split$;
33
44
  if (!Number.isFinite(value) || value === 0) return 0;
34
- var _Math$abs$toExponenti = Math.abs(value).toExponential().split('e'),
45
+ var normalizedValue = Number(value.toPrecision(12));
46
+ var _Math$abs$toExponenti = Math.abs(normalizedValue).toExponential().split('e'),
35
47
  _Math$abs$toExponenti2 = _slicedToArray(_Math$abs$toExponenti, 2),
36
48
  coefficient = _Math$abs$toExponenti2[0],
37
49
  _Math$abs$toExponenti3 = _Math$abs$toExponenti2[1],
@@ -51,7 +63,7 @@ var getCrosshairScalePrecision = function getCrosshairScalePrecision(scale) {
51
63
  if (Number.isFinite(difference) && difference > 0) interval = Math.min(interval, difference);
52
64
  }
53
65
  if (!Number.isFinite(interval)) return undefined;
54
- return Math.min(getNumberPrecision(interval) + 2, 20);
66
+ return Math.min(getNumberPrecision(interval) + 2, MAX_CROSSHAIR_DECIMAL_PLACES);
55
67
  };
56
68
  var getCrosshairTagStyle = function getCrosshairTagStyle(theme, tokens) {
57
69
  return {
@@ -75,9 +87,44 @@ var getCrosshairTagStyle = function getCrosshairTagStyle(theme, tokens) {
75
87
  tagPointerEvents: 'none'
76
88
  };
77
89
  };
90
+ var getStandaloneTagStyle = function getStandaloneTagStyle(theme, tokens) {
91
+ return {
92
+ align: 'start',
93
+ verticalAlign: 'middle',
94
+ padding: [4, 7],
95
+ radius: 6,
96
+ backgroundFill: tokens.textPrimary,
97
+ backgroundStroke: 'transparent',
98
+ backgroundLineWidth: 0,
99
+ backgroundShadowColor: theme === 'dark' ? 'rgba(0, 0, 0, 0.38)' : 'rgba(15, 23, 42, 0.18)',
100
+ backgroundShadowBlur: 8,
101
+ backgroundShadowOffsetY: 2,
102
+ labelFill: tokens.background,
103
+ labelFillOpacity: 1,
104
+ labelFontFamily: CHART_FONT_FAMILY,
105
+ labelFontSize: 11,
106
+ labelFontWeight: 500,
107
+ labelLineWidth: 0,
108
+ pointerEvents: 'none'
109
+ };
110
+ };
78
111
  var clamp = function clamp(value, min, max) {
79
112
  return Math.min(Math.max(value, Math.min(min, max)), Math.max(min, max));
80
113
  };
114
+ var keepTagInCanvas = function keepTagInCanvas(tag, canvas) {
115
+ if (!tag || !canvas) return;
116
+ var _canvas$getConfig = canvas.getConfig(),
117
+ width = _canvas$getConfig.width,
118
+ height = _canvas$getConfig.height;
119
+ if (width === undefined || height === undefined) return;
120
+ var _tag$getBounds = tag.getBounds(),
121
+ min = _tag$getBounds.min,
122
+ max = _tag$getBounds.max;
123
+ var margin = CROSSHAIR_LABEL_MARGIN;
124
+ var dx = Math.max(margin - min[0], Math.min(0, width - margin - max[0]));
125
+ var dy = Math.max(margin - min[1], Math.min(0, height - margin - max[1]));
126
+ if (dx || dy) tag.translate(dx, dy);
127
+ };
81
128
  var invertCrosshairValue = function invertCrosshairValue(scale, value) {
82
129
  if (!scale || typeof scale.invert !== 'function' || value === undefined) return undefined;
83
130
  if (typeof scale.getBandWidth === 'function') {
@@ -124,14 +171,50 @@ var getTooltipPlot = function getTooltipPlot(context) {
124
171
  // detail isolated here while using the public plot selector for discovery.
125
172
  return selectPlotArea(root);
126
173
  };
127
- var getCartesianView = function getCartesianView(context) {
174
+ var getScaleField = function getScaleField(scale) {
175
+ var _scale$getOptions2;
176
+ return scale === null || scale === void 0 || (_scale$getOptions2 = scale.getOptions) === null || _scale$getOptions2 === void 0 || (_scale$getOptions2 = _scale$getOptions2.call(scale)) === null || _scale$getOptions2 === void 0 ? void 0 : _scale$getOptions2.field;
177
+ };
178
+ var findYScaleByField = function findYScaleByField(view, yField) {
179
+ var _Object$entries$find;
180
+ return (_Object$entries$find = Object.entries(view.scale).find(function (_ref) {
181
+ var _ref2 = _slicedToArray(_ref, 2),
182
+ scaleName = _ref2[0],
183
+ scale = _ref2[1];
184
+ return /^y\d*$/.test(scaleName) && getScaleField(scale) === yField;
185
+ })) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[1];
186
+ };
187
+ var getYScale = function getYScale(view, yField) {
188
+ return yField ? findYScaleByField(view, yField) : view.scale.y;
189
+ };
190
+ var getCartesianView = function getCartesianView(context, yField) {
128
191
  var _context$views;
129
- return (_context$views = context.views) === null || _context$views === void 0 ? void 0 : _context$views.find(function (_ref) {
130
- var coordinate = _ref.coordinate,
131
- scale = _ref.scale;
132
- return Boolean((scale === null || scale === void 0 ? void 0 : scale.x) && (scale === null || scale === void 0 ? void 0 : scale.y)) && typeof (coordinate === null || coordinate === void 0 ? void 0 : coordinate.invert) === 'function';
192
+ return (_context$views = context.views) === null || _context$views === void 0 ? void 0 : _context$views.find(function (view) {
193
+ var _view$scale, _view$coordinate;
194
+ return Boolean(((_view$scale = view.scale) === null || _view$scale === void 0 ? void 0 : _view$scale.x) && getYScale(view, yField)) && typeof ((_view$coordinate = view.coordinate) === null || _view$coordinate === void 0 ? void 0 : _view$coordinate.invert) === 'function';
133
195
  });
134
196
  };
197
+ var hasAxisField = function hasAxisField(field, yField) {
198
+ return Array.isArray(field) ? field.includes(yField) : field === yField;
199
+ };
200
+ var getYAxisLinePosition = function getYAxisLinePosition(view, yField, position, fallback, plotX) {
201
+ var _view$components;
202
+ if (!yField) return fallback;
203
+ var axis = (_view$components = view.components) === null || _view$components === void 0 ? void 0 : _view$components.find(function (_ref3) {
204
+ var bbox = _ref3.bbox,
205
+ axisPosition = _ref3.position,
206
+ scales = _ref3.scales,
207
+ type = _ref3.type;
208
+ return type === 'axisY' && axisPosition === position && Number.isFinite(Number(bbox === null || bbox === void 0 ? void 0 : bbox.x)) && (scales === null || scales === void 0 ? void 0 : scales.some(function (scale) {
209
+ return hasAxisField(scale.field, yField);
210
+ }));
211
+ });
212
+ if (!(axis !== null && axis !== void 0 && axis.bbox)) return fallback;
213
+ var x = Number(axis.bbox.x);
214
+ var width = Number(axis.bbox.width);
215
+ var axisX = position === 'right' || !Number.isFinite(width) ? x : x + width;
216
+ return axisX - plotX;
217
+ };
135
218
  var getRuleLine = function getRuleLine(rule) {
136
219
  var _rule$style, _rule$style2, _rule$style3, _rule$style4;
137
220
  var x1 = Number(rule === null || rule === void 0 || (_rule$style = rule.style) === null || _rule$style === void 0 ? void 0 : _rule$style.x1);
@@ -148,12 +231,12 @@ var getRuleLine = function getRuleLine(rule) {
148
231
  };
149
232
  var getPlotOffset = function getPlotOffset(plot) {
150
233
  var _plot$getLocalPositio;
151
- var _ref2 = ((_plot$getLocalPositio = plot.getLocalPosition) === null || _plot$getLocalPositio === void 0 ? void 0 : _plot$getLocalPositio.call(plot)) || [],
152
- _ref3 = _slicedToArray(_ref2, 2),
153
- _ref3$ = _ref3[0],
154
- x = _ref3$ === void 0 ? 0 : _ref3$,
155
- _ref3$2 = _ref3[1],
156
- y = _ref3$2 === void 0 ? 0 : _ref3$2;
234
+ var _ref4 = ((_plot$getLocalPositio = plot.getLocalPosition) === null || _plot$getLocalPositio === void 0 ? void 0 : _plot$getLocalPositio.call(plot)) || [],
235
+ _ref5 = _slicedToArray(_ref4, 2),
236
+ _ref5$ = _ref5[0],
237
+ x = _ref5$ === void 0 ? 0 : _ref5$,
238
+ _ref5$2 = _ref5[1],
239
+ y = _ref5$2 === void 0 ? 0 : _ref5$2;
157
240
  return [Number.isFinite(Number(x)) ? Number(x) : 0, Number.isFinite(Number(y)) ? Number(y) : 0];
158
241
  };
159
242
  var invertCoordinate = function invertCoordinate(view, point) {
@@ -175,25 +258,37 @@ var invertCoordinate = function invertCoordinate(view, point) {
175
258
  * reads the rule geometry created by G2 5.4 and renders labels with LineCrosshair.
176
259
  */
177
260
  export var bindCrosshairAxisLabels = function bindCrosshairAxisLabels(chart, theme) {
261
+ var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
262
+ _ref6$showXLabel = _ref6.showXLabel,
263
+ showXLabel = _ref6$showXLabel === void 0 ? true : _ref6$showXLabel,
264
+ _ref6$useStandaloneYL = _ref6.useStandaloneYLabel,
265
+ useStandaloneYLabel = _ref6$useStandaloneYL === void 0 ? false : _ref6$useStandaloneYL,
266
+ _ref6$yAxisPosition = _ref6.yAxisPosition,
267
+ yAxisPosition = _ref6$yAxisPosition === void 0 ? 'left' : _ref6$yAxisPosition,
268
+ yField = _ref6.yField;
178
269
  if (!chart || typeof chart.on !== 'function') return function () {
179
270
  return undefined;
180
271
  };
181
272
  var tagStyle = getCrosshairTagStyle(theme, getChartVisualTokens(theme));
273
+ var standaloneTagStyle = getStandaloneTagStyle(theme, getChartVisualTokens(theme));
182
274
  var boundPlot = null;
183
275
  var xCrosshair = null;
184
276
  var yCrosshair = null;
277
+ var standaloneYTag = null;
185
278
  var latestPointerY = null;
186
279
  var latestXValue;
187
280
  var destroyCrosshairs = function destroyCrosshairs() {
188
- var _xCrosshair, _yCrosshair;
281
+ var _xCrosshair, _yCrosshair, _standaloneYTag;
189
282
  (_xCrosshair = xCrosshair) === null || _xCrosshair === void 0 || _xCrosshair.destroy();
190
283
  (_yCrosshair = yCrosshair) === null || _yCrosshair === void 0 || _yCrosshair.destroy();
284
+ (_standaloneYTag = standaloneYTag) === null || _standaloneYTag === void 0 || _standaloneYTag.destroy();
191
285
  xCrosshair = null;
192
286
  yCrosshair = null;
287
+ standaloneYTag = null;
193
288
  boundPlot = null;
194
289
  };
195
290
  var hideCrosshairs = function hideCrosshairs() {
196
- for (var _i = 0, _arr = [xCrosshair, yCrosshair]; _i < _arr.length; _i++) {
291
+ for (var _i = 0, _arr = [xCrosshair, yCrosshair, standaloneYTag]; _i < _arr.length; _i++) {
197
292
  var crosshair = _arr[_i];
198
293
  if (crosshair) crosshair.style.visibility = 'hidden';
199
294
  }
@@ -215,7 +310,7 @@ export var bindCrosshairAxisLabels = function bindCrosshairAxisLabels(chart, the
215
310
  var xEnd = [xLine.x2 + plotX, xLine.y2 + plotY];
216
311
  var yStart = [yLine.x1 + plotX, yLine.y1 + plotY];
217
312
  var yEnd = [yLine.x2 + plotX, yLine.y2 + plotY];
218
- if (!xCrosshair) {
313
+ if (showXLabel && !xCrosshair) {
219
314
  xCrosshair = new LineCrosshair({
220
315
  style: _objectSpread(_objectSpread({}, tagStyle), {}, {
221
316
  startPos: xStart,
@@ -228,30 +323,41 @@ export var bindCrosshairAxisLabels = function bindCrosshairAxisLabels(chart, the
228
323
  xCrosshair.style.pointerEvents = 'none';
229
324
  layer.appendChild(xCrosshair);
230
325
  }
231
- if (!yCrosshair) {
326
+ if (showXLabel && !useStandaloneYLabel && !yCrosshair) {
232
327
  yCrosshair = new LineCrosshair({
233
328
  style: _objectSpread(_objectSpread({}, tagStyle), {}, {
234
329
  startPos: yStart,
235
330
  endPos: yEnd,
236
331
  tagText: yText,
237
- tagPosition: 'start'
332
+ tagPosition: yAxisPosition === 'right' ? 'end' : 'start'
238
333
  })
239
334
  });
240
335
  yCrosshair.style.zIndex = 7;
241
336
  yCrosshair.style.pointerEvents = 'none';
242
337
  layer.appendChild(yCrosshair);
243
338
  }
339
+ if ((useStandaloneYLabel || !showXLabel) && !standaloneYTag) {
340
+ standaloneYTag = new Tag({
341
+ style: _objectSpread(_objectSpread({}, standaloneTagStyle), {}, {
342
+ text: yText
343
+ })
344
+ });
345
+ standaloneYTag.style.zIndex = 7;
346
+ standaloneYTag.style.pointerEvents = 'none';
347
+ layer.appendChild(standaloneYTag);
348
+ }
244
349
  boundPlot = plot;
245
350
  };
246
351
  var updateCrosshairs = function updateCrosshairs(event) {
247
- var _event$offsetY, _latestXValue, _invertCrosshairValue, _event$data, _view$scale$x$getForm, _view$scale$x, _view$scale$y$getForm, _view$scale$y, _plot$ruleY, _plot$ruleX;
352
+ var _event$offsetY, _latestXValue, _invertCrosshairValue, _event$data, _view$scale$x$getForm, _view$scale$x, _yScale$getFormatter, _plot$ruleY, _plot$ruleX;
248
353
  var context = chart.getContext();
249
354
  var plot = getTooltipPlot(context);
250
- var view = getCartesianView(context);
355
+ var view = getCartesianView(context, yField);
251
356
  if (!plot || !view) {
252
357
  hideCrosshairs();
253
358
  return;
254
359
  }
360
+ var yScale = getYScale(view, yField);
255
361
  var verticalRule = getRuleLine(plot.ruleY);
256
362
  var horizontalRule = getRuleLine(plot.ruleX);
257
363
  if (!verticalRule || !horizontalRule) {
@@ -269,9 +375,9 @@ export var bindCrosshairAxisLabels = function bindCrosshairAxisLabels(chart, the
269
375
  var y = clamp(pointerY, verticalRule.y1, verticalRule.y2);
270
376
  var invertedPosition = invertCoordinate(view, [x, y]);
271
377
  var xValue = (_latestXValue = latestXValue) !== null && _latestXValue !== void 0 ? _latestXValue : invertCrosshairValue(view.scale.x, invertedPosition === null || invertedPosition === void 0 ? void 0 : invertedPosition[0]);
272
- var yValue = (_invertCrosshairValue = invertCrosshairValue(view.scale.y, invertedPosition === null || invertedPosition === void 0 ? void 0 : invertedPosition[1])) !== null && _invertCrosshairValue !== void 0 ? _invertCrosshairValue : (_event$data = event.data) === null || _event$data === void 0 || (_event$data = _event$data.items) === null || _event$data === void 0 || (_event$data = _event$data[0]) === null || _event$data === void 0 ? void 0 : _event$data.value;
378
+ var yValue = (_invertCrosshairValue = invertCrosshairValue(yScale, invertedPosition === null || invertedPosition === void 0 ? void 0 : invertedPosition[1])) !== null && _invertCrosshairValue !== void 0 ? _invertCrosshairValue : (_event$data = event.data) === null || _event$data === void 0 || (_event$data = _event$data.items) === null || _event$data === void 0 || (_event$data = _event$data[0]) === null || _event$data === void 0 ? void 0 : _event$data.value;
273
379
  var xText = formatCrosshairAxisValue(xValue, (_view$scale$x$getForm = (_view$scale$x = view.scale.x).getFormatter) === null || _view$scale$x$getForm === void 0 ? void 0 : _view$scale$x$getForm.call(_view$scale$x));
274
- var yText = formatCrosshairAxisValue(yValue, (_view$scale$y$getForm = (_view$scale$y = view.scale.y).getFormatter) === null || _view$scale$y$getForm === void 0 ? void 0 : _view$scale$y$getForm.call(_view$scale$y), getCrosshairScalePrecision(view.scale.y));
380
+ var yText = formatCrosshairAxisValue(yValue, yScale === null || yScale === void 0 || (_yScale$getFormatter = yScale.getFormatter) === null || _yScale$getFormatter === void 0 ? void 0 : _yScale$getFormatter.call(yScale), getCrosshairScalePrecision(yScale));
275
381
  if (!xText || !yText) {
276
382
  hideCrosshairs();
277
383
  return;
@@ -293,13 +399,28 @@ export var bindCrosshairAxisLabels = function bindCrosshairAxisLabels(chart, the
293
399
  y2: y
294
400
  });
295
401
  ensureCrosshairs(plot, displayVerticalRule, displayHorizontalRule, xText, yText);
296
- if (!xCrosshair || !yCrosshair) return;
297
- xCrosshair.setText(xText);
298
- xCrosshair.setPointer([x + plotX, verticalRule.y2 + plotY]);
299
- xCrosshair.style.visibility = 'visible';
300
- yCrosshair.setText(yText);
301
- yCrosshair.setPointer([horizontalRule.x1 + plotX, y + plotY]);
302
- yCrosshair.style.visibility = 'visible';
402
+ if (showXLabel && !xCrosshair || (useStandaloneYLabel ? !standaloneYTag : !yCrosshair && !standaloneYTag)) return;
403
+ if (xCrosshair) {
404
+ xCrosshair.setText(xText);
405
+ xCrosshair.setPointer([x + plotX, verticalRule.y2 + plotY]);
406
+ xCrosshair.style.visibility = 'visible';
407
+ keepTagInCanvas(xCrosshair.querySelector('.crosshair-tag'), context.canvas);
408
+ }
409
+ if (yCrosshair) {
410
+ yCrosshair.setText(yText);
411
+ yCrosshair.setPointer([(yAxisPosition === 'right' ? horizontalRule.x2 : horizontalRule.x1) + plotX, y + plotY]);
412
+ yCrosshair.style.visibility = 'visible';
413
+ keepTagInCanvas(yCrosshair.querySelector('.crosshair-tag'), context.canvas);
414
+ }
415
+ if (standaloneYTag) {
416
+ var yAxisX = getYAxisLinePosition(view, yField, yAxisPosition, yAxisPosition === 'right' ? horizontalRule.x2 : horizontalRule.x1, plotX);
417
+ standaloneYTag.update({
418
+ text: yText
419
+ });
420
+ standaloneYTag.setLocalPosition([yAxisX + plotX, y + plotY]);
421
+ standaloneYTag.style.visibility = 'visible';
422
+ keepTagInCanvas(standaloneYTag, context.canvas);
423
+ }
303
424
  };
304
425
  var onPointerMove = function onPointerMove(event) {
305
426
  var _event$offsetY2;
@@ -0,0 +1 @@
1
+ export declare const escapeHtml: (value: unknown) => string;
@@ -0,0 +1,3 @@
1
+ export var escapeHtml = function escapeHtml(value) {
2
+ return (value == null ? '' : String(value)).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
3
+ };
@@ -2,5 +2,3 @@ export * from './animation';
2
2
  export * from './components';
3
3
  export * from './crosshair-axis-labels';
4
4
  export * from './interaction';
5
- export * from './theme';
6
- export * from './tokens';
@@ -1,6 +1,4 @@
1
1
  export * from "./animation";
2
2
  export * from "./components";
3
3
  export * from "./crosshair-axis-labels";
4
- export * from "./interaction";
5
- export * from "./theme";
6
- export * from "./tokens";
4
+ export * from "./interaction";
@@ -1,4 +1,3 @@
1
- import type { VisualizationTheme } from '../types';
2
1
  export type SharedTooltipInteractionOptions = {
3
2
  crosshairs?: boolean;
4
3
  };
@@ -7,8 +6,10 @@ export type PointHighlightStateOptions = {
7
6
  inactiveOpacity?: number;
8
7
  };
9
8
  export declare const getSharedTooltipInteraction: ({ crosshairs, }?: SharedTooltipInteractionOptions) => Record<string, boolean>;
10
- export declare const getCategoryBackgroundHighlightState: (theme: VisualizationTheme) => Record<string, any>;
9
+ export declare const getCategoryBackgroundHighlightState: (theme: string) => Record<string, any>;
11
10
  export declare const getCategoryHighlightInteraction: () => Record<string, any>;
12
11
  export declare const getPointHighlightState: ({ activeLineWidth, inactiveOpacity, }?: PointHighlightStateOptions) => Record<string, any>;
13
- export declare const getSeriesHighlightByColorInteraction: () => Record<string, boolean>;
12
+ export declare const getSeriesHighlightByColorInteraction: () => Record<string, any>;
14
13
  export declare const getLineHighlightState: (lineWidth: number) => Record<string, any>;
14
+ /** Preserve GPT-Vis hover feedback independently of the visual theme. */
15
+ export declare const getElementHoverScaleInteraction: (theme: string) => Record<string, unknown>;
@@ -29,6 +29,7 @@ export var getCategoryBackgroundHighlightState = function getCategoryBackgroundH
29
29
  };
30
30
  export var getCategoryHighlightInteraction = function getCategoryHighlightInteraction() {
31
31
  return {
32
+ delay: CHART_STYLE_DEFAULTS.interactionDelay,
32
33
  background: true,
33
34
  region: true
34
35
  };
@@ -57,7 +58,9 @@ export var getPointHighlightState = function getPointHighlightState() {
57
58
  };
58
59
  export var getSeriesHighlightByColorInteraction = function getSeriesHighlightByColorInteraction() {
59
60
  return {
60
- elementHighlightByColor: true
61
+ elementHighlightByColor: {
62
+ delay: CHART_STYLE_DEFAULTS.interactionDelay
63
+ }
61
64
  };
62
65
  };
63
66
  export var getLineHighlightState = function getLineHighlightState(lineWidth) {
@@ -70,4 +73,18 @@ export var getLineHighlightState = function getLineHighlightState(lineWidth) {
70
73
  strokeOpacity: CHART_STYLE_DEFAULTS.inactiveOpacity
71
74
  }
72
75
  };
76
+ };
77
+
78
+ /** Preserve GPT-Vis hover feedback independently of the visual theme. */
79
+ export var getElementHoverScaleInteraction = function getElementHoverScaleInteraction(theme) {
80
+ return {
81
+ delay: CHART_STYLE_DEFAULTS.interactionDelay,
82
+ scale: 1.04,
83
+ shadow: true,
84
+ shadowBlur: theme === 'dark' ? 7 : theme === 'academy' ? 5 : 6,
85
+ shadowColor: theme === 'dark' ? 'rgba(226, 232, 240, 0.38)' : theme === 'academy' ? 'rgba(63, 49, 38, 0.44)' : 'rgba(15, 23, 42, 0.46)',
86
+ shadowOffsetX: 0,
87
+ shadowOffsetY: theme === 'dark' ? 0 : 3,
88
+ zIndex: 10
89
+ };
73
90
  };
@@ -1,4 +1,3 @@
1
- import type { VisualizationTheme } from '../types';
2
1
  export declare const CHART_FONT_FAMILY = "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif";
3
2
  export declare const CHART_STYLE_DEFAULTS: {
4
3
  readonly animationDuration: 260;
@@ -13,9 +12,10 @@ export declare const CHART_STYLE_DEFAULTS: {
13
12
  readonly pointActiveLineWidth: 5;
14
13
  readonly intervalWidthRatio: 0.64;
15
14
  };
16
- export type ChartVisualTokens = {
15
+ type BuiltInThemeValues = {
17
16
  background: string;
18
17
  textPrimary: string;
18
+ textInverse: string;
19
19
  textSecondary: string;
20
20
  grid: string;
21
21
  axisGrid: string;
@@ -28,4 +28,5 @@ export type ChartVisualTokens = {
28
28
  tooltipMarkerShadow: string;
29
29
  tooltipShadow: string;
30
30
  };
31
- export declare const getChartVisualTokens: (theme: VisualizationTheme) => ChartVisualTokens;
31
+ export declare const getChartVisualTokens: (theme: string) => BuiltInThemeValues;
32
+ export {};
@@ -12,13 +12,14 @@ export var CHART_STYLE_DEFAULTS = {
12
12
  pointActiveLineWidth: 5,
13
13
  intervalWidthRatio: 0.64
14
14
  };
15
- var LIGHT_TOKENS = {
15
+ var LIGHT_THEME_VALUES = {
16
16
  background: '#FFFFFF',
17
17
  textPrimary: '#1F2937',
18
+ textInverse: '#FFFFFF',
18
19
  textSecondary: '#667085',
19
20
  grid: '#E7EAF0',
20
- axisGrid: '#EAECF0',
21
- axisLine: '#D0D5DD',
21
+ axisGrid: '#D0D5DD',
22
+ axisLine: '#98A2B3',
22
23
  axisTick: '#98A2B3',
23
24
  separator: '#FFFFFF',
24
25
  tooltipBackground: 'rgba(255, 255, 255, 0.96)',
@@ -27,13 +28,14 @@ var LIGHT_TOKENS = {
27
28
  tooltipMarkerShadow: '0 0 0 2px #FFFFFF, 0 1px 3px rgba(15, 23, 42, 0.20)',
28
29
  tooltipShadow: '0 12px 32px rgba(15, 23, 42, 0.12), 0 3px 8px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.82)'
29
30
  };
30
- var DARK_TOKENS = {
31
+ var DARK_THEME_VALUES = {
31
32
  background: '#141414',
32
33
  textPrimary: '#F3F4F6',
34
+ textInverse: '#111827',
33
35
  textSecondary: '#A7AFBE',
34
36
  grid: '#343841',
35
- axisGrid: '#2B2F36',
36
- axisLine: '#454B56',
37
+ axisGrid: '#475467',
38
+ axisLine: '#667085',
37
39
  axisTick: '#596170',
38
40
  separator: '#141414',
39
41
  tooltipBackground: 'rgba(26, 27, 31, 0.96)',
@@ -42,9 +44,10 @@ var DARK_TOKENS = {
42
44
  tooltipMarkerShadow: '0 0 0 2px #1A1B1F, 0 1px 3px rgba(0, 0, 0, 0.42)',
43
45
  tooltipShadow: '0 14px 36px rgba(0, 0, 0, 0.34), 0 3px 10px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08)'
44
46
  };
45
- var ACADEMY_TOKENS = {
47
+ var ACADEMY_THEME_VALUES = {
46
48
  background: '#FFFFFF',
47
49
  textPrimary: '#23262D',
50
+ textInverse: '#FFFFFF',
48
51
  textSecondary: '#626975',
49
52
  grid: '#DDDDDD',
50
53
  axisGrid: '#DDDDDD',
@@ -58,7 +61,7 @@ var ACADEMY_TOKENS = {
58
61
  tooltipShadow: '0 12px 30px rgba(63, 49, 38, 0.11), 0 3px 8px rgba(63, 49, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.88)'
59
62
  };
60
63
  export var getChartVisualTokens = function getChartVisualTokens(theme) {
61
- if (theme === 'dark') return DARK_TOKENS;
62
- if (theme === 'academy') return ACADEMY_TOKENS;
63
- return LIGHT_TOKENS;
64
+ if (theme === 'dark') return DARK_THEME_VALUES;
65
+ if (theme === 'academy') return ACADEMY_THEME_VALUES;
66
+ return LIGHT_THEME_VALUES;
64
67
  };
@@ -1,4 +1,4 @@
1
- import type { VisualizationOptions, VisualizationTheme } from '../../types';
1
+ import type { ThemeStyle, VisualizationOptions, VisualizationTheme } from '../../types';
2
2
  /**
3
3
  * AreaDataItem is the type for each data item in the area chart.
4
4
  */
@@ -15,14 +15,11 @@ export interface AreaConfig {
15
15
  data: AreaDataItem[];
16
16
  stack?: boolean;
17
17
  title?: string;
18
+ subtitle?: string;
18
19
  axisXTitle?: string;
19
20
  axisYTitle?: string;
20
21
  theme?: VisualizationTheme;
21
- style?: {
22
- backgroundColor?: string;
23
- palette?: string[];
24
- lineWidth?: number;
25
- };
22
+ style?: ThemeStyle;
26
23
  }
27
24
  /**
28
25
  * AreaInstance represents an area chart instance with render and destroy methods.