@fluentui/react-charting 5.25.4 → 5.25.5
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 +48 -1
- package/CHANGELOG.md +15 -2
- package/dist/react-charting.d.ts +36 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +8 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +4 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +55 -5
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +1 -1
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.base.js +1 -1
- package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +13 -4
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +19 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +4 -2
- package/lib/utilities/utilities.js +22 -7
- package/lib/utilities/utilities.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/CommonComponents/CartesianChart.types.d.ts +4 -0
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/Pie/Pie.js +4 -2
- package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +13 -4
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +19 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +4 -2
- package/lib-amd/utilities/utilities.js +22 -7
- package/lib-amd/utilities/utilities.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/CommonComponents/CartesianChart.types.d.ts +4 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -61
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +13 -4
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +11 -7
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -5
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +19 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +4 -2
- package/lib-commonjs/utilities/utilities.js +22 -7
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CommonComponents/CartesianChart.types.ts +5 -0
- package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +11 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
|
@@ -81,6 +81,18 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
81
81
|
}
|
|
82
82
|
return {};
|
|
83
83
|
};
|
|
84
|
+
var getXMinMaxValues = function (series, layout) {
|
|
85
|
+
var _a;
|
|
86
|
+
var range = (_a = getXAxisProperties(series, layout)) === null || _a === void 0 ? void 0 : _a.range;
|
|
87
|
+
if (range && range.length === 2) {
|
|
88
|
+
return {
|
|
89
|
+
xMinValue: range[0],
|
|
90
|
+
xMaxValue: range[1],
|
|
91
|
+
showRoundOffXTickValues: false,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {};
|
|
95
|
+
};
|
|
84
96
|
var getYAxisProperties = function (series, layout) {
|
|
85
97
|
return layout === null || layout === void 0 ? void 0 : layout.yaxis;
|
|
86
98
|
};
|
|
@@ -208,6 +220,64 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
208
220
|
return x;
|
|
209
221
|
};
|
|
210
222
|
exports.resolveXAxisPoint = resolveXAxisPoint;
|
|
223
|
+
/**
|
|
224
|
+
* Formats text values according to the texttemplate specification
|
|
225
|
+
* Supports D3 format specifiers within %{text:format} patterns
|
|
226
|
+
* @param textValue The raw text value to format
|
|
227
|
+
* @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
|
|
228
|
+
* @param index Optional index for array-based templates
|
|
229
|
+
* @returns Formatted text string
|
|
230
|
+
*
|
|
231
|
+
* Examples:
|
|
232
|
+
* - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
|
|
233
|
+
* - "%{text:.2%}" → Formats as percentage with 2 decimal places
|
|
234
|
+
* - "%{text:,.0f}" → Formats with thousands separator and no decimals
|
|
235
|
+
* - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
|
|
236
|
+
*/
|
|
237
|
+
var formatTextWithTemplate = function (textValue, textTemplate, index) {
|
|
238
|
+
if (!textTemplate) {
|
|
239
|
+
return String(textValue);
|
|
240
|
+
}
|
|
241
|
+
var numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
|
|
242
|
+
if (isNaN(numVal)) {
|
|
243
|
+
return String(textValue);
|
|
244
|
+
}
|
|
245
|
+
var template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
|
|
246
|
+
// Match Plotly's texttemplate pattern: %{text:format} or %{text}
|
|
247
|
+
// Can be followed by any literal text like %, $, etc.
|
|
248
|
+
var plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
|
|
249
|
+
var match = template.match(plotlyPattern);
|
|
250
|
+
if (match) {
|
|
251
|
+
var formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
|
|
252
|
+
var suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
|
|
253
|
+
// If no format specifier is provided (e.g., %{text}%), try to infer from suffix
|
|
254
|
+
if (!formatSpec) {
|
|
255
|
+
// Check if suffix starts with % - assume simple percentage with 1 decimal
|
|
256
|
+
if (suffix.startsWith('%')) {
|
|
257
|
+
return "".concat(numVal.toFixed(1)).concat(suffix);
|
|
258
|
+
}
|
|
259
|
+
// No format specifier, just return the number with the suffix
|
|
260
|
+
return "".concat(numVal).concat(suffix);
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
// Use D3 format function to apply the format specifier
|
|
264
|
+
var formatter = (0, d3_format_1.format)(formatSpec);
|
|
265
|
+
var formattedValue = formatter(numVal);
|
|
266
|
+
return "".concat(formattedValue).concat(suffix);
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
// Try to extract precision for basic fallback
|
|
270
|
+
var precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
|
|
271
|
+
var precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
|
|
272
|
+
// Check if it's a percentage format
|
|
273
|
+
if (formatSpec.includes('%')) {
|
|
274
|
+
return "".concat((numVal * 100).toFixed(precision), "%").concat(suffix);
|
|
275
|
+
}
|
|
276
|
+
return "".concat(numVal.toFixed(precision)).concat(suffix);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return String(textValue);
|
|
280
|
+
};
|
|
211
281
|
/**
|
|
212
282
|
* Extracts unique X-axis categories from Plotly data traces
|
|
213
283
|
* @param data Array of Plotly data traces
|
|
@@ -976,7 +1046,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
976
1046
|
height: height,
|
|
977
1047
|
innerRadius: innerRadius,
|
|
978
1048
|
hideLabels: hideLabels,
|
|
979
|
-
showLabelsInPercent: firstData.textinfo
|
|
1049
|
+
showLabelsInPercent: firstData.textinfo
|
|
1050
|
+
? ['percent', 'label+percent', 'percent+label'].includes(firstData.textinfo)
|
|
1051
|
+
: true,
|
|
980
1052
|
roundCorners: true,
|
|
981
1053
|
order: 'sorted',
|
|
982
1054
|
};
|
|
@@ -1006,6 +1078,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1006
1078
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
1007
1079
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
1008
1080
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
1081
|
+
var textValues = Array.isArray(series.text)
|
|
1082
|
+
? series.text.slice(rangeStart, rangeEnd)
|
|
1083
|
+
: typeof series.text === 'string'
|
|
1084
|
+
? series.text
|
|
1085
|
+
: undefined;
|
|
1009
1086
|
rangeXValues.forEach(function (x, index2) {
|
|
1010
1087
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1011
1088
|
if (!mapXToDataPoints[x]) {
|
|
@@ -1025,13 +1102,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1025
1102
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
|
|
1026
1103
|
var yVal = rangeYValues[index2];
|
|
1027
1104
|
var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
1105
|
+
var barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
|
|
1106
|
+
// Apply texttemplate formatting if specified
|
|
1107
|
+
if (barLabel && series.texttemplate) {
|
|
1108
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
|
|
1109
|
+
}
|
|
1028
1110
|
if (series.type === 'bar') {
|
|
1029
|
-
mapXToDataPoints[x].chartData.push({
|
|
1030
|
-
legend: legend,
|
|
1031
|
-
data: yVal,
|
|
1032
|
-
color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
|
|
1033
|
-
yAxisCalloutData: yAxisCalloutData,
|
|
1034
|
-
});
|
|
1111
|
+
mapXToDataPoints[x].chartData.push(tslib_1.__assign({ legend: legend, data: yVal, color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color, yAxisCalloutData: yAxisCalloutData }, (barLabel ? { barLabel: String(barLabel) } : {})));
|
|
1035
1112
|
if (typeof yVal === 'number') {
|
|
1036
1113
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
1037
1114
|
}
|
|
@@ -1064,6 +1141,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1064
1141
|
var _a, _b, _c;
|
|
1065
1142
|
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
1066
1143
|
var resolveX = function (val) {
|
|
1144
|
+
if (shape.xref === 'x domain') {
|
|
1145
|
+
if (val === 0) {
|
|
1146
|
+
return xCategories[0];
|
|
1147
|
+
}
|
|
1148
|
+
if (val === 1) {
|
|
1149
|
+
return xCategories[xCategories.length - 1];
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1067
1152
|
if (typeof val === 'number' && Array.isArray(xCategories)) {
|
|
1068
1153
|
if (xCategories[val] !== undefined) {
|
|
1069
1154
|
return xCategories[val];
|
|
@@ -1114,7 +1199,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1114
1199
|
});
|
|
1115
1200
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
1116
1201
|
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1117
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, height: (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_f = vsbcData[0]) === null || _f === void 0 ? void 0 : _f.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1202
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, height: (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.height) !== null && _e !== void 0 ? _e : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundedTicks: true, wrapXAxisLables: typeof ((_f = vsbcData[0]) === null || _f === void 0 ? void 0 : _f.xAxisPoint) === 'string' }), getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1118
1203
|
};
|
|
1119
1204
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
1120
1205
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot,
|
|
@@ -1173,12 +1258,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1173
1258
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors_1, xIndex, legend, colorMap, (_h = (_g = (_f = processedInput.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
|
|
1174
1259
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
|
|
1175
1260
|
var yVal = series.y[xIndex];
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
}
|
|
1261
|
+
// Extract text value for barLabel
|
|
1262
|
+
var barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
|
|
1263
|
+
// Apply texttemplate formatting if specified
|
|
1264
|
+
if (barLabel && series.texttemplate) {
|
|
1265
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
|
|
1266
|
+
}
|
|
1267
|
+
return tslib_1.__assign({ x: x.toString(), y: yVal, yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat), color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color }, (barLabel ? { barLabel: String(barLabel) } : {}));
|
|
1182
1268
|
})
|
|
1183
1269
|
.filter(function (item) { return typeof item !== 'undefined'; }),
|
|
1184
1270
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
|
|
@@ -1216,7 +1302,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1216
1302
|
}
|
|
1217
1303
|
});
|
|
1218
1304
|
var annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
|
|
1219
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ dataV2: gvbcDataV2, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: true, showYAxisLables: true }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1305
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ dataV2: gvbcDataV2, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, roundedTicks: true, wrapXAxisLables: true, showYAxisLables: true }), getXMinMaxValues(processedInput.data[0], processedInput.layout)), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1220
1306
|
};
|
|
1221
1307
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
1222
1308
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot,
|
|
@@ -1273,13 +1359,18 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1273
1359
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
|
|
1274
1360
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
1275
1361
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
1276
|
-
|
|
1362
|
+
// Handle text values and texttemplate formatting for histogram bins
|
|
1363
|
+
var barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
|
|
1364
|
+
if (barLabel && series.texttemplate) {
|
|
1365
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
|
|
1366
|
+
}
|
|
1367
|
+
vbcData.push(tslib_1.__assign(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color }, (isXString
|
|
1277
1368
|
? {}
|
|
1278
|
-
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
|
|
1369
|
+
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })), (barLabel ? { barLabel: String(barLabel) } : {})));
|
|
1279
1370
|
});
|
|
1280
1371
|
});
|
|
1281
1372
|
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1282
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string', showYAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1373
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true, roundedTicks: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string', showYAxisLables: true }, getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1283
1374
|
};
|
|
1284
1375
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
1285
1376
|
var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot,
|
|
@@ -1475,12 +1566,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1475
1566
|
scatterChartData: tslib_1.__spreadArray(tslib_1.__spreadArray([], chartData, true), lineShape, true),
|
|
1476
1567
|
};
|
|
1477
1568
|
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1478
|
-
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width, height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, wrapXAxisLables: shouldWrapLabels, showYAxisLables: true }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1569
|
+
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width, height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, wrapXAxisLables: shouldWrapLabels, showYAxisLables: true, roundedTicks: true }), getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
1479
1570
|
if (isAreaChart) {
|
|
1480
1571
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
1481
1572
|
}
|
|
1482
1573
|
else {
|
|
1483
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps,
|
|
1574
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
1484
1575
|
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart &&
|
|
1485
1576
|
(function () {
|
|
1486
1577
|
var bars = mapColorFillBars(input.layout);
|
|
@@ -1503,7 +1594,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1503
1594
|
var legend = legends[index];
|
|
1504
1595
|
return series.y
|
|
1505
1596
|
.map(function (yValue, i) {
|
|
1506
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1597
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1507
1598
|
if ((0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
1508
1599
|
return null;
|
|
1509
1600
|
}
|
|
@@ -1514,12 +1605,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1514
1605
|
: 0)
|
|
1515
1606
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
|
|
1516
1607
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
1517
|
-
return {
|
|
1518
|
-
x: (0, chart_utilities_1.isInvalidValue)((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i],
|
|
1519
|
-
y: yValue,
|
|
1520
|
-
legend: legend,
|
|
1521
|
-
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
1522
|
-
};
|
|
1608
|
+
return tslib_1.__assign({ x: (0, chart_utilities_1.isInvalidValue)((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i], y: yValue, legend: legend, color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color }, (((_k = series.text) === null || _k === void 0 ? void 0 : _k[i]) ? { barLabel: series.text[i].toString() } : {}));
|
|
1523
1609
|
})
|
|
1524
1610
|
.filter(function (point) { return point !== null; });
|
|
1525
1611
|
})
|
|
@@ -1532,9 +1618,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1532
1618
|
var scalingFactor = 0.01;
|
|
1533
1619
|
var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
1534
1620
|
var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
1535
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
1621
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
1536
1622
|
? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
|
|
1537
|
-
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
|
|
1623
|
+
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, roundedTicks: true }, getXMinMaxValues(input.data[0], input.layout)), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
|
|
1538
1624
|
};
|
|
1539
1625
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
1540
1626
|
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
|
|
@@ -1611,34 +1697,72 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1611
1697
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot,
|
|
1612
1698
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1613
1699
|
colorMap, colorwayType, isDarkTheme) {
|
|
1614
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
1700
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
1615
1701
|
var firstData = input.data[0];
|
|
1616
1702
|
var heatmapDataPoints = [];
|
|
1617
1703
|
var zMin = Number.POSITIVE_INFINITY;
|
|
1618
1704
|
var zMax = Number.NEGATIVE_INFINITY;
|
|
1705
|
+
// Build a 2D array of annotations based on their grid position
|
|
1706
|
+
var annotationGrid = [];
|
|
1707
|
+
var rawAnnotations = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.annotations;
|
|
1708
|
+
if (rawAnnotations) {
|
|
1709
|
+
var annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [rawAnnotations];
|
|
1710
|
+
// Collect all unique x and y values from valid annotations
|
|
1711
|
+
var xSet_1 = new Set();
|
|
1712
|
+
var ySet_1 = new Set();
|
|
1713
|
+
var validAnnotations_1 = [];
|
|
1714
|
+
annotationsArray.forEach(function (a) {
|
|
1715
|
+
if (a &&
|
|
1716
|
+
typeof a.x === 'number' &&
|
|
1717
|
+
typeof a.y === 'number' &&
|
|
1718
|
+
typeof a.text === 'string' &&
|
|
1719
|
+
(a.xref === 'x' || a.xref === undefined) &&
|
|
1720
|
+
(a.yref === 'y' || a.yref === undefined)) {
|
|
1721
|
+
xSet_1.add(a.x);
|
|
1722
|
+
ySet_1.add(a.y);
|
|
1723
|
+
validAnnotations_1.push({ x: a.x, y: a.y, text: cleanText(a.text) });
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
if (validAnnotations_1.length > 0) {
|
|
1727
|
+
// Get sorted unique x and y values
|
|
1728
|
+
var xValues_1 = Array.from(xSet_1).sort(function (a, b) { return a - b; });
|
|
1729
|
+
var yValues_1 = Array.from(ySet_1).sort(function (a, b) { return a - b; });
|
|
1730
|
+
// Initialize 2D grid and populate
|
|
1731
|
+
validAnnotations_1.forEach(function (annotation) {
|
|
1732
|
+
var xIdx = xValues_1.indexOf(annotation.x);
|
|
1733
|
+
var yIdx = yValues_1.indexOf(annotation.y);
|
|
1734
|
+
if (!annotationGrid[yIdx]) {
|
|
1735
|
+
annotationGrid[yIdx] = [];
|
|
1736
|
+
}
|
|
1737
|
+
annotationGrid[yIdx][xIdx] = annotation.text;
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
// Helper function to get annotation from 2D grid by index
|
|
1742
|
+
var getAnnotationByIndex = function (xIdx, yIdx) { var _a; return (_a = annotationGrid[yIdx]) === null || _a === void 0 ? void 0 : _a[xIdx]; };
|
|
1619
1743
|
if (firstData.type === 'histogram2d') {
|
|
1620
|
-
var
|
|
1621
|
-
var
|
|
1744
|
+
var xValues_2 = [];
|
|
1745
|
+
var yValues_2 = [];
|
|
1622
1746
|
var zValues_1 = [];
|
|
1623
|
-
(
|
|
1747
|
+
(_b = firstData.x) === null || _b === void 0 ? void 0 : _b.forEach(function (xVal, index) {
|
|
1624
1748
|
var _a, _b;
|
|
1625
1749
|
var zVal = (_a = (0, exports.getNumberAtIndexOrDefault)(firstData.z, index)) !== null && _a !== void 0 ? _a : 0;
|
|
1626
1750
|
if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)((_b = firstData.y) === null || _b === void 0 ? void 0 : _b[index])) {
|
|
1627
1751
|
return;
|
|
1628
1752
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1753
|
+
xValues_2.push(xVal);
|
|
1754
|
+
yValues_2.push(firstData.y[index]);
|
|
1631
1755
|
zValues_1.push(zVal);
|
|
1632
1756
|
});
|
|
1633
|
-
var isXString_1 = (0, chart_utilities_1.isStringArray)(
|
|
1634
|
-
var isYString_1 = (0, chart_utilities_1.isStringArray)(
|
|
1635
|
-
var xBins_1 = createBins(
|
|
1636
|
-
var yBins_1 = createBins(
|
|
1757
|
+
var isXString_1 = (0, chart_utilities_1.isStringArray)(xValues_2);
|
|
1758
|
+
var isYString_1 = (0, chart_utilities_1.isStringArray)(yValues_2);
|
|
1759
|
+
var xBins_1 = createBins(xValues_2, (_c = firstData.xbins) === null || _c === void 0 ? void 0 : _c.start, (_d = firstData.xbins) === null || _d === void 0 ? void 0 : _d.end, (_e = firstData.xbins) === null || _e === void 0 ? void 0 : _e.size);
|
|
1760
|
+
var yBins_1 = createBins(yValues_2, (_f = firstData.ybins) === null || _f === void 0 ? void 0 : _f.start, (_g = firstData.ybins) === null || _g === void 0 ? void 0 : _g.end, (_h = firstData.ybins) === null || _h === void 0 ? void 0 : _h.size);
|
|
1637
1761
|
var zBins_1 = yBins_1.map(function () { return xBins_1.map(function () { return []; }); });
|
|
1638
1762
|
var total_1 = 0;
|
|
1639
|
-
|
|
1763
|
+
xValues_2.forEach(function (xVal, index) {
|
|
1640
1764
|
var xBinIdx = findBinIndex(xBins_1, xVal, isXString_1);
|
|
1641
|
-
var yBinIdx = findBinIndex(yBins_1,
|
|
1765
|
+
var yBinIdx = findBinIndex(yBins_1, yValues_2[index], isYString_1);
|
|
1642
1766
|
if (xBinIdx !== -1 && yBinIdx !== -1) {
|
|
1643
1767
|
zBins_1[yBinIdx][xBinIdx].push(zValues_1[index]);
|
|
1644
1768
|
}
|
|
@@ -1653,11 +1777,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1653
1777
|
xBins_1.forEach(function (xBin, xIdx) {
|
|
1654
1778
|
yBins_1.forEach(function (yBin, yIdx) {
|
|
1655
1779
|
var zVal = calculateHistNorm(firstData.histnorm, z_1[yIdx][xIdx], total_1, isXString_1 ? xBin.length : getBinSize(xBin), isYString_1 ? yBin.length : getBinSize(yBin));
|
|
1780
|
+
var annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1656
1781
|
heatmapDataPoints.push({
|
|
1657
1782
|
x: isXString_1 ? xBin.join(', ') : getBinCenter(xBin),
|
|
1658
1783
|
y: isYString_1 ? yBin.join(', ') : getBinCenter(yBin),
|
|
1659
1784
|
value: zVal,
|
|
1660
|
-
rectText: zVal,
|
|
1785
|
+
rectText: annotationText || zVal,
|
|
1661
1786
|
});
|
|
1662
1787
|
if (typeof zVal === 'number') {
|
|
1663
1788
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1667,17 +1792,27 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1667
1792
|
});
|
|
1668
1793
|
}
|
|
1669
1794
|
else {
|
|
1670
|
-
|
|
1671
|
-
|
|
1795
|
+
// If x and y are not provided, generate indices based on z dimensions
|
|
1796
|
+
var zArray_1 = firstData.z;
|
|
1797
|
+
var xValues = firstData.x;
|
|
1798
|
+
var yValues = firstData.y;
|
|
1799
|
+
// Determine the dimensions from z array
|
|
1800
|
+
var yLength_1 = (_j = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1.length) !== null && _j !== void 0 ? _j : 0;
|
|
1801
|
+
var xLength = (_l = (_k = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1[0]) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0;
|
|
1802
|
+
// Use provided x/y values or generate indices
|
|
1803
|
+
var xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({ length: xLength }, function (_, i) { return i; });
|
|
1804
|
+
var yData_1 = yValues !== null && yValues !== void 0 ? yValues : Array.from({ length: yLength_1 }, function (_, i) { return yLength_1 - 1 - i; });
|
|
1805
|
+
xData.forEach(function (xVal, xIdx) {
|
|
1672
1806
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1673
|
-
|
|
1674
|
-
var _a, _b, _c, _d, _e
|
|
1675
|
-
var zVal = (
|
|
1807
|
+
yData_1.forEach(function (yVal, yIdx) {
|
|
1808
|
+
var _a, _b, _c, _d, _e;
|
|
1809
|
+
var zVal = (_a = zArray_1 === null || zArray_1 === void 0 ? void 0 : zArray_1[yIdx]) === null || _a === void 0 ? void 0 : _a[xIdx];
|
|
1810
|
+
var annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1676
1811
|
heatmapDataPoints.push({
|
|
1677
|
-
x: ((
|
|
1678
|
-
y: ((
|
|
1812
|
+
x: ((_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.xaxis) === null || _c === void 0 ? void 0 : _c.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
|
|
1813
|
+
y: ((_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.yaxis) === null || _e === void 0 ? void 0 : _e.type) === 'date' ? yVal : yVal,
|
|
1679
1814
|
value: zVal,
|
|
1680
|
-
rectText: zVal,
|
|
1815
|
+
rectText: annotationText || zVal,
|
|
1681
1816
|
});
|
|
1682
1817
|
if (typeof zVal === 'number') {
|
|
1683
1818
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1687,7 +1822,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1687
1822
|
});
|
|
1688
1823
|
}
|
|
1689
1824
|
var heatmapData = {
|
|
1690
|
-
legend: (
|
|
1825
|
+
legend: (_m = firstData.name) !== null && _m !== void 0 ? _m : '',
|
|
1691
1826
|
data: heatmapDataPoints,
|
|
1692
1827
|
value: 0,
|
|
1693
1828
|
};
|
|
@@ -1698,7 +1833,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1698
1833
|
(0, colors_1.getColorFromToken)(colors_1.DataVizPalette.color2),
|
|
1699
1834
|
(0, colors_1.getColorFromToken)(colors_1.DataVizPalette.color3),
|
|
1700
1835
|
];
|
|
1701
|
-
var colorscale = (
|
|
1836
|
+
var colorscale = (_3 = (_x = (_t = (_q = (_o = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _o !== void 0 ? _o : (_p = input.layout) === null || _p === void 0 ? void 0 : _p.colorscale) !== null && _q !== void 0 ? _q : (_s = (_r = input.layout) === null || _r === void 0 ? void 0 : _r.coloraxis) === null || _s === void 0 ? void 0 : _s.colorscale) !== null && _t !== void 0 ? _t : (_w = (_v = (_u = input.layout) === null || _u === void 0 ? void 0 : _u.template) === null || _v === void 0 ? void 0 : _v.layout) === null || _w === void 0 ? void 0 : _w.colorscale) !== null && _x !== void 0 ? _x : (firstData.type === 'histogram2d' && ((_2 = (_1 = (_0 = (_z = (_y = input.layout) === null || _y === void 0 ? void 0 : _y.template) === null || _z === void 0 ? void 0 : _z.data) === null || _0 === void 0 ? void 0 : _0.histogram2d) === null || _1 === void 0 ? void 0 : _1[0]) === null || _2 === void 0 ? void 0 : _2.colorscale))) !== null && _3 !== void 0 ? _3 : (_8 = (_7 = (_6 = (_5 = (_4 = input.layout) === null || _4 === void 0 ? void 0 : _4.template) === null || _5 === void 0 ? void 0 : _5.data) === null || _6 === void 0 ? void 0 : _6.heatmap) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.colorscale;
|
|
1702
1837
|
// determine if the types diverging, sequential or sequentialminus are present in colorscale
|
|
1703
1838
|
if (colorscale &&
|
|
1704
1839
|
typeof colorscale === 'object' &&
|
|
@@ -1722,14 +1857,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1722
1857
|
var rangeValuesForColorScale = Array.isArray(colorscale)
|
|
1723
1858
|
? colorscale.map(function (arr) { return arr[1]; })
|
|
1724
1859
|
: defaultRange;
|
|
1725
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (
|
|
1860
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (_9 = input.layout) === null || _9 === void 0 ? void 0 : _9.width, height: (_11 = (_10 = input.layout) === null || _10 === void 0 ? void 0 : _10.height) !== null && _11 !== void 0 ? _11 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout)), getAxisTickProps(input.data, input.layout));
|
|
1726
1861
|
};
|
|
1727
1862
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
1728
1863
|
var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot,
|
|
1729
1864
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1730
1865
|
colorMap, colorwayType, isDarkTheme) {
|
|
1731
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1732
|
-
var
|
|
1866
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1867
|
+
var _q = input.data[0], link = _q.link, node = _q.node;
|
|
1733
1868
|
var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
|
|
1734
1869
|
.map(function (val, index) {
|
|
1735
1870
|
var _a, _b;
|
|
@@ -1745,8 +1880,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1745
1880
|
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
1746
1881
|
.filter(function (x) { return x !== null && x.source >= 0 && x.target >= 0 && x.source !== x.target; });
|
|
1747
1882
|
var extractedNodeColors = (0, PlotlyColorAdapter_1.extractColor)((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
|
|
1883
|
+
var extractedLinkColors = (0, PlotlyColorAdapter_1.extractColor)((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, link === null || link === void 0 ? void 0 : link.color, colorMap, isDarkTheme);
|
|
1748
1884
|
var sankeyChartData = {
|
|
1749
|
-
nodes: (
|
|
1885
|
+
nodes: (_h = node.label) === null || _h === void 0 ? void 0 : _h.map(function (label, index) {
|
|
1750
1886
|
var _a, _b, _c;
|
|
1751
1887
|
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedNodeColors, index, label, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
|
|
1752
1888
|
return {
|
|
@@ -1757,11 +1893,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1757
1893
|
}),
|
|
1758
1894
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1759
1895
|
links: validLinks.map(function (validLink, index) {
|
|
1760
|
-
|
|
1896
|
+
var _a, _b, _c;
|
|
1897
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedLinkColors, index, validLink.target, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
|
|
1898
|
+
return tslib_1.__assign(tslib_1.__assign({}, validLink), { color: color });
|
|
1761
1899
|
}),
|
|
1762
1900
|
};
|
|
1763
1901
|
var styles = {
|
|
1764
|
-
root: tslib_1.__assign({}, (((
|
|
1902
|
+
root: tslib_1.__assign({}, (((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.font) === null || _k === void 0 ? void 0 : _k.size) ? { fontSize: (_l = input.layout.font) === null || _l === void 0 ? void 0 : _l.size } : {})),
|
|
1765
1903
|
};
|
|
1766
1904
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
1767
1905
|
return {
|
|
@@ -1769,8 +1907,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1769
1907
|
chartTitle: chartTitle,
|
|
1770
1908
|
SankeyChartData: sankeyChartData,
|
|
1771
1909
|
},
|
|
1772
|
-
width: (
|
|
1773
|
-
height: (
|
|
1910
|
+
width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width,
|
|
1911
|
+
height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 468,
|
|
1774
1912
|
styles: styles,
|
|
1775
1913
|
enableReflow: false,
|
|
1776
1914
|
};
|
|
@@ -2504,7 +2642,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
2504
2642
|
return parseInt(normalizedKey, 10) - 1;
|
|
2505
2643
|
};
|
|
2506
2644
|
var isNonPlotType = function (chartType) {
|
|
2507
|
-
return ['donut', 'sankey', 'pie', 'annotation'].includes(chartType);
|
|
2645
|
+
return ['donut', 'sankey', 'pie', 'annotation', 'table', 'gauge', 'funnel'].includes(chartType);
|
|
2508
2646
|
};
|
|
2509
2647
|
exports.isNonPlotType = isNonPlotType;
|
|
2510
2648
|
var getGridProperties = function (schema, isMultiPlot, validTracesInfo) {
|