@antv/gpt-vis 1.3.1 → 1.4.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.
- package/README.md +261 -137
- package/README.zh-CN.md +263 -116
- package/dist/cjs/annotation/components/bottom-n.d.ts +2 -0
- package/dist/cjs/annotation/components/bottom-n.js +57 -0
- package/dist/cjs/annotation/components/centroid.d.ts +2 -0
- package/dist/cjs/annotation/components/centroid.js +75 -0
- package/dist/cjs/annotation/components/connector.d.ts +25 -0
- package/dist/cjs/annotation/components/connector.js +298 -0
- package/dist/cjs/annotation/components/contribution.d.ts +3 -0
- package/dist/cjs/annotation/components/contribution.js +136 -0
- package/dist/cjs/annotation/components/crossing.d.ts +3 -0
- package/dist/cjs/annotation/components/crossing.js +504 -0
- package/dist/cjs/annotation/components/event.d.ts +2 -0
- package/dist/cjs/annotation/components/event.js +62 -0
- package/dist/cjs/annotation/components/first.d.ts +2 -0
- package/dist/cjs/annotation/components/first.js +42 -0
- package/dist/cjs/annotation/components/group.d.ts +3 -0
- package/dist/cjs/annotation/components/group.js +73 -0
- package/dist/cjs/annotation/components/highlight.d.ts +14 -0
- package/dist/cjs/annotation/components/highlight.js +552 -0
- package/dist/cjs/annotation/components/index.d.ts +34 -0
- package/dist/cjs/annotation/components/index.js +128 -0
- package/dist/cjs/annotation/components/last.d.ts +2 -0
- package/dist/cjs/annotation/components/last.js +42 -0
- package/dist/cjs/annotation/components/max-x.d.ts +2 -0
- package/dist/cjs/annotation/components/max-x.js +41 -0
- package/dist/cjs/annotation/components/max-y.d.ts +2 -0
- package/dist/cjs/annotation/components/max-y.js +41 -0
- package/dist/cjs/annotation/components/mean.d.ts +2 -0
- package/dist/cjs/annotation/components/mean.js +50 -0
- package/dist/cjs/annotation/components/median.d.ts +2 -0
- package/dist/cjs/annotation/components/median.js +49 -0
- package/dist/cjs/annotation/components/min-x.d.ts +2 -0
- package/dist/cjs/annotation/components/min-x.js +41 -0
- package/dist/cjs/annotation/components/min-y.d.ts +2 -0
- package/dist/cjs/annotation/components/min-y.js +41 -0
- package/dist/cjs/annotation/components/outlier.d.ts +3 -0
- package/dist/cjs/annotation/components/outlier.js +83 -0
- package/dist/cjs/annotation/components/path.d.ts +20 -0
- package/dist/cjs/annotation/components/path.js +147 -0
- package/dist/cjs/annotation/components/peak.d.ts +2 -0
- package/dist/cjs/annotation/components/peak.js +42 -0
- package/dist/cjs/annotation/components/point.d.ts +26 -0
- package/dist/cjs/annotation/components/point.js +241 -0
- package/dist/cjs/annotation/components/quadrant.d.ts +3 -0
- package/dist/cjs/annotation/components/quadrant.js +97 -0
- package/dist/cjs/annotation/components/quantile.d.ts +2 -0
- package/dist/cjs/annotation/components/quantile.js +49 -0
- package/dist/cjs/annotation/components/range-inside.d.ts +2 -0
- package/dist/cjs/annotation/components/range-inside.js +65 -0
- package/dist/cjs/annotation/components/range-outside.d.ts +2 -0
- package/dist/cjs/annotation/components/range-outside.js +65 -0
- package/dist/cjs/annotation/components/range-x.d.ts +2 -0
- package/dist/cjs/annotation/components/range-x.js +39 -0
- package/dist/cjs/annotation/components/range-y.d.ts +2 -0
- package/dist/cjs/annotation/components/range-y.js +39 -0
- package/dist/cjs/annotation/components/range.d.ts +15 -0
- package/dist/cjs/annotation/components/range.js +87 -0
- package/dist/cjs/annotation/components/target.d.ts +2 -0
- package/dist/cjs/annotation/components/target.js +51 -0
- package/dist/cjs/annotation/components/text.d.ts +15 -0
- package/dist/cjs/annotation/components/text.js +74 -0
- package/dist/cjs/annotation/components/threshold-highlight.d.ts +3 -0
- package/dist/cjs/annotation/components/threshold-highlight.js +223 -0
- package/dist/cjs/annotation/components/threshold-x.d.ts +2 -0
- package/dist/cjs/annotation/components/threshold-x.js +39 -0
- package/dist/cjs/annotation/components/threshold-y.d.ts +2 -0
- package/dist/cjs/annotation/components/threshold-y.js +40 -0
- package/dist/cjs/annotation/components/top-n.d.ts +2 -0
- package/dist/cjs/annotation/components/top-n.js +57 -0
- package/dist/cjs/annotation/components/valley.d.ts +2 -0
- package/dist/cjs/annotation/components/valley.js +42 -0
- package/dist/cjs/annotation/index.d.ts +1 -0
- package/dist/cjs/annotation/index.js +29 -0
- package/dist/cjs/annotation/label.d.ts +38 -0
- package/dist/cjs/annotation/label.js +347 -0
- package/dist/cjs/annotation/layout.d.ts +12 -0
- package/dist/cjs/annotation/layout.js +142 -0
- package/dist/cjs/annotation/merge.d.ts +19 -0
- package/dist/cjs/annotation/merge.js +60 -0
- package/dist/cjs/annotation/registry.d.ts +190 -0
- package/dist/cjs/annotation/registry.js +134 -0
- package/dist/cjs/annotation/runtime/g2.d.ts +90 -0
- package/dist/cjs/annotation/runtime/g2.js +521 -0
- package/dist/cjs/annotation/runtime/g6.d.ts +40 -0
- package/dist/cjs/annotation/runtime/g6.js +310 -0
- package/dist/cjs/annotation/runtime/index.d.ts +11 -0
- package/dist/cjs/annotation/runtime/index.js +41 -0
- package/dist/cjs/annotation/runtime/summary.d.ts +17 -0
- package/dist/cjs/annotation/runtime/summary.js +39 -0
- package/dist/cjs/annotation/runtime/table.d.ts +16 -0
- package/dist/cjs/annotation/runtime/table.js +39 -0
- package/dist/cjs/annotation/utils.d.ts +40 -0
- package/dist/cjs/annotation/utils.js +275 -0
- package/dist/cjs/theme/annotation.d.ts +236 -0
- package/dist/cjs/theme/annotation.js +167 -0
- package/dist/cjs/theme/g2.js +13 -15
- package/dist/cjs/theme/g6.js +2 -2
- package/dist/cjs/theme/summary.js +2 -2
- package/dist/cjs/types/annotation.d.ts +310 -0
- package/dist/cjs/types/annotation.js +17 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/util/axis.d.ts +28 -0
- package/dist/cjs/util/axis.js +184 -0
- package/dist/cjs/util/components.d.ts +0 -10
- package/dist/cjs/util/components.js +9 -64
- package/dist/cjs/util/index.d.ts +7 -4
- package/dist/cjs/util/index.js +53 -9
- package/dist/cjs/vis/area/index.d.ts +2 -0
- package/dist/cjs/vis/area/index.js +30 -13
- package/dist/cjs/vis/bar/index.d.ts +2 -0
- package/dist/cjs/vis/bar/index.js +37 -7
- package/dist/cjs/vis/boxplot/index.js +14 -3
- package/dist/cjs/vis/column/index.d.ts +2 -0
- package/dist/cjs/vis/column/index.js +28 -9
- package/dist/cjs/vis/dual-axes/index.js +9 -9
- package/dist/cjs/vis/fishbone-diagram/index.js +2 -2
- package/dist/cjs/vis/flow-diagram/index.js +2 -2
- package/dist/cjs/vis/funnel/index.js +10 -13
- package/dist/cjs/vis/histogram/index.js +2 -2
- package/dist/cjs/vis/indented-tree/index.js +2 -2
- package/dist/cjs/vis/line/index.d.ts +2 -0
- package/dist/cjs/vis/line/index.js +26 -10
- package/dist/cjs/vis/liquid/index.js +2 -2
- package/dist/cjs/vis/mindmap/index.js +2 -2
- package/dist/cjs/vis/network-graph/index.d.ts +2 -0
- package/dist/cjs/vis/network-graph/index.js +24 -3
- package/dist/cjs/vis/organization-chart/index.js +2 -2
- package/dist/cjs/vis/pie/index.d.ts +2 -0
- package/dist/cjs/vis/pie/index.js +21 -10
- package/dist/cjs/vis/radar/index.js +4 -6
- package/dist/cjs/vis/sankey/index.js +14 -1
- package/dist/cjs/vis/scatter/index.d.ts +10 -3
- package/dist/cjs/vis/scatter/index.js +18 -7
- package/dist/cjs/vis/summary/index.d.ts +9 -2
- package/dist/cjs/vis/summary/index.js +25 -8
- package/dist/cjs/vis/table/index.d.ts +2 -0
- package/dist/cjs/vis/table/index.js +48 -30
- package/dist/cjs/vis/venn/index.js +2 -2
- package/dist/cjs/vis/violin/index.js +14 -3
- package/dist/cjs/vis/waterfall/index.js +17 -9
- package/dist/cjs/vis/word-cloud/index.js +4 -6
- package/dist/cjs/vis-wrapper/index.js +2 -1
- package/dist/esm/annotation/components/bottom-n.d.ts +2 -0
- package/dist/esm/annotation/components/bottom-n.js +42 -0
- package/dist/esm/annotation/components/centroid.d.ts +2 -0
- package/dist/esm/annotation/components/centroid.js +73 -0
- package/dist/esm/annotation/components/connector.d.ts +25 -0
- package/dist/esm/annotation/components/connector.js +332 -0
- package/dist/esm/annotation/components/contribution.d.ts +3 -0
- package/dist/esm/annotation/components/contribution.js +174 -0
- package/dist/esm/annotation/components/crossing.d.ts +3 -0
- package/dist/esm/annotation/components/crossing.js +665 -0
- package/dist/esm/annotation/components/event.d.ts +2 -0
- package/dist/esm/annotation/components/event.js +46 -0
- package/dist/esm/annotation/components/first.d.ts +2 -0
- package/dist/esm/annotation/components/first.js +18 -0
- package/dist/esm/annotation/components/group.d.ts +3 -0
- package/dist/esm/annotation/components/group.js +64 -0
- package/dist/esm/annotation/components/highlight.d.ts +14 -0
- package/dist/esm/annotation/components/highlight.js +838 -0
- package/dist/esm/annotation/components/index.d.ts +34 -0
- package/dist/esm/annotation/components/index.js +34 -0
- package/dist/esm/annotation/components/last.d.ts +2 -0
- package/dist/esm/annotation/components/last.js +18 -0
- package/dist/esm/annotation/components/max-x.d.ts +2 -0
- package/dist/esm/annotation/components/max-x.js +17 -0
- package/dist/esm/annotation/components/max-y.d.ts +2 -0
- package/dist/esm/annotation/components/max-y.js +17 -0
- package/dist/esm/annotation/components/mean.d.ts +2 -0
- package/dist/esm/annotation/components/mean.js +40 -0
- package/dist/esm/annotation/components/median.d.ts +2 -0
- package/dist/esm/annotation/components/median.js +32 -0
- package/dist/esm/annotation/components/min-x.d.ts +2 -0
- package/dist/esm/annotation/components/min-x.js +17 -0
- package/dist/esm/annotation/components/min-y.d.ts +2 -0
- package/dist/esm/annotation/components/min-y.js +17 -0
- package/dist/esm/annotation/components/outlier.d.ts +3 -0
- package/dist/esm/annotation/components/outlier.js +98 -0
- package/dist/esm/annotation/components/path.d.ts +20 -0
- package/dist/esm/annotation/components/path.js +165 -0
- package/dist/esm/annotation/components/peak.d.ts +2 -0
- package/dist/esm/annotation/components/peak.js +20 -0
- package/dist/esm/annotation/components/point.d.ts +26 -0
- package/dist/esm/annotation/components/point.js +277 -0
- package/dist/esm/annotation/components/quadrant.d.ts +3 -0
- package/dist/esm/annotation/components/quadrant.js +83 -0
- package/dist/esm/annotation/components/quantile.d.ts +2 -0
- package/dist/esm/annotation/components/quantile.js +32 -0
- package/dist/esm/annotation/components/range-inside.d.ts +2 -0
- package/dist/esm/annotation/components/range-inside.js +55 -0
- package/dist/esm/annotation/components/range-outside.d.ts +2 -0
- package/dist/esm/annotation/components/range-outside.js +55 -0
- package/dist/esm/annotation/components/range-x.d.ts +2 -0
- package/dist/esm/annotation/components/range-x.js +15 -0
- package/dist/esm/annotation/components/range-y.d.ts +2 -0
- package/dist/esm/annotation/components/range-y.js +15 -0
- package/dist/esm/annotation/components/range.d.ts +15 -0
- package/dist/esm/annotation/components/range.js +92 -0
- package/dist/esm/annotation/components/target.d.ts +2 -0
- package/dist/esm/annotation/components/target.js +44 -0
- package/dist/esm/annotation/components/text.d.ts +15 -0
- package/dist/esm/annotation/components/text.js +78 -0
- package/dist/esm/annotation/components/threshold-highlight.d.ts +3 -0
- package/dist/esm/annotation/components/threshold-highlight.js +297 -0
- package/dist/esm/annotation/components/threshold-x.d.ts +2 -0
- package/dist/esm/annotation/components/threshold-x.js +23 -0
- package/dist/esm/annotation/components/threshold-y.d.ts +2 -0
- package/dist/esm/annotation/components/threshold-y.js +24 -0
- package/dist/esm/annotation/components/top-n.d.ts +2 -0
- package/dist/esm/annotation/components/top-n.js +42 -0
- package/dist/esm/annotation/components/valley.d.ts +2 -0
- package/dist/esm/annotation/components/valley.js +20 -0
- package/dist/esm/annotation/index.d.ts +1 -0
- package/dist/esm/annotation/index.js +1 -0
- package/dist/esm/annotation/label.d.ts +38 -0
- package/dist/esm/annotation/label.js +449 -0
- package/dist/esm/annotation/layout.d.ts +12 -0
- package/dist/esm/annotation/layout.js +182 -0
- package/dist/esm/annotation/merge.d.ts +19 -0
- package/dist/esm/annotation/merge.js +67 -0
- package/dist/esm/annotation/registry.d.ts +190 -0
- package/dist/esm/annotation/registry.js +220 -0
- package/dist/esm/annotation/runtime/g2.d.ts +90 -0
- package/dist/esm/annotation/runtime/g2.js +754 -0
- package/dist/esm/annotation/runtime/g6.d.ts +40 -0
- package/dist/esm/annotation/runtime/g6.js +447 -0
- package/dist/esm/annotation/runtime/index.d.ts +11 -0
- package/dist/esm/annotation/runtime/index.js +26 -0
- package/dist/esm/annotation/runtime/summary.d.ts +17 -0
- package/dist/esm/annotation/runtime/summary.js +21 -0
- package/dist/esm/annotation/runtime/table.d.ts +16 -0
- package/dist/esm/annotation/runtime/table.js +21 -0
- package/dist/esm/annotation/utils.d.ts +40 -0
- package/dist/esm/annotation/utils.js +370 -0
- package/dist/esm/theme/annotation.d.ts +236 -0
- package/dist/esm/theme/annotation.js +186 -0
- package/dist/esm/theme/g2.js +2 -10
- package/dist/esm/theme/g6.js +1 -1
- package/dist/esm/theme/summary.js +1 -1
- package/dist/esm/types/annotation.d.ts +310 -0
- package/dist/esm/types/annotation.js +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/util/axis.d.ts +28 -0
- package/dist/esm/util/axis.js +222 -0
- package/dist/esm/util/components.d.ts +0 -10
- package/dist/esm/util/components.js +24 -69
- package/dist/esm/util/index.d.ts +7 -4
- package/dist/esm/util/index.js +7 -4
- package/dist/esm/vis/area/index.d.ts +2 -0
- package/dist/esm/vis/area/index.js +32 -9
- package/dist/esm/vis/bar/index.d.ts +2 -0
- package/dist/esm/vis/bar/index.js +37 -6
- package/dist/esm/vis/boxplot/index.js +10 -2
- package/dist/esm/vis/column/index.d.ts +2 -0
- package/dist/esm/vis/column/index.js +33 -12
- package/dist/esm/vis/dual-axes/index.js +10 -10
- package/dist/esm/vis/fishbone-diagram/index.js +1 -1
- package/dist/esm/vis/flow-diagram/index.js +1 -1
- package/dist/esm/vis/funnel/index.js +2 -7
- package/dist/esm/vis/histogram/index.js +4 -3
- package/dist/esm/vis/indented-tree/index.js +1 -1
- package/dist/esm/vis/line/index.d.ts +2 -0
- package/dist/esm/vis/line/index.js +31 -9
- package/dist/esm/vis/liquid/index.js +1 -1
- package/dist/esm/vis/mindmap/index.js +1 -1
- package/dist/esm/vis/network-graph/index.d.ts +2 -0
- package/dist/esm/vis/network-graph/index.js +29 -2
- package/dist/esm/vis/organization-chart/index.js +1 -1
- package/dist/esm/vis/pie/index.d.ts +2 -0
- package/dist/esm/vis/pie/index.js +25 -8
- package/dist/esm/vis/radar/index.js +1 -3
- package/dist/esm/vis/sankey/index.js +15 -1
- package/dist/esm/vis/scatter/index.d.ts +10 -3
- package/dist/esm/vis/scatter/index.js +28 -5
- package/dist/esm/vis/summary/index.d.ts +9 -2
- package/dist/esm/vis/summary/index.js +31 -13
- package/dist/esm/vis/table/index.d.ts +2 -0
- package/dist/esm/vis/table/index.js +50 -33
- package/dist/esm/vis/venn/index.js +1 -1
- package/dist/esm/vis/violin/index.js +10 -2
- package/dist/esm/vis/waterfall/index.js +16 -13
- package/dist/esm/vis/word-cloud/index.js +1 -3
- package/dist/esm/vis-wrapper/index.js +2 -1
- package/dist/umd/index.min.js +1 -1
- package/package.json +2 -2
|
@@ -8,15 +8,18 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
import { Chart } from '@antv/g2';
|
|
11
|
+
import { bindAnnotations } from "../../annotation";
|
|
11
12
|
import { getThemeObject } from "../../theme/g2";
|
|
12
|
-
import { getCartesianAxis, getChartAnimation, getPointHighlightState } from "../../util";
|
|
13
|
-
import { getColorLegend } from "../../util/components";
|
|
14
|
-
import { CHART_STYLE_DEFAULTS } from "../../util/tokens";
|
|
13
|
+
import { CHART_STYLE_DEFAULTS, getCartesianAxis, getChartAnimation, getColorLegend, getPointHighlightState } from "../../util";
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* ScatterDataItem is the type for each data item in the scatter chart.
|
|
18
17
|
*/
|
|
19
18
|
|
|
19
|
+
/** Accept business fields without requiring caller interfaces to have an index signature. */
|
|
20
|
+
|
|
21
|
+
/** Distribute row alternatives so custom selector and weight fields remain available. */
|
|
22
|
+
|
|
20
23
|
/**
|
|
21
24
|
* ScatterConfig defines the configuration for rendering the scatter chart.
|
|
22
25
|
*/
|
|
@@ -57,6 +60,7 @@ export var Scatter = function Scatter(options) {
|
|
|
57
60
|
chartTheme = _options$theme === void 0 ? 'default' : _options$theme;
|
|
58
61
|
var chart = null;
|
|
59
62
|
var hasRendered = false;
|
|
63
|
+
var cleanupAnnotations;
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* Render the scatter chart with the given configuration.
|
|
@@ -76,6 +80,8 @@ export var Scatter = function Scatter(options) {
|
|
|
76
80
|
|
|
77
81
|
// Clean up previous chart if exists
|
|
78
82
|
if (chart) {
|
|
83
|
+
var _cleanupAnnotations;
|
|
84
|
+
(_cleanupAnnotations = cleanupAnnotations) === null || _cleanupAnnotations === void 0 || _cleanupAnnotations();
|
|
79
85
|
chart.destroy();
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -146,8 +152,9 @@ export var Scatter = function Scatter(options) {
|
|
|
146
152
|
scale: scaleConfig,
|
|
147
153
|
axis: getCartesianAxis({
|
|
148
154
|
axisXTitle: axisXTitle,
|
|
149
|
-
axisYTitle: axisYTitle
|
|
150
|
-
|
|
155
|
+
axisYTitle: axisYTitle,
|
|
156
|
+
xType: 'number'
|
|
157
|
+
}, rendererTheme),
|
|
151
158
|
style: _objectSpread(_objectSpread({}, pointMark), !hasGroupField ? {
|
|
152
159
|
fill: colors[0]
|
|
153
160
|
} : {}),
|
|
@@ -175,6 +182,19 @@ export var Scatter = function Scatter(options) {
|
|
|
175
182
|
theme: rendererTheme
|
|
176
183
|
};
|
|
177
184
|
chart.options(chartOptions);
|
|
185
|
+
cleanupAnnotations = bindAnnotations({
|
|
186
|
+
renderer: 'g2',
|
|
187
|
+
chartType: 'scatter',
|
|
188
|
+
chart: chart,
|
|
189
|
+
annotations: config.annotations,
|
|
190
|
+
mapping: {
|
|
191
|
+
x: 'x',
|
|
192
|
+
y: 'y',
|
|
193
|
+
series: hasGroupField ? 'group' : undefined,
|
|
194
|
+
data: data
|
|
195
|
+
},
|
|
196
|
+
themeObject: appearance
|
|
197
|
+
});
|
|
178
198
|
chart.render();
|
|
179
199
|
hasRendered = true;
|
|
180
200
|
};
|
|
@@ -183,6 +203,9 @@ export var Scatter = function Scatter(options) {
|
|
|
183
203
|
* Destroy the chart instance and clean up resources.
|
|
184
204
|
*/
|
|
185
205
|
var destroy = function destroy() {
|
|
206
|
+
var _cleanupAnnotations2;
|
|
207
|
+
(_cleanupAnnotations2 = cleanupAnnotations) === null || _cleanupAnnotations2 === void 0 || _cleanupAnnotations2();
|
|
208
|
+
cleanupAnnotations = undefined;
|
|
186
209
|
if (chart) {
|
|
187
210
|
chart.destroy();
|
|
188
211
|
chart = null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { RendererAnnotation } from '../../annotation/registry';
|
|
1
2
|
import type { VisualizationOptions } from '../../types';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* T8 syntax, or an object pairing syntax with text highlight annotations.
|
|
4
5
|
* Supports markdown-like syntax with special annotations for metrics.
|
|
5
6
|
* @example
|
|
6
7
|
* ```
|
|
@@ -8,7 +9,13 @@ import type { VisualizationOptions } from '../../types';
|
|
|
8
9
|
* Total sales reached [¥1,234,567](metric_value, origin=1234567).
|
|
9
10
|
* ```
|
|
10
11
|
*/
|
|
11
|
-
export type SummaryConfig = string
|
|
12
|
+
export type SummaryConfig = string | {
|
|
13
|
+
type?: 'summary';
|
|
14
|
+
text: string;
|
|
15
|
+
annotations?: RendererAnnotation<{
|
|
16
|
+
text: string;
|
|
17
|
+
}, 'summary', 'summary'>[];
|
|
18
|
+
};
|
|
12
19
|
/**
|
|
13
20
|
* SummaryInstance represents a summary instance with render and destroy methods.
|
|
14
21
|
*/
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Text } from '@antv/t8';
|
|
2
|
+
import { bindAnnotations } from "../../annotation";
|
|
3
|
+
import { getAnnotationDefaults } from "../../theme/annotation";
|
|
2
4
|
import { getThemeObject } from "../../theme/summary";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
7
|
+
* T8 syntax, or an object pairing syntax with text highlight annotations.
|
|
6
8
|
* Supports markdown-like syntax with special annotations for metrics.
|
|
7
9
|
* @example
|
|
8
10
|
* ```
|
|
@@ -50,16 +52,20 @@ export var Summary = function Summary(options) {
|
|
|
50
52
|
wrapper.className = 'gpt-vis-summary';
|
|
51
53
|
container.appendChild(wrapper);
|
|
52
54
|
var text = null;
|
|
55
|
+
var cleanupAnnotations;
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
|
-
* Render
|
|
58
|
+
* Render T8 syntax, optionally paired with highlight annotations.
|
|
56
59
|
* Supports an optional `theme <value>` line in the syntax to override the theme.
|
|
57
60
|
*/
|
|
58
|
-
var render = function render(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
var render = function render(config) {
|
|
62
|
+
var _cleanupAnnotations, _text;
|
|
63
|
+
var _ref = typeof config === 'string' ? {
|
|
64
|
+
text: config,
|
|
65
|
+
annotations: undefined
|
|
66
|
+
} : config,
|
|
67
|
+
syntax = _ref.text,
|
|
68
|
+
annotations = _ref.annotations;
|
|
63
69
|
|
|
64
70
|
// Extract optional `theme <value>` line from syntax
|
|
65
71
|
var activeTheme = theme;
|
|
@@ -67,9 +73,13 @@ export var Summary = function Summary(options) {
|
|
|
67
73
|
activeTheme = t;
|
|
68
74
|
return '';
|
|
69
75
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
(_cleanupAnnotations = cleanupAnnotations) === null || _cleanupAnnotations === void 0 || _cleanupAnnotations();
|
|
77
|
+
cleanupAnnotations = undefined;
|
|
78
|
+
(_text = text) === null || _text === void 0 || _text.unmount();
|
|
79
|
+
var content = document.createElement('div');
|
|
80
|
+
wrapper.textContent = '';
|
|
81
|
+
wrapper.appendChild(content);
|
|
82
|
+
text = new Text(content);
|
|
73
83
|
|
|
74
84
|
// Set background color and padding on the wrapper
|
|
75
85
|
wrapper.style.backgroundColor = appearance.backgrounds[activeTheme];
|
|
@@ -78,19 +88,27 @@ export var Summary = function Summary(options) {
|
|
|
78
88
|
// Set theme and render syntax
|
|
79
89
|
text.theme(activeTheme, appearance.summary);
|
|
80
90
|
text.render(cleanedSyntax.trim());
|
|
91
|
+
cleanupAnnotations = bindAnnotations({
|
|
92
|
+
renderer: 'summary',
|
|
93
|
+
container: wrapper,
|
|
94
|
+
content: content,
|
|
95
|
+
annotations: annotations,
|
|
96
|
+
defaults: getAnnotationDefaults('summary', activeTheme === theme ? options.theme : activeTheme)
|
|
97
|
+
});
|
|
81
98
|
};
|
|
82
99
|
|
|
83
100
|
/**
|
|
84
101
|
* Destroy the summary instance and clean up resources.
|
|
85
102
|
*/
|
|
86
103
|
var destroy = function destroy() {
|
|
104
|
+
var _cleanupAnnotations2;
|
|
105
|
+
(_cleanupAnnotations2 = cleanupAnnotations) === null || _cleanupAnnotations2 === void 0 || _cleanupAnnotations2();
|
|
106
|
+
cleanupAnnotations = undefined;
|
|
87
107
|
if (text) {
|
|
88
108
|
text.unmount();
|
|
89
109
|
text = null;
|
|
90
110
|
}
|
|
91
|
-
|
|
92
|
-
wrapper.parentNode.removeChild(wrapper);
|
|
93
|
-
}
|
|
111
|
+
wrapper.remove();
|
|
94
112
|
};
|
|
95
113
|
return {
|
|
96
114
|
render: render,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RendererAnnotation } from '../../annotation/registry';
|
|
1
2
|
import type { ThemeStyle, VisualizationOptions, VisualizationTheme } from '../../types';
|
|
2
3
|
/**
|
|
3
4
|
* TableConfig defines the configuration for rendering the table.
|
|
@@ -9,6 +10,7 @@ export interface TableConfig {
|
|
|
9
10
|
subtitle?: string;
|
|
10
11
|
theme?: VisualizationTheme;
|
|
11
12
|
style?: ThemeStyle;
|
|
13
|
+
annotations?: RendererAnnotation<Record<string, unknown>, 'table', 'table'>[];
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* TableInstance represents a table instance with render and destroy methods.
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
6
|
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); }
|
|
3
7
|
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; }
|
|
4
8
|
import { measureText } from 'measury';
|
|
9
|
+
import { bindAnnotations } from "../../annotation";
|
|
10
|
+
import { getAnnotationDefaults } from "../../theme/annotation";
|
|
5
11
|
import { getThemeObject } from "../../theme/table";
|
|
6
|
-
import { escapeHtml } from "../../util
|
|
12
|
+
import { escapeHtml } from "../../util";
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
15
|
* TableConfig defines the configuration for rendering the table.
|
|
@@ -127,11 +133,13 @@ export var Table = function Table(options) {
|
|
|
127
133
|
throw new Error('Container not found');
|
|
128
134
|
}
|
|
129
135
|
var tableWrapper = null;
|
|
136
|
+
var cleanupAnnotations;
|
|
130
137
|
|
|
131
138
|
/**
|
|
132
139
|
* Render the table with the given configuration.
|
|
133
140
|
*/
|
|
134
141
|
var render = function render(config) {
|
|
142
|
+
var _cleanupAnnotations, _tableWrapper, _config$annotations;
|
|
135
143
|
var _config$data = config.data,
|
|
136
144
|
data = _config$data === void 0 ? [] : _config$data,
|
|
137
145
|
title = config.title,
|
|
@@ -145,53 +153,62 @@ export var Table = function Table(options) {
|
|
|
145
153
|
|
|
146
154
|
// Inject styles if not already present
|
|
147
155
|
injectStyles();
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
tableWrapper.remove();
|
|
152
|
-
}
|
|
156
|
+
(_cleanupAnnotations = cleanupAnnotations) === null || _cleanupAnnotations === void 0 || _cleanupAnnotations();
|
|
157
|
+
cleanupAnnotations = undefined;
|
|
158
|
+
(_tableWrapper = tableWrapper) === null || _tableWrapper === void 0 || _tableWrapper.remove();
|
|
153
159
|
|
|
154
160
|
// Create wrapper element
|
|
155
|
-
|
|
156
|
-
tableWrapper
|
|
161
|
+
var wrapper = document.createElement('div');
|
|
162
|
+
tableWrapper = wrapper;
|
|
163
|
+
container.appendChild(wrapper);
|
|
164
|
+
wrapper.className = SCOPE_ID;
|
|
157
165
|
if (rendererTheme === 'dark') {
|
|
158
|
-
|
|
166
|
+
wrapper.setAttribute('data-theme', 'dark');
|
|
159
167
|
}
|
|
160
|
-
if (style.backgroundColor)
|
|
168
|
+
if (style.backgroundColor) wrapper.style.backgroundColor = style.backgroundColor;
|
|
161
169
|
var titleHTML = title || subtitle ? "<div class=\"table-heading\">\n ".concat(title ? "<div class=\"table-title\">".concat(escapeHtml(title), "</div>") : '', "\n ").concat(subtitle ? "<div class=\"table-subtitle\">".concat(escapeHtml(subtitle), "</div>") : '', "\n </div>") : '';
|
|
162
170
|
|
|
163
171
|
// Handle empty data case
|
|
164
172
|
if (data.length === 0) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
wrapper.innerHTML = "\n ".concat(titleHTML, "\n <div class=\"table-empty\">No data available</div>\n ");
|
|
174
|
+
} else {
|
|
175
|
+
// Get columns from the first data item
|
|
176
|
+
var columns = Object.keys(data[0]);
|
|
177
|
+
var minWidth = Math.max(calculateTableMinWidth(data, columns), columns.length * 100);
|
|
178
|
+
var headerHTML = columns.map(function (column) {
|
|
179
|
+
return "<th>".concat(escapeHtml(column), "</th>");
|
|
180
|
+
}).join('');
|
|
181
|
+
var bodyHTML = data.map(function (row) {
|
|
182
|
+
return "<tr>".concat(columns.map(function (column) {
|
|
183
|
+
return "<td>".concat(escapeHtml(row[column]), "</td>");
|
|
184
|
+
}).join(''), "</tr>");
|
|
185
|
+
}).join('');
|
|
186
|
+
wrapper.innerHTML = "\n ".concat(titleHTML, "\n <table style=\"min-width: ").concat(minWidth, "px;\">\n <thead><tr>").concat(headerHTML, "</tr></thead>\n <tbody>").concat(bodyHTML, "</tbody>\n </table>\n ");
|
|
187
|
+
}
|
|
188
|
+
applyResolvedTableStyle(wrapper, style);
|
|
189
|
+
if ((_config$annotations = config.annotations) !== null && _config$annotations !== void 0 && _config$annotations.length) {
|
|
190
|
+
var content = document.createElement('div');
|
|
191
|
+
content.style.overflow = 'auto';
|
|
192
|
+
content.append.apply(content, _toConsumableArray(wrapper.childNodes));
|
|
193
|
+
wrapper.appendChild(content);
|
|
194
|
+
cleanupAnnotations = bindAnnotations({
|
|
195
|
+
renderer: 'table',
|
|
196
|
+
container: wrapper,
|
|
197
|
+
content: content,
|
|
198
|
+
data: data,
|
|
199
|
+
annotations: config.annotations,
|
|
200
|
+
defaults: getAnnotationDefaults('table', theme, localStyle)
|
|
201
|
+
});
|
|
169
202
|
}
|
|
170
|
-
|
|
171
|
-
// Get columns from the first data item
|
|
172
|
-
var columns = Object.keys(data[0]);
|
|
173
|
-
|
|
174
|
-
// Calculate the minimum width needed for the table using pure function
|
|
175
|
-
var minWidth = calculateTableMinWidth(data, columns);
|
|
176
|
-
// Ensure a minimum width for columns
|
|
177
|
-
minWidth = Math.max(minWidth, columns.length * 100);
|
|
178
|
-
var headerHTML = columns.map(function (column) {
|
|
179
|
-
return "<th>".concat(escapeHtml(column), "</th>");
|
|
180
|
-
}).join('');
|
|
181
|
-
var bodyHTML = data.map(function (row) {
|
|
182
|
-
return "<tr>".concat(columns.map(function (column) {
|
|
183
|
-
return "<td>".concat(escapeHtml(row[column]), "</td>");
|
|
184
|
-
}).join(''), "</tr>");
|
|
185
|
-
}).join('');
|
|
186
|
-
tableWrapper.innerHTML = "\n ".concat(titleHTML, "\n <table style=\"min-width: ").concat(minWidth, "px;\">\n <thead><tr>").concat(headerHTML, "</tr></thead>\n <tbody>").concat(bodyHTML, "</tbody>\n </table>\n ");
|
|
187
|
-
applyResolvedTableStyle(tableWrapper, style);
|
|
188
|
-
container.appendChild(tableWrapper);
|
|
189
203
|
};
|
|
190
204
|
|
|
191
205
|
/**
|
|
192
206
|
* Destroy the table instance and clean up resources.
|
|
193
207
|
*/
|
|
194
208
|
var destroy = function destroy() {
|
|
209
|
+
var _cleanupAnnotations2;
|
|
210
|
+
(_cleanupAnnotations2 = cleanupAnnotations) === null || _cleanupAnnotations2 === void 0 || _cleanupAnnotations2();
|
|
211
|
+
cleanupAnnotations = undefined;
|
|
195
212
|
if (tableWrapper) {
|
|
196
213
|
tableWrapper.remove();
|
|
197
214
|
tableWrapper = null;
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { Chart } from '@antv/g2';
|
|
8
8
|
import { getThemeObject } from "../../theme/g2";
|
|
9
|
-
import { getDataLabels } from "../../util
|
|
9
|
+
import { getDataLabels } from "../../util";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* VennDataItem is the type for each data item in the venn chart.
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { Chart } from '@antv/g2';
|
|
8
8
|
import { getThemeObject } from "../../theme/g2";
|
|
9
|
-
import { getCartesianAxis, getColorLegend } from "../../util
|
|
9
|
+
import { getCartesianAxis, getColorLegend } from "../../util";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* ViolinDataItem is the type for each data item in the violin chart.
|
|
@@ -207,9 +207,17 @@ export var Violin = function Violin(options) {
|
|
|
207
207
|
subtitle: subtitle
|
|
208
208
|
} : '',
|
|
209
209
|
axis: getCartesianAxis({
|
|
210
|
+
xType: 'category',
|
|
211
|
+
xValues: data.map(function (_ref) {
|
|
212
|
+
var category = _ref.category;
|
|
213
|
+
return category;
|
|
214
|
+
}),
|
|
215
|
+
container: container,
|
|
216
|
+
chartWidth: width,
|
|
217
|
+
chartHeight: height,
|
|
210
218
|
axisXTitle: axisXTitle,
|
|
211
219
|
axisYTitle: axisYTitle
|
|
212
|
-
}),
|
|
220
|
+
}, rendererTheme),
|
|
213
221
|
scale: {
|
|
214
222
|
y: {
|
|
215
223
|
nice: true,
|
|
@@ -12,7 +12,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
12
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
13
|
import { Chart } from '@antv/g2';
|
|
14
14
|
import { getThemeObject } from "../../theme/g2";
|
|
15
|
-
import { getDataLabels } from "../../util
|
|
15
|
+
import { getCartesianAxis, getDataLabels } from "../../util";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* WaterfallDataItem is the type for each data item in the waterfall chart.
|
|
@@ -156,6 +156,19 @@ export var Waterfall = function Waterfall(options) {
|
|
|
156
156
|
|
|
157
157
|
// Generate link data for connecting lines
|
|
158
158
|
var linkData = generateLinkData(transformedData);
|
|
159
|
+
var cartesianAxis = getCartesianAxis({
|
|
160
|
+
xType: 'category',
|
|
161
|
+
xValues: data.map(function (_ref3) {
|
|
162
|
+
var category = _ref3.category;
|
|
163
|
+
return category;
|
|
164
|
+
}),
|
|
165
|
+
container: container,
|
|
166
|
+
chartWidth: width,
|
|
167
|
+
chartHeight: height,
|
|
168
|
+
axisXTitle: axisXTitle,
|
|
169
|
+
axisYTitle: axisYTitle
|
|
170
|
+
}, rendererTheme);
|
|
171
|
+
cartesianAxis.y.labelFormatter = '~s';
|
|
159
172
|
|
|
160
173
|
// Create chart
|
|
161
174
|
chart = new Chart({
|
|
@@ -176,16 +189,7 @@ export var Waterfall = function Waterfall(options) {
|
|
|
176
189
|
title: title,
|
|
177
190
|
subtitle: subtitle
|
|
178
191
|
} : '',
|
|
179
|
-
|
|
180
|
-
axis: {
|
|
181
|
-
x: {
|
|
182
|
-
title: axisXTitle || false
|
|
183
|
-
},
|
|
184
|
-
y: {
|
|
185
|
-
title: axisYTitle || false,
|
|
186
|
-
labelFormatter: '~s'
|
|
187
|
-
}
|
|
188
|
-
},
|
|
192
|
+
axis: cartesianAxis,
|
|
189
193
|
scale: {
|
|
190
194
|
y: {
|
|
191
195
|
nice: true
|
|
@@ -208,8 +212,7 @@ export var Waterfall = function Waterfall(options) {
|
|
|
208
212
|
labels: getDataLabels(rendererTheme, {
|
|
209
213
|
style: {
|
|
210
214
|
fontSize: 10,
|
|
211
|
-
fontWeight: 600
|
|
212
|
-
stroke: '#fff'
|
|
215
|
+
fontWeight: 600
|
|
213
216
|
},
|
|
214
217
|
defaultVisible: true,
|
|
215
218
|
text: '__value__',
|
|
@@ -6,9 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { Chart } from '@antv/g2';
|
|
8
8
|
import { getThemeObject } from "../../theme/g2";
|
|
9
|
-
import { resolveChartLocale } from "../../util
|
|
10
|
-
import { getElementHoverScaleInteraction } from "../../util/interaction";
|
|
11
|
-
import { CHART_STYLE_DEFAULTS } from "../../util/tokens";
|
|
9
|
+
import { CHART_STYLE_DEFAULTS, getElementHoverScaleInteraction, resolveChartLocale } from "../../util";
|
|
12
10
|
var WORD_CLOUD_MAX_WORDS = 50;
|
|
13
11
|
var WORD_CLOUD_FONT_FAMILY = 'Impact';
|
|
14
12
|
var WORD_CLOUD_ROTATIONS = [-90, -60, -30, 0, 30, 60];
|
|
@@ -65,7 +65,7 @@ export function createVisWrapper(container) {
|
|
|
65
65
|
var zoomButtonsHTML = "\n <button class=\"gpt-vis-wrapper-text-button gpt-vis-wrapper-zoom-button gpt-vis-wrapper-tab-hide\"\n data-action=\"zoom-out\"\n aria-label=\"Zoom out\"\n title=\"Zoom out\">\n ".concat(createZoomOutIcon(18), "\n </button>\n <button class=\"gpt-vis-wrapper-text-button gpt-vis-wrapper-zoom-button gpt-vis-wrapper-tab-hide\"\n data-action=\"zoom-in\"\n aria-label=\"Zoom in\"\n title=\"Zoom in\">\n ").concat(createZoomInIcon(18), "\n </button>\n <div class=\"gpt-vis-wrapper-divider gpt-vis-wrapper-tab-hide\"></div>\n ");
|
|
66
66
|
|
|
67
67
|
// Create wrapper HTML structure using template string
|
|
68
|
-
var wrapperHTML = "\n <div class=\"gpt-vis-wrapper-container\">\n <div class=\"gpt-vis-wrapper-header\">\n <div class=\"gpt-vis-wrapper-tab-left\">\n <button class=\"gpt-vis-wrapper-tab-button active\" \n data-tab=\"chart\"\n role=\"tab\" \n aria-selected=\"true\" \n aria-controls=\"chart-panel\">\n ".concat(labels.chartTab, "\n </button>\n <button class=\"gpt-vis-wrapper-tab-button\" \n data-tab=\"code\"\n role=\"tab\" \n aria-selected=\"false\" \n aria-controls=\"code-panel\">\n ").concat(labels.codeTab, "\n </button>\n </div>\n <div class=\"gpt-vis-wrapper-tab-right\">\n ").concat(zoomButtonsHTML, "\n <button class=\"gpt-vis-wrapper-text-button\" \n data-action=\"download\"\n aria-label=\"").concat(labels.download, "\">\n ").concat(createDownloadIcon(16), " <span>").concat(labels.download, "</span>\n </button>\n <button class=\"gpt-vis-wrapper-text-button gpt-vis-wrapper-tab-hide\" \n data-action=\"copy\"\n aria-label=\"").concat(labels.copy, "\">\n ").concat(createCopyIcon(), " <span>").concat(labels.copy, "</span>\n </button>\n </div>\n </div>\n <div class=\"gpt-vis-wrapper-content\">\n <div class=\"gpt-vis-wrapper-chart\">\n <div class=\"gpt-vis-wrapper-chart-container\"></div>\n </div>\n <div class=\"gpt-vis-wrapper-code gpt-vis-wrapper-tab-hide\"
|
|
68
|
+
var wrapperHTML = "\n <div class=\"gpt-vis-wrapper-container\">\n <div class=\"gpt-vis-wrapper-header\">\n <div class=\"gpt-vis-wrapper-tab-left\">\n <button class=\"gpt-vis-wrapper-tab-button active\" \n data-tab=\"chart\"\n role=\"tab\" \n aria-selected=\"true\" \n aria-controls=\"chart-panel\">\n ".concat(labels.chartTab, "\n </button>\n <button class=\"gpt-vis-wrapper-tab-button\" \n data-tab=\"code\"\n role=\"tab\" \n aria-selected=\"false\" \n aria-controls=\"code-panel\">\n ").concat(labels.codeTab, "\n </button>\n </div>\n <div class=\"gpt-vis-wrapper-tab-right\">\n ").concat(zoomButtonsHTML, "\n <button class=\"gpt-vis-wrapper-text-button\" \n data-action=\"download\"\n aria-label=\"").concat(labels.download, "\">\n ").concat(createDownloadIcon(16), " <span>").concat(labels.download, "</span>\n </button>\n <button class=\"gpt-vis-wrapper-text-button gpt-vis-wrapper-tab-hide\" \n data-action=\"copy\"\n aria-label=\"").concat(labels.copy, "\">\n ").concat(createCopyIcon(), " <span>").concat(labels.copy, "</span>\n </button>\n </div>\n </div>\n <div class=\"gpt-vis-wrapper-content\">\n <div class=\"gpt-vis-wrapper-chart\">\n <div class=\"gpt-vis-wrapper-chart-container\"></div>\n </div>\n <div class=\"gpt-vis-wrapper-code gpt-vis-wrapper-tab-hide\"></div>\n </div>\n </div>\n ");
|
|
69
69
|
|
|
70
70
|
// Insert HTML into container
|
|
71
71
|
containerElement.innerHTML = wrapperHTML;
|
|
@@ -76,6 +76,7 @@ export function createVisWrapper(container) {
|
|
|
76
76
|
var codeTabButton = wrapperContainer.querySelector('[data-tab="code"]');
|
|
77
77
|
var chartWrapper = wrapperContainer.querySelector('.gpt-vis-wrapper-chart');
|
|
78
78
|
var codeContainer = wrapperContainer.querySelector('.gpt-vis-wrapper-code');
|
|
79
|
+
codeContainer.textContent = syntaxString;
|
|
79
80
|
var chartContainer = wrapperContainer.querySelector('.gpt-vis-wrapper-chart-container');
|
|
80
81
|
var downloadButton = wrapperContainer.querySelector('[data-action="download"]');
|
|
81
82
|
var copyButton = wrapperContainer.querySelector('[data-action="copy"]');
|