@fluentui/react-charting 5.23.17 → 5.23.19
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/CHANGELOG.json +37 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.d.ts +38 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +18 -0
- package/lib/DeclarativeChart.d.ts +1 -0
- package/lib/DeclarativeChart.js +2 -0
- package/lib/DeclarativeChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.base.js +6 -5
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +2 -2
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +36 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +67 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +27 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +387 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib/components/Legends/shape.js +3 -3
- package/lib/components/Legends/shape.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js +2 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/utilities.d.ts +1 -0
- package/lib/utilities/utilities.js +7 -1
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/DeclarativeChart.d.ts +1 -0
- package/lib-amd/DeclarativeChart.js +6 -0
- package/lib-amd/DeclarativeChart.js.map +1 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +5 -4
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +36 -0
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +58 -0
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +27 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +402 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-amd/components/Legends/shape.js +2 -2
- package/lib-amd/components/Legends/shape.js.map +1 -1
- package/lib-amd/components/LineChart/eventAnnotation/Textbox.js +2 -2
- package/lib-amd/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-amd/index.d.ts +2 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +1 -0
- package/lib-amd/utilities/utilities.js +8 -1
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/DeclarativeChart.d.ts +1 -0
- package/lib-commonjs/DeclarativeChart.js +5 -0
- package/lib-commonjs/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +5 -4
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +36 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +70 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +27 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +402 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/Legends/shape.js +2 -2
- package/lib-commonjs/components/Legends/shape.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +2 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -0
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +1 -0
- package/lib-commonjs/utilities/utilities.js +8 -1
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { getNextColor } from '../../utilities/colors';
|
|
3
|
+
var isDate = function (value) { return !isNaN(Date.parse(value)); };
|
|
4
|
+
var isNumber = function (value) { return !isNaN(parseFloat(value)) && isFinite(value); };
|
|
5
|
+
export var isDateArray = function (array) { return isArrayOrTypedArray(array) && array.every(isDate); };
|
|
6
|
+
export var isNumberArray = function (array) { return isArrayOrTypedArray(array) && array.every(isNumber); };
|
|
7
|
+
export var getColor = function (legendLabel, colorMap) {
|
|
8
|
+
if (!colorMap.current.has(legendLabel)) {
|
|
9
|
+
var nextColor = getNextColor(colorMap.current.size + 1);
|
|
10
|
+
colorMap.current.set(legendLabel, nextColor);
|
|
11
|
+
return nextColor;
|
|
12
|
+
}
|
|
13
|
+
return colorMap.current.get(legendLabel);
|
|
14
|
+
};
|
|
15
|
+
export var transformPlotlyJsonToDonutProps = function (jsonObj, colorMap) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
18
|
+
var firstData = data[0];
|
|
19
|
+
var donutData = (_a = firstData.labels) === null || _a === void 0 ? void 0 : _a.map(function (label, index) {
|
|
20
|
+
var _a;
|
|
21
|
+
var color = getColor(label, colorMap);
|
|
22
|
+
return {
|
|
23
|
+
legend: label,
|
|
24
|
+
data: (_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index],
|
|
25
|
+
color: color,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
// TODO: innerRadius as a fraction needs to be supported internally. The pixel value depends on
|
|
29
|
+
// chart dimensions, arc label dimensions and the legend container height, all of which are subject to change.
|
|
30
|
+
var width = (layout === null || layout === void 0 ? void 0 : layout.width) || 440;
|
|
31
|
+
var height = (layout === null || layout === void 0 ? void 0 : layout.height) || 220;
|
|
32
|
+
var hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;
|
|
33
|
+
var donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
34
|
+
var donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
35
|
+
var innerRadius = firstData.hole
|
|
36
|
+
? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
|
|
37
|
+
: 0;
|
|
38
|
+
var styles = {
|
|
39
|
+
root: {
|
|
40
|
+
'[class^="arcLabel"]': {
|
|
41
|
+
fontSize: (_b = firstData.textfont) === null || _b === void 0 ? void 0 : _b.size,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
data: {
|
|
47
|
+
chartTitle: layout === null || layout === void 0 ? void 0 : layout.title,
|
|
48
|
+
chartData: donutData,
|
|
49
|
+
},
|
|
50
|
+
hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : false,
|
|
51
|
+
width: width,
|
|
52
|
+
height: height,
|
|
53
|
+
innerRadius: innerRadius,
|
|
54
|
+
hideLabels: hideLabels,
|
|
55
|
+
showLabelsInPercent: firstData.textinfo ? firstData.textinfo === 'percent' : true,
|
|
56
|
+
styles: styles,
|
|
57
|
+
// TODO: Render custom hover card based on textinfo
|
|
58
|
+
// onRenderCalloutPerDataPoint: undefined,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export var transformPlotlyJsonToVSBCProps = function (jsonObj, colorMap) {
|
|
62
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
63
|
+
var mapXToDataPoints = {};
|
|
64
|
+
var yMaxValue = 0;
|
|
65
|
+
data.forEach(function (series, index1) {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
if (!mapXToDataPoints[x]) {
|
|
70
|
+
mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };
|
|
71
|
+
}
|
|
72
|
+
var legend = series.name || "Series ".concat(index1 + 1);
|
|
73
|
+
if (series.type === 'bar') {
|
|
74
|
+
var color = getColor(legend, colorMap);
|
|
75
|
+
mapXToDataPoints[x].chartData.push({
|
|
76
|
+
legend: legend,
|
|
77
|
+
data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
|
|
78
|
+
color: color,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else if (series.type === 'line') {
|
|
82
|
+
var color = getColor(legend, colorMap);
|
|
83
|
+
mapXToDataPoints[x].lineData.push({
|
|
84
|
+
legend: legend,
|
|
85
|
+
y: (_b = series.y) === null || _b === void 0 ? void 0 : _b[index2],
|
|
86
|
+
color: color,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
yMaxValue = Math.max(yMaxValue, (_c = series.y) === null || _c === void 0 ? void 0 : _c[index2]);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
data: Object.values(mapXToDataPoints),
|
|
94
|
+
chartTitle: layout === null || layout === void 0 ? void 0 : layout.title,
|
|
95
|
+
// width: layout?.width,
|
|
96
|
+
// height: layout?.height,
|
|
97
|
+
barWidth: 'auto',
|
|
98
|
+
yMaxValue: yMaxValue,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
// TODO: Add support for continuous x-axis in grouped vertical bar chart
|
|
102
|
+
export var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap) {
|
|
103
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
104
|
+
var mapXToDataPoints = {};
|
|
105
|
+
data.forEach(function (series, index1) {
|
|
106
|
+
var _a;
|
|
107
|
+
(_a = series.x) === null || _a === void 0 ? void 0 : _a.forEach(function (x, index2) {
|
|
108
|
+
var _a;
|
|
109
|
+
if (!mapXToDataPoints[x]) {
|
|
110
|
+
mapXToDataPoints[x] = { name: x.toString(), series: [] };
|
|
111
|
+
}
|
|
112
|
+
if (series.type === 'bar') {
|
|
113
|
+
var legend = series.name || "Series ".concat(index1 + 1);
|
|
114
|
+
var color = getColor(legend, colorMap);
|
|
115
|
+
mapXToDataPoints[x].series.push({
|
|
116
|
+
key: legend,
|
|
117
|
+
data: (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2],
|
|
118
|
+
color: color,
|
|
119
|
+
legend: legend,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
data: Object.values(mapXToDataPoints),
|
|
126
|
+
chartTitle: layout === null || layout === void 0 ? void 0 : layout.title,
|
|
127
|
+
// width: layout?.width,
|
|
128
|
+
// height: layout?.height,
|
|
129
|
+
barwidth: 'auto',
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, colorMap) {
|
|
133
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
134
|
+
var chartData = data.map(function (series, index) {
|
|
135
|
+
var xValues = series.x;
|
|
136
|
+
var isString = typeof xValues[0] === 'string';
|
|
137
|
+
var isXDate = isDateArray(xValues);
|
|
138
|
+
var isXNumber = isNumberArray(xValues);
|
|
139
|
+
var legend = series.name || "Series ".concat(index + 1);
|
|
140
|
+
var lineColor = getColor(legend, colorMap);
|
|
141
|
+
return {
|
|
142
|
+
legend: legend,
|
|
143
|
+
data: xValues.map(function (x, i) { return ({
|
|
144
|
+
x: isString ? (isXDate ? new Date(x) : isXNumber ? parseFloat(x) : x) : x,
|
|
145
|
+
y: series.y[i],
|
|
146
|
+
}); }),
|
|
147
|
+
color: lineColor,
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
var chartProps = {
|
|
151
|
+
chartTitle: layout.title || '',
|
|
152
|
+
lineChartData: chartData,
|
|
153
|
+
};
|
|
154
|
+
if (isAreaChart) {
|
|
155
|
+
return {
|
|
156
|
+
data: chartProps,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return {
|
|
161
|
+
data: chartProps,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (jsonObj, colorMap) {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
168
|
+
var chartData = data
|
|
169
|
+
.map(function (series, index) {
|
|
170
|
+
return series.y.map(function (yValue, i) {
|
|
171
|
+
var color = getColor(yValue, colorMap);
|
|
172
|
+
return {
|
|
173
|
+
x: series.x[i],
|
|
174
|
+
y: yValue,
|
|
175
|
+
legend: yValue,
|
|
176
|
+
color: color,
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
})
|
|
180
|
+
.flat();
|
|
181
|
+
var chartHeight = layout.height || 350;
|
|
182
|
+
var margin = ((_a = layout.margin) === null || _a === void 0 ? void 0 : _a.l) || 0;
|
|
183
|
+
var padding = ((_b = layout.margin) === null || _b === void 0 ? void 0 : _b.pad) || 0;
|
|
184
|
+
var availableHeight = chartHeight - margin - padding;
|
|
185
|
+
var numberOfBars = data[0].y.length;
|
|
186
|
+
var gapFactor = 0.5;
|
|
187
|
+
var barHeight = availableHeight / (numberOfBars * (1 + gapFactor));
|
|
188
|
+
return {
|
|
189
|
+
data: chartData,
|
|
190
|
+
chartTitle: layout.title || '',
|
|
191
|
+
barHeight: barHeight,
|
|
192
|
+
showYAxisLables: true,
|
|
193
|
+
styles: {
|
|
194
|
+
root: {
|
|
195
|
+
height: chartHeight,
|
|
196
|
+
width: layout.width || 600,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
// FIXME: Order of string axis ticks does not match the order in plotly json
|
|
202
|
+
// TODO: Add support for custom hover card
|
|
203
|
+
export var transformPlotlyJsonToHeatmapProps = function (jsonObj) {
|
|
204
|
+
var _a, _b, _c;
|
|
205
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
206
|
+
var firstData = data[0];
|
|
207
|
+
var heatmapDataPoints = [];
|
|
208
|
+
var zMin = Number.POSITIVE_INFINITY;
|
|
209
|
+
var zMax = Number.NEGATIVE_INFINITY;
|
|
210
|
+
(_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, xIdx) {
|
|
211
|
+
var _a;
|
|
212
|
+
(_a = firstData.y) === null || _a === void 0 ? void 0 : _a.forEach(function (yVal, yIdx) {
|
|
213
|
+
var _a, _b, _c, _d;
|
|
214
|
+
var zVal = (_b = (_a = firstData.z) === null || _a === void 0 ? void 0 : _a[yIdx]) === null || _b === void 0 ? void 0 : _b[xIdx];
|
|
215
|
+
heatmapDataPoints.push({
|
|
216
|
+
x: ((_c = layout.xaxis) === null || _c === void 0 ? void 0 : _c.type) === 'date' ? new Date(xVal) : xVal,
|
|
217
|
+
y: ((_d = layout.yaxis) === null || _d === void 0 ? void 0 : _d.type) === 'date' ? new Date(yVal) : yVal,
|
|
218
|
+
value: zVal,
|
|
219
|
+
});
|
|
220
|
+
zMin = Math.min(zMin, zVal);
|
|
221
|
+
zMax = Math.max(zMax, zVal);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
var heatmapData = {
|
|
225
|
+
legend: firstData.name || '',
|
|
226
|
+
data: heatmapDataPoints,
|
|
227
|
+
value: 0,
|
|
228
|
+
};
|
|
229
|
+
// Convert normalized values to actual values
|
|
230
|
+
var domainValuesForColorScale = (_b = firstData.colorscale) === null || _b === void 0 ? void 0 : _b.map(function (arr) { return arr[0] * (zMax - zMin) + zMin; });
|
|
231
|
+
var rangeValuesForColorScale = (_c = firstData.colorscale) === null || _c === void 0 ? void 0 : _c.map(function (arr) { return arr[1]; });
|
|
232
|
+
return {
|
|
233
|
+
data: [heatmapData],
|
|
234
|
+
domainValuesForColorScale: domainValuesForColorScale,
|
|
235
|
+
rangeValuesForColorScale: rangeValuesForColorScale,
|
|
236
|
+
hideLegend: true,
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export var transformPlotlyJsonToSankeyProps = function (jsonObj, colorMap) {
|
|
240
|
+
var _a;
|
|
241
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
242
|
+
var _b = data[0], link = _b.link, node = _b.node;
|
|
243
|
+
var validLinks = link.value
|
|
244
|
+
.map(function (val, index) { return ({
|
|
245
|
+
value: val,
|
|
246
|
+
source: link.source[index],
|
|
247
|
+
target: link.target[index],
|
|
248
|
+
}); })
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
250
|
+
//@ts-expect-error Dynamic link object. Ignore for now.
|
|
251
|
+
.filter(function (x) { return x.source !== x.target; }); // Filter out self-references (circular links)
|
|
252
|
+
var sankeyChartData = {
|
|
253
|
+
nodes: node.label.map(function (label, index) {
|
|
254
|
+
var color = getColor(label, colorMap);
|
|
255
|
+
return {
|
|
256
|
+
nodeId: index,
|
|
257
|
+
name: label,
|
|
258
|
+
color: color,
|
|
259
|
+
};
|
|
260
|
+
}),
|
|
261
|
+
links: validLinks.map(function (validLink, index) {
|
|
262
|
+
return __assign({}, validLink);
|
|
263
|
+
}),
|
|
264
|
+
};
|
|
265
|
+
var width = (layout === null || layout === void 0 ? void 0 : layout.width) || 440;
|
|
266
|
+
var height = (layout === null || layout === void 0 ? void 0 : layout.height) || 220;
|
|
267
|
+
var styles = {
|
|
268
|
+
root: {
|
|
269
|
+
fontSize: (_a = layout.font) === null || _a === void 0 ? void 0 : _a.size,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
var shouldResize = width + height;
|
|
273
|
+
return {
|
|
274
|
+
data: {
|
|
275
|
+
chartTitle: layout === null || layout === void 0 ? void 0 : layout.title,
|
|
276
|
+
SankeyChartData: sankeyChartData,
|
|
277
|
+
},
|
|
278
|
+
width: width,
|
|
279
|
+
height: height,
|
|
280
|
+
styles: styles,
|
|
281
|
+
shouldResize: shouldResize,
|
|
282
|
+
enableReflow: true,
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
export var transformPlotlyJsonToGaugeProps = function (jsonObj, colorMap) {
|
|
286
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
287
|
+
var data = jsonObj.data, layout = jsonObj.layout;
|
|
288
|
+
var firstData = data[0];
|
|
289
|
+
var segments = (_b = (_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.map(function (step, index) {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
var legend = step.name || "Segment ".concat(index + 1);
|
|
292
|
+
var color = getColor(legend, colorMap);
|
|
293
|
+
return {
|
|
294
|
+
legend: legend,
|
|
295
|
+
size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
|
|
296
|
+
color: color,
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
var sublabel;
|
|
300
|
+
var sublabelColor;
|
|
301
|
+
if (typeof ((_c = firstData.delta) === null || _c === void 0 ? void 0 : _c.reference) === 'number') {
|
|
302
|
+
var diff = firstData.value - firstData.delta.reference;
|
|
303
|
+
if (diff >= 0) {
|
|
304
|
+
sublabel = "\u25B2 ".concat(diff);
|
|
305
|
+
var color = getColor(((_d = firstData.delta.increasing) === null || _d === void 0 ? void 0 : _d.color) || '', colorMap);
|
|
306
|
+
sublabelColor = color;
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
310
|
+
var color = getColor(((_e = firstData.delta.decreasing) === null || _e === void 0 ? void 0 : _e.color) || '', colorMap);
|
|
311
|
+
sublabelColor = color;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
var styles = {
|
|
315
|
+
sublabel: {
|
|
316
|
+
fill: sublabelColor,
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
return {
|
|
320
|
+
segments: segments,
|
|
321
|
+
chartValue: firstData.value,
|
|
322
|
+
chartTitle: (_f = firstData.title) === null || _f === void 0 ? void 0 : _f.text,
|
|
323
|
+
sublabel: sublabel,
|
|
324
|
+
// range values can be null
|
|
325
|
+
minValue: (_k = (_j = (_h = (_g = firstData.gauge) === null || _g === void 0 ? void 0 : _g.axis) === null || _h === void 0 ? void 0 : _h.range) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : undefined,
|
|
326
|
+
maxValue: (_p = (_o = (_m = (_l = firstData.gauge) === null || _l === void 0 ? void 0 : _l.axis) === null || _m === void 0 ? void 0 : _m.range) === null || _o === void 0 ? void 0 : _o[1]) !== null && _p !== void 0 ? _p : undefined,
|
|
327
|
+
chartValueFormat: function () { return firstData.value; },
|
|
328
|
+
width: layout === null || layout === void 0 ? void 0 : layout.width,
|
|
329
|
+
height: layout === null || layout === void 0 ? void 0 : layout.height,
|
|
330
|
+
hideLegend: true,
|
|
331
|
+
styles: styles,
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
function isTypedArray(a) {
|
|
335
|
+
return ArrayBuffer.isView(a) && !(a instanceof DataView);
|
|
336
|
+
}
|
|
337
|
+
function isArrayOrTypedArray(a) {
|
|
338
|
+
return Array.isArray(a) || isTypedArray(a);
|
|
339
|
+
}
|
|
340
|
+
function isPlainObject(obj) {
|
|
341
|
+
if (window && window.process && window.process.versions) {
|
|
342
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
343
|
+
}
|
|
344
|
+
return (Object.prototype.toString.call(obj) === '[object Object]' &&
|
|
345
|
+
Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty'));
|
|
346
|
+
}
|
|
347
|
+
var arrayAttributes = [];
|
|
348
|
+
var stack = [];
|
|
349
|
+
var isArrayStack = [];
|
|
350
|
+
var baseContainer, baseAttrName;
|
|
351
|
+
/**
|
|
352
|
+
* Interate iteratively through the trace object and find all the array attributes.
|
|
353
|
+
* 1 trace record = 1 series of data
|
|
354
|
+
* @param trace
|
|
355
|
+
*/
|
|
356
|
+
export function findArrayAttributes(trace) {
|
|
357
|
+
// Init basecontainer and baseAttrName
|
|
358
|
+
crawlIntoTrace(baseContainer, 0, '');
|
|
359
|
+
for (var _i = 0, arrayAttributes_1 = arrayAttributes; _i < arrayAttributes_1.length; _i++) {
|
|
360
|
+
var attribute = arrayAttributes_1[_i];
|
|
361
|
+
console.log(attribute);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function crawlIntoTrace(container, i, astrPartial) {
|
|
365
|
+
var item = container[stack[i]];
|
|
366
|
+
var newAstrPartial = astrPartial + stack[i];
|
|
367
|
+
if (i === stack.length - 1) {
|
|
368
|
+
if (isArrayOrTypedArray(item)) {
|
|
369
|
+
arrayAttributes.push(baseAttrName + newAstrPartial);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
if (isArrayStack[i]) {
|
|
374
|
+
if (Array.isArray(item)) {
|
|
375
|
+
for (var j = 0; j < item.length; j++) {
|
|
376
|
+
if (isPlainObject(item[j])) {
|
|
377
|
+
crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
else if (isPlainObject(item)) {
|
|
383
|
+
crawlIntoTrace(item, i + 1, newAstrPartial + '.');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|
|
@@ -0,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G,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;qBACjE;iBACF;aACF;SACF;aAAM,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;YAC9B,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;SACnD;KACF;AACH,CAAC","sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { IDonutChartProps } from '../DonutChart/index';\nimport {\n IChartDataPoint,\n IChartProps,\n IHorizontalBarChartWithAxisDataPoint,\n ILineChartPoints,\n IVerticalStackedChartProps,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IGroupedVerticalBarChartData,\n} from '../../types/IDataPoint';\nimport { ISankeyChartProps } from '../SankeyChart/index';\nimport { IVerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { IHorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { ILineChartProps } from '../LineChart/index';\nimport { IAreaChartProps } from '../AreaChart/index';\nimport { IHeatMapChartProps } from '../HeatMapChart/index';\nimport { getNextColor } from '../../utilities/colors';\nimport { IGaugeChartProps, IGaugeChartSegment } from '../GaugeChart/index';\nimport { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\n\nconst isDate = (value: any): boolean => !isNaN(Date.parse(value));\nconst isNumber = (value: any): boolean => !isNaN(parseFloat(value)) && isFinite(value);\nexport const isDateArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isDate);\nexport const isNumberArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isNumber);\n\nexport const getColor = (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): IDonutChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const donutData = firstData.labels?.map((label: string, index: number): IChartDataPoint => {\n const color = getColor(label, colorMap);\n return {\n legend: label,\n data: firstData.values?.[index],\n color,\n };\n });\n\n // TODO: innerRadius as a fraction needs to be supported internally. The pixel value depends on\n // chart dimensions, arc label dimensions and the legend container height, all of which are subject to change.\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;\n const donutMarginHorizontal = hideLabels ? 0 : 80;\n const donutMarginVertical = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n\n const styles: IDonutChartProps['styles'] = {\n root: {\n '[class^=\"arcLabel\"]': {\n fontSize: firstData.textfont?.size,\n },\n },\n };\n\n return {\n data: {\n chartTitle: layout?.title,\n chartData: donutData,\n },\n hideLegend: layout?.showlegend === false ? true : false,\n width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? firstData.textinfo === 'percent' : true,\n styles,\n // TODO: Render custom hover card based on textinfo\n // onRenderCalloutPerDataPoint: undefined,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): IVerticalStackedBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: { [key: string]: IVerticalStackedChartProps } = {};\n let yMaxValue = 0;\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };\n }\n const legend: string = series.name || `Series ${index1 + 1}`;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: series.y?.[index2],\n color,\n });\n } else if (series.type === 'line') {\n const color = getColor(legend, colorMap);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: series.y?.[index2],\n color,\n });\n }\n\n yMaxValue = Math.max(yMaxValue, series.y?.[index2]);\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barWidth: 'auto',\n yMaxValue,\n };\n};\n\n// TODO: Add support for continuous x-axis in grouped vertical bar chart\nexport const transformPlotlyJsonToGVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): IGroupedVerticalBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: Record<string, IGroupedVerticalBarChartData> = {};\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = series.name || `Series ${index1 + 1}`;\n const color = getColor(legend, colorMap);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: series.y?.[index2],\n color,\n legend,\n });\n }\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barwidth: 'auto',\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n jsonObj: any,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): ILineChartProps | IAreaChartProps => {\n const { data, layout } = jsonObj;\n\n const chartData: ILineChartPoints[] = data.map((series: any, index: number) => {\n const xValues = series.x;\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend = series.name || `Series ${index + 1}`;\n const lineColor = getColor(legend, colorMap);\n\n return {\n legend,\n data: xValues.map((x: string | number, i: number) => ({\n x: isString ? (isXDate ? new Date(x) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n })),\n color: lineColor,\n };\n });\n\n const chartProps: IChartProps = {\n chartTitle: layout.title || '',\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n } as IAreaChartProps;\n } else {\n return {\n data: chartProps,\n } as ILineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): IHorizontalBarChartWithAxisProps => {\n const { data, layout } = jsonObj;\n\n const chartData: IHorizontalBarChartWithAxisDataPoint[] = data\n .map((series: any, index: number) => {\n return series.y.map((yValue: string, i: number) => {\n const color = getColor(yValue, colorMap);\n return {\n x: series.x[i],\n y: yValue,\n legend: yValue,\n color,\n };\n });\n })\n .flat();\n\n const chartHeight = layout.height || 350;\n const margin = layout.margin?.l || 0;\n const padding = layout.margin?.pad || 0;\n const availableHeight = chartHeight - margin - padding;\n const numberOfBars = data[0].y.length;\n const gapFactor = 0.5;\n const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));\n\n return {\n data: chartData,\n chartTitle: layout.title || '',\n barHeight,\n showYAxisLables: true,\n styles: {\n root: {\n height: chartHeight,\n width: layout.width || 600,\n },\n },\n };\n};\n\n// FIXME: Order of string axis ticks does not match the order in plotly json\n// TODO: Add support for custom hover card\nexport const transformPlotlyJsonToHeatmapProps = (jsonObj: any): IHeatMapChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n const heatmapDataPoints: IHeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n firstData.x?.forEach((xVal: any, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = firstData.z?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: layout.xaxis?.type === 'date' ? new Date(xVal) : xVal,\n y: layout.yaxis?.type === 'date' ? new Date(yVal) : yVal,\n value: zVal,\n });\n\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n });\n });\n const heatmapData: IHeatMapChartData = {\n legend: firstData.name || '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Convert normalized values to actual values\n const domainValuesForColorScale: number[] = firstData.colorscale?.map((arr: any) => arr[0] * (zMax - zMin) + zMin);\n const rangeValuesForColorScale: string[] = firstData.colorscale?.map((arr: any) => arr[1]);\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): ISankeyChartProps => {\n const { data, layout } = jsonObj;\n const { link, node } = data[0];\n const validLinks = link.value\n .map((val: number, index: number) => ({\n value: val,\n source: link.source[index],\n target: link.target[index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n //@ts-expect-error Dynamic link object. Ignore for now.\n .filter(x => x.source !== x.target); // Filter out self-references (circular links)\n\n const sankeyChartData = {\n nodes: node.label.map((label: string, index: number) => {\n const color = getColor(label, colorMap);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n };\n\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const styles: ISankeyChartProps['styles'] = {\n root: {\n fontSize: layout.font?.size,\n },\n };\n const shouldResize: number = width + height;\n return {\n data: {\n chartTitle: layout?.title,\n SankeyChartData: sankeyChartData,\n },\n width,\n height,\n styles,\n shouldResize,\n enableReflow: true,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n): IGaugeChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const segments = firstData.gauge?.steps?.map((step: any, index: number): IGaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n });\n\n let sublabel: string | undefined;\n let sublabelColor: string | undefined;\n if (typeof firstData.delta?.reference === 'number') {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n const color = getColor(firstData.delta.increasing?.color || '', colorMap);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const color = getColor(firstData.delta.decreasing?.color || '', colorMap);\n sublabelColor = color;\n }\n }\n\n const styles: IGaugeChartProps['styles'] = {\n sublabel: {\n fill: sublabelColor,\n },\n };\n\n return {\n segments,\n chartValue: firstData.value,\n chartTitle: firstData.title?.text,\n sublabel,\n // range values can be null\n minValue: firstData.gauge?.axis?.range?.[0] ?? undefined,\n maxValue: firstData.gauge?.axis?.range?.[1] ?? undefined,\n chartValueFormat: () => firstData.value,\n width: layout?.width,\n height: layout?.height,\n hideLegend: true,\n styles,\n };\n};\n\nfunction isTypedArray(a: any) {\n return ArrayBuffer.isView(a) && !(a instanceof DataView);\n}\n\nfunction isArrayOrTypedArray(a: any) {\n return Array.isArray(a) || isTypedArray(a);\n}\n\nfunction isPlainObject(obj: any) {\n if (window && window.process && window.process.versions) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n for (const attribute of arrayAttributes) {\n console.log(attribute);\n }\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { __assign } from "tslib";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { CustomPoints, Points } from '../../utilities/utilities';
|
|
4
|
+
import { CustomPoints, getSecureProps, Points } from '../../utilities/utilities';
|
|
5
5
|
var pointPath = (_a = {},
|
|
6
6
|
_a["".concat(Points[Points.circle])] = 'M1 6 A5 5 0 1 0 12 6 M1 6 A5 5 0 0 1 12 6',
|
|
7
7
|
_a["".concat(Points[Points.square])] = 'M1 1 L12 1 L12 12 L1 12 L1 1 Z',
|
|
@@ -18,7 +18,7 @@ export var Shape = function (_a) {
|
|
|
18
18
|
if (Object.keys(pointPath).indexOf(shape) === -1) {
|
|
19
19
|
return React.createElement("div", { className: classNameForNonSvg });
|
|
20
20
|
}
|
|
21
|
-
return (React.createElement("svg", __assign({ width: 14, height: 14, viewBox: '-1 -1 14 14' }, svgProps, { transform: "rotate(".concat(shape === Points[Points.diamond] ? 45 : shape === Points[Points.pyramid] ? 180 : 0, ", 0, 0)") }),
|
|
22
|
-
React.createElement("path", __assign({ d: pointPath[shape] }, pathProps))));
|
|
21
|
+
return (React.createElement("svg", __assign({ width: 14, height: 14, viewBox: '-1 -1 14 14' }, getSecureProps(svgProps), { transform: "rotate(".concat(shape === Points[Points.diamond] ? 45 : shape === Points[Points.pyramid] ? 180 : 0, ", 0, 0)") }),
|
|
22
|
+
React.createElement("path", __assign({ d: pointPath[shape] }, getSecureProps(pathProps)))));
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=shape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape.js","sourceRoot":"../src/","sources":["components/Legends/shape.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"../src/","sources":["components/Legends/shape.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAajF,IAAM,SAAS;IACb,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAE,IAAG,6CAA6C;IAC3E,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAE,IAAG,iCAAiC;IAC/D,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAE,IAAG,2CAA2C;IAC3E,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAE,IAAG,2CAA2C;IAC1E,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAE,IAAG,iCAAiC;IAChE,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAE,IAAG,6BAA6B;IAC5D,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAE,IAAG,+DAA+D;IAC/F,GAAC,UAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAE,IAC1B,uFAAuF;IACzF,GAAC,UAAG,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,CAAE,IAAG,2BAA2B;OAC1E,CAAC;AAEF,MAAM,CAAC,IAAM,KAAK,GAA0B,UAAC,EAAkD;QAAhD,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,KAAK,WAAA,EAAE,kBAAkB,wBAAA;IAC3F,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;QAChD,OAAO,6BAAK,SAAS,EAAE,kBAAkB,GAAI,CAAC;KAC/C;IACD,OAAO,CACL,sCACE,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,OAAO,EAAE,aAAa,IAClB,cAAc,CAAC,QAAQ,CAAC,IAC5B,SAAS,EAAE,iBAAU,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAS;QAEhH,uCAAM,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,IAAM,cAAc,CAAC,SAAS,CAAC,EAAI,CACxD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { LegendShape } from './Legends.types';\nimport { CustomPoints, getSecureProps, Points } from '../../utilities/utilities';\n\nexport interface IShapeProps {\n svgProps: React.SVGAttributes<SVGElement>;\n pathProps: React.SVGAttributes<SVGPathElement>;\n shape: LegendShape;\n classNameForNonSvg?: string;\n}\n\ntype PointPathType = {\n [key: string]: string;\n};\n\nconst pointPath: PointPathType = {\n [`${Points[Points.circle]}`]: 'M1 6 A5 5 0 1 0 12 6 M1 6 A5 5 0 0 1 12 6',\n [`${Points[Points.square]}`]: 'M1 1 L12 1 L12 12 L1 12 L1 1 Z',\n [`${Points[Points.triangle]}`]: 'M6 10L8.74228e-07 -1.04907e-06L12 0L6 10Z',\n [`${Points[Points.pyramid]}`]: 'M6 10L8.74228e-07 -1.04907e-06L12 0L6 10Z',\n [`${Points[Points.diamond]}`]: 'M2 2 L10 2 L10 10 L2 10 L2 2 Z',\n [`${Points[Points.hexagon]}`]: 'M9 0H3L0 5L3 10H9L12 5L9 0Z',\n [`${Points[Points.pentagon]}`]: 'M6.06061 0L0 4.21277L2.30303 11H9.69697L12 4.21277L6.06061 0Z',\n [`${Points[Points.octagon]}`]:\n 'M7.08333 0H2.91667L0 2.91667V7.08333L2.91667 10H7.08333L10 7.08333V2.91667L7.08333 0Z',\n [`${CustomPoints[CustomPoints.dottedLine]}`]: 'M0 6 H3 M5 6 H8 M10 6 H13',\n};\n\nexport const Shape: React.FC<IShapeProps> = ({ svgProps, pathProps, shape, classNameForNonSvg }) => {\n if (Object.keys(pointPath).indexOf(shape) === -1) {\n return <div className={classNameForNonSvg} />;\n }\n return (\n <svg\n width={14}\n height={14}\n viewBox={'-1 -1 14 14'}\n {...getSecureProps(svgProps)}\n transform={`rotate(${shape === Points[Points.diamond] ? 45 : shape === Points[Points.pyramid] ? 180 : 0}, 0, 0)`}\n >\n <path d={pointPath[shape]} {...getSecureProps(pathProps)} />\n </svg>\n );\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { select } from 'd3-selection';
|
|
4
|
+
import { getSecureProps } from '../../../utilities/utilities';
|
|
4
5
|
export var Textbox = function (props) {
|
|
5
6
|
var textElementRef = React.useRef(null);
|
|
6
7
|
var wrapWords = function () {
|
|
@@ -32,6 +33,6 @@ export var Textbox = function (props) {
|
|
|
32
33
|
};
|
|
33
34
|
React.useEffect(wrapWords);
|
|
34
35
|
var lineHeight = props.lineHeight, rest = __rest(props, ["lineHeight"]);
|
|
35
|
-
return React.createElement("text", __assign({ ref: textElementRef }, rest));
|
|
36
|
+
return React.createElement("text", __assign({ ref: textElementRef }, getSecureProps(rest)));
|
|
36
37
|
};
|
|
37
38
|
//# sourceMappingURL=Textbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textbox.js","sourceRoot":"../src/","sources":["components/LineChart/eventAnnotation/Textbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Textbox.js","sourceRoot":"../src/","sources":["components/LineChart/eventAnnotation/Textbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAa9D,MAAM,CAAC,IAAM,OAAO,GAA2C,UAAA,KAAK;IAClE,IAAM,cAAc,GAAoC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE3E,IAAM,SAAS,GAAG;QAChB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YAC3B,OAAO;SACR;QACD,IAAM,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,IAAI,GAAa,EAAE,CAAC;QACxB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAkB,OAAO,CAAC,CAAC;QAClD,IAAI,QAAQ,GAAG,CAAC,CAAC;QAEjB,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;YAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAC1B,IAAI,IAAI,IAAI,IAAI,CAAC,qBAAqB,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzE,QAAQ,EAAE,CAAC;gBACX,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;gBACd,KAAK,GAAG,IAAI,CAAC,MAAM,CAAkB,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;aAC1G;QACH,CAAC,CAAC,CAAC;QACH,qBAAqB;QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QAE9C,OAAO;YACL,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAEnB,IAAA,UAAU,GAAc,KAAK,WAAnB,EAAK,IAAI,UAAK,KAAK,EAA/B,cAAuB,CAAF,CAAW;IAEtC,OAAO,uCAAM,GAAG,EAAE,cAAc,IAAM,cAAc,CAAC,IAAI,CAAC,EAAI,CAAC;AACjE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { select } from 'd3-selection';\nimport { getSecureProps } from '../../../utilities/utilities';\n\ninterface ITextboxProps {\n text: string;\n width: number;\n x: number;\n y: number;\n lineHeight: number;\n textAnchor?: 'start' | 'middle' | 'end';\n fontSize?: string;\n fill?: string;\n}\n\nexport const Textbox: React.FunctionComponent<ITextboxProps> = props => {\n const textElementRef: React.RefObject<SVGTextElement> = React.useRef(null);\n\n const wrapWords = () => {\n if (!textElementRef.current) {\n return;\n }\n const text = select(textElementRef.current);\n const words = props.text.split(/\\s+/);\n let line: string[] = [];\n let tspan = text.append<SVGTSpanElement>('tspan');\n let numLines = 0;\n\n words.forEach(word => {\n line.push(word);\n tspan.text(line.join(' '));\n const node = tspan.node();\n if (node && node.getComputedTextLength() > props.width && line.length > 1) {\n numLines++;\n line.pop();\n tspan.text(line.join(' '));\n line = [word];\n tspan = text.append<SVGTSpanElement>('tspan').text(word).attr('dy', props.lineHeight).attr('x', props.x);\n }\n });\n // bottom aligns text\n text.attr('dy', -numLines * props.lineHeight);\n\n return () => {\n text.selectAll('tspan').remove();\n };\n };\n React.useEffect(wrapWords);\n\n const { lineHeight, ...rest } = props;\n\n return <text ref={textElementRef} {...getSecureProps(rest)} />;\n};\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -37,4 +37,6 @@ export { DataVizPalette, getColorFromToken, getNextColor } from './utilities/col
|
|
|
37
37
|
export { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';
|
|
38
38
|
export type { IGaugeChartProps, IGaugeChartSegment, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart';
|
|
39
39
|
export { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';
|
|
40
|
+
export type { DeclarativeChartProps, Schema } from './DeclarativeChart';
|
|
41
|
+
export { DeclarativeChart } from './DeclarativeChart';
|
|
40
42
|
import './version';
|
package/lib/index.js
CHANGED
|
@@ -18,5 +18,6 @@ export { HorizontalBarChartWithAxis } from './HorizontalBarChartWithAxis';
|
|
|
18
18
|
export { DataVizPalette, getColorFromToken, getNextColor } from './utilities/colors';
|
|
19
19
|
export { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';
|
|
20
20
|
export { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';
|
|
21
|
+
export { DeclarativeChart } from './DeclarativeChart';
|
|
21
22
|
import './version';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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AAgB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,WAAW,CAAC","sourcesContent":["export type {\n ChartDataMode,\n IHorizontalBarChartProps,\n IHorizontalBarChartStyleProps,\n IHorizontalBarChartStyles,\n} from './HorizontalBarChart';\nexport { HorizontalBarChart, HorizontalBarChartVariant } from './HorizontalBarChart';\nexport type { IDonutChart, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './DonutChart';\nexport { DonutChart } from './DonutChart';\nexport type {\n ILegend,\n ILegendOverflowData,\n ILegendStyleProps,\n ILegendSubComponentStyles,\n ILegendsProps,\n ILegendsStyles,\n IShapeProps,\n LegendShape,\n} from './Legends';\nexport { Legends, Shape } from './Legends';\nexport type {\n IColorFillBarData,\n IColorFillBarsProps,\n IEventsAnnotationProps,\n ILineChartProps,\n ILineChartStyleProps,\n ILineChartStyles,\n} from './LineChart';\nexport { LineChart, Textbox } from './LineChart';\nexport type { IAreaChartProps, IAreaChartStyleProps, IAreaChartStyles } from './AreaChart';\nexport { AreaChart } from './AreaChart';\nexport type { IPieChart, IPieChartProps, IPieChartStyleProps, IPieChartStyles } from './PieChart';\nexport { PieChart } from './PieChart';\nexport type {\n IMultiStackedBarChartProps,\n IMultiStackedBarChartStyleProps,\n IMultiStackedBarChartStyles,\n IStackedBarChart,\n IStackedBarChartProps,\n IStackedBarChartStyleProps,\n IStackedBarChartStyles,\n} from './StackedBarChart';\nexport { MultiStackedBarChart, MultiStackedBarChartVariant, StackedBarChart } from './StackedBarChart';\nexport type { IVerticalBarChartProps, IVerticalBarChartStyleProps, IVerticalBarChartStyles } from './VerticalBarChart';\nexport { VerticalBarChart } from './VerticalBarChart';\nexport type {\n IVerticalStackedBarChartProps,\n IVerticalStackedBarChartStyleProps,\n IVerticalStackedBarChartStyles,\n} from './VerticalStackedBarChart';\nexport { VerticalStackedBarChart } from './VerticalStackedBarChart';\nexport type {\n IGroupedVerticalBarChartProps,\n IGroupedVerticalBarChartStyleProps,\n IGroupedVerticalBarChartStyles,\n} from './GroupedVerticalBarChart';\nexport { GroupedVerticalBarChart } from './GroupedVerticalBarChart';\nexport type {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n IModifiedCartesianChartProps,\n IYValueHover,\n} from './CartesianChart';\nexport { CartesianChart } from './CartesianChart';\nexport type {\n IAccessibilityProps,\n IBasestate,\n IChartDataPoint,\n IChartProps,\n ICustomizedCalloutData,\n ICustomizedCalloutDataPoint,\n IDataPoint,\n IGVBarChartSeriesPoint,\n IGVDataPoint,\n IGVForBarChart,\n IGVSingleDataPoint,\n IGroupedVerticalBarChartData,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IHorizontalBarChartWithAxisDataPoint,\n IHorizontalDataPoint,\n ILegendDataItem,\n ILineChartDataPoint,\n ILineChartGap,\n ILineChartLineOptions,\n ILineChartPoints,\n ILineDataInVerticalBarChart,\n ILineDataInVerticalStackedBarChart,\n IMargins,\n IRefArrayData,\n ISankeyChartData,\n IVSChartDataPoint,\n IVerticalBarChartDataPoint,\n IVerticalStackedBarDataPoint,\n IVerticalStackedChartProps,\n SLink,\n SNode,\n} from './types/index';\nexport type {\n IChartHoverCardProps,\n IChartHoverCardStyleProps,\n IChartHoverCardStyles,\n} from './utilities/ChartHoverCard/index';\nexport { ChartHoverCard, getChartHoverCardStyles } from './utilities/ChartHoverCard/index';\nexport type { IHeatMapChartProps, IHeatMapChartStyleProps, IHeatMapChartStyles } from './HeatMapChart';\nexport { HeatMapChart } from './HeatMapChart';\nexport type {\n ISankeyChartAccessibilityProps,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart';\nexport { SankeyChart } from './SankeyChart';\nexport type {\n ITreeChartDataPoint,\n ITreeDataStructure,\n ITreeProps,\n ITreeState,\n ITreeStyleProps,\n ITreeStyles,\n} from './TreeChart';\nexport { NodesComposition, TreeChart, TreeTraverse } from './TreeChart';\nexport type { ISparklineProps, ISparklineStyleProps, ISparklineStyles } from './Sparkline';\nexport { Sparkline } from './Sparkline';\nexport type {\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n} from './HorizontalBarChartWithAxis';\nexport { HorizontalBarChartWithAxis } from './HorizontalBarChartWithAxis';\nexport { DataVizPalette, getColorFromToken, getNextColor } from './utilities/colors';\nexport { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';\nexport type { IGaugeChartProps, IGaugeChartSegment, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart';\nexport { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';\n\nimport './version';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAS3C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AASpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwClD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEtG,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,WAAW,CAAC","sourcesContent":["export type {\n ChartDataMode,\n IHorizontalBarChartProps,\n IHorizontalBarChartStyleProps,\n IHorizontalBarChartStyles,\n} from './HorizontalBarChart';\nexport { HorizontalBarChart, HorizontalBarChartVariant } from './HorizontalBarChart';\nexport type { IDonutChart, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './DonutChart';\nexport { DonutChart } from './DonutChart';\nexport type {\n ILegend,\n ILegendOverflowData,\n ILegendStyleProps,\n ILegendSubComponentStyles,\n ILegendsProps,\n ILegendsStyles,\n IShapeProps,\n LegendShape,\n} from './Legends';\nexport { Legends, Shape } from './Legends';\nexport type {\n IColorFillBarData,\n IColorFillBarsProps,\n IEventsAnnotationProps,\n ILineChartProps,\n ILineChartStyleProps,\n ILineChartStyles,\n} from './LineChart';\nexport { LineChart, Textbox } from './LineChart';\nexport type { IAreaChartProps, IAreaChartStyleProps, IAreaChartStyles } from './AreaChart';\nexport { AreaChart } from './AreaChart';\nexport type { IPieChart, IPieChartProps, IPieChartStyleProps, IPieChartStyles } from './PieChart';\nexport { PieChart } from './PieChart';\nexport type {\n IMultiStackedBarChartProps,\n IMultiStackedBarChartStyleProps,\n IMultiStackedBarChartStyles,\n IStackedBarChart,\n IStackedBarChartProps,\n IStackedBarChartStyleProps,\n IStackedBarChartStyles,\n} from './StackedBarChart';\nexport { MultiStackedBarChart, MultiStackedBarChartVariant, StackedBarChart } from './StackedBarChart';\nexport type { IVerticalBarChartProps, IVerticalBarChartStyleProps, IVerticalBarChartStyles } from './VerticalBarChart';\nexport { VerticalBarChart } from './VerticalBarChart';\nexport type {\n IVerticalStackedBarChartProps,\n IVerticalStackedBarChartStyleProps,\n IVerticalStackedBarChartStyles,\n} from './VerticalStackedBarChart';\nexport { VerticalStackedBarChart } from './VerticalStackedBarChart';\nexport type {\n IGroupedVerticalBarChartProps,\n IGroupedVerticalBarChartStyleProps,\n IGroupedVerticalBarChartStyles,\n} from './GroupedVerticalBarChart';\nexport { GroupedVerticalBarChart } from './GroupedVerticalBarChart';\nexport type {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n IModifiedCartesianChartProps,\n IYValueHover,\n} from './CartesianChart';\nexport { CartesianChart } from './CartesianChart';\nexport type {\n IAccessibilityProps,\n IBasestate,\n IChartDataPoint,\n IChartProps,\n ICustomizedCalloutData,\n ICustomizedCalloutDataPoint,\n IDataPoint,\n IGVBarChartSeriesPoint,\n IGVDataPoint,\n IGVForBarChart,\n IGVSingleDataPoint,\n IGroupedVerticalBarChartData,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IHorizontalBarChartWithAxisDataPoint,\n IHorizontalDataPoint,\n ILegendDataItem,\n ILineChartDataPoint,\n ILineChartGap,\n ILineChartLineOptions,\n ILineChartPoints,\n ILineDataInVerticalBarChart,\n ILineDataInVerticalStackedBarChart,\n IMargins,\n IRefArrayData,\n ISankeyChartData,\n IVSChartDataPoint,\n IVerticalBarChartDataPoint,\n IVerticalStackedBarDataPoint,\n IVerticalStackedChartProps,\n SLink,\n SNode,\n} from './types/index';\nexport type {\n IChartHoverCardProps,\n IChartHoverCardStyleProps,\n IChartHoverCardStyles,\n} from './utilities/ChartHoverCard/index';\nexport { ChartHoverCard, getChartHoverCardStyles } from './utilities/ChartHoverCard/index';\nexport type { IHeatMapChartProps, IHeatMapChartStyleProps, IHeatMapChartStyles } from './HeatMapChart';\nexport { HeatMapChart } from './HeatMapChart';\nexport type {\n ISankeyChartAccessibilityProps,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart';\nexport { SankeyChart } from './SankeyChart';\nexport type {\n ITreeChartDataPoint,\n ITreeDataStructure,\n ITreeProps,\n ITreeState,\n ITreeStyleProps,\n ITreeStyles,\n} from './TreeChart';\nexport { NodesComposition, TreeChart, TreeTraverse } from './TreeChart';\nexport type { ISparklineProps, ISparklineStyleProps, ISparklineStyles } from './Sparkline';\nexport { Sparkline } from './Sparkline';\nexport type {\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n} from './HorizontalBarChartWithAxis';\nexport { HorizontalBarChartWithAxis } from './HorizontalBarChartWithAxis';\nexport { DataVizPalette, getColorFromToken, getNextColor } from './utilities/colors';\nexport { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';\nexport type { IGaugeChartProps, IGaugeChartSegment, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart';\nexport { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';\nexport type { DeclarativeChartProps, Schema } from './DeclarativeChart';\nexport { DeclarativeChart } from './DeclarativeChart';\n\nimport './version';\n"]}
|
|
@@ -408,4 +408,5 @@ export declare const getBarWidth: (barWidthProp: number | 'default' | 'auto' | u
|
|
|
408
408
|
export declare const getScalePadding: (prop: number | undefined, shorthandProp?: number, defaultValue?: number) => number;
|
|
409
409
|
export declare const isScalePaddingDefined: (prop: number | undefined, shorthandProp?: number) => boolean;
|
|
410
410
|
export declare const formatDate: (date: Date, useUTC?: boolean) => string;
|
|
411
|
+
export declare function getSecureProps(props?: Record<string, any>): Record<string, any>;
|
|
411
412
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { __assign, __spreadArray } from "tslib";
|
|
2
|
+
import { __assign, __rest, __spreadArray } from "tslib";
|
|
3
3
|
import { axisRight as d3AxisRight, axisBottom as d3AxisBottom, axisLeft as d3AxisLeft } from 'd3-axis';
|
|
4
4
|
import { max as d3Max, min as d3Min } from 'd3-array';
|
|
5
5
|
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime, } from 'd3-scale';
|
|
@@ -1049,4 +1049,10 @@ export var formatDate = function (date, useUTC) {
|
|
|
1049
1049
|
var timeFormat = useUTC ? d3UtcFormat : d3TimeFormat;
|
|
1050
1050
|
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1051
1051
|
};
|
|
1052
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1053
|
+
export function getSecureProps(props) {
|
|
1054
|
+
if (props === void 0) { props = {}; }
|
|
1055
|
+
var dangerouslySetInnerHTML = props.dangerouslySetInnerHTML, result = __rest(props, ["dangerouslySetInnerHTML"]);
|
|
1056
|
+
return result;
|
|
1057
|
+
}
|
|
1052
1058
|
//# sourceMappingURL=utilities.js.map
|