@fluentui/react-charting 5.23.86 → 5.23.88
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 +67 -1
- package/CHANGELOG.md +26 -2
- package/dist/react-charting.d.ts +13 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +2 -0
- package/lib/components/AreaChart/AreaChart.base.js +3 -3
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +51 -20
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +8 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +11 -7
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -7
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +95 -30
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +3 -3
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +5 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +0 -2
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +0 -67
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +1 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +3 -3
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +7 -7
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +3 -3
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +4 -5
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.d.ts +2 -1
- package/lib/utilities/utilities.js +12 -5
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js +2 -2
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +50 -20
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +8 -0
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +11 -7
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -7
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +99 -32
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +2 -2
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +5 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +0 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +1 -67
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +2 -3
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +2 -2
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +6 -6
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +2 -2
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/utilities/SVGTooltipText.js +5 -5
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +2 -1
- package/lib-amd/utilities/utilities.js +15 -7
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +50 -19
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +8 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +11 -7
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +10 -7
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +99 -31
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +2 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +5 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +0 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +0 -67
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +1 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +2 -2
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +6 -6
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +2 -2
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +4 -5
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +2 -1
- package/lib-commonjs/utilities/utilities.js +16 -8
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +5 -5
- package/src/components/HeatMapChart/HeatMapChart.types.ts +6 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "d3-color"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, d3_color_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getColor = exports.correctYearMonth = exports.isMonthArray = void 0;
|
|
4
|
+
exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports._resolveColor = exports._extractColor = exports.getSchemaColors = exports.getColor = exports.correctYearMonth = exports.isMonthArray = void 0;
|
|
5
5
|
var dashOptions = {
|
|
6
6
|
dot: {
|
|
7
7
|
strokeDasharray: '1, 5',
|
|
@@ -137,13 +137,59 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
137
137
|
},
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
|
-
var
|
|
141
|
-
var
|
|
140
|
+
var getSchemaColors = function (colors, colorMap, isDarkTheme) {
|
|
141
|
+
var hexColors = [];
|
|
142
|
+
if (!colors) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
if ((0, chart_utilities_1.isArrayOrTypedArray)(colors)) {
|
|
146
|
+
colors.forEach(function (element, index) {
|
|
147
|
+
var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
|
|
148
|
+
var nextFluentColor = (0, exports.getColor)("Label_".concat(index), colorMap, isDarkTheme);
|
|
149
|
+
if (colorString) {
|
|
150
|
+
var parsedColor = (0, d3_color_1.color)(colorString);
|
|
151
|
+
hexColors.push(parsedColor ? parsedColor.formatHex() : nextFluentColor);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
hexColors.push(nextFluentColor);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
else if (typeof colors === 'string') {
|
|
159
|
+
var parsedColor = (0, d3_color_1.color)(colors);
|
|
160
|
+
return parsedColor ? parsedColor.formatHex() : (0, exports.getColor)('Label_0', colorMap, isDarkTheme);
|
|
161
|
+
}
|
|
162
|
+
return hexColors;
|
|
163
|
+
};
|
|
164
|
+
exports.getSchemaColors = getSchemaColors;
|
|
165
|
+
var _extractColor = function (useFluentVizColorPalette, colors, colorMap, isDarkTheme) {
|
|
166
|
+
return !useFluentVizColorPalette && colors ? (0, exports.getSchemaColors)(colors, colorMap, isDarkTheme) : undefined;
|
|
167
|
+
};
|
|
168
|
+
exports._extractColor = _extractColor;
|
|
169
|
+
var _resolveColor = function (extractedColors, index, legend, colorMap, isDarkTheme) {
|
|
170
|
+
var color = '';
|
|
171
|
+
if (extractedColors && (0, chart_utilities_1.isArrayOrTypedArray)(extractedColors) && extractedColors[index]) {
|
|
172
|
+
color = extractedColors[index % extractedColors.length];
|
|
173
|
+
}
|
|
174
|
+
else if (typeof extractedColors === 'string') {
|
|
175
|
+
color = extractedColors;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
179
|
+
}
|
|
180
|
+
return color;
|
|
181
|
+
};
|
|
182
|
+
exports._resolveColor = _resolveColor;
|
|
183
|
+
var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
142
185
|
var firstData = input.data[0];
|
|
186
|
+
// extract colors for each series only once
|
|
187
|
+
var colors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _a === void 0 ? void 0 : _a.colors, colorMap, isDarkTheme);
|
|
143
188
|
var mapLegendToDataPoint = {};
|
|
144
|
-
(
|
|
189
|
+
(_b = firstData.labels) === null || _b === void 0 ? void 0 : _b.forEach(function (label, index) {
|
|
145
190
|
var _a;
|
|
146
|
-
|
|
191
|
+
// resolve color for each legend from the extracted colors
|
|
192
|
+
var color = (0, exports._resolveColor)(colors, index, label, colorMap, isDarkTheme);
|
|
147
193
|
//ToDo how to handle string data?
|
|
148
194
|
var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
|
|
149
195
|
if (!mapLegendToDataPoint[label]) {
|
|
@@ -157,8 +203,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
157
203
|
mapLegendToDataPoint[label].data += value;
|
|
158
204
|
}
|
|
159
205
|
});
|
|
160
|
-
var width = (
|
|
161
|
-
var height = (
|
|
206
|
+
var width = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 440;
|
|
207
|
+
var height = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 220;
|
|
162
208
|
var hideLabels = firstData.textinfo
|
|
163
209
|
? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
|
|
164
210
|
: false;
|
|
@@ -173,8 +219,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
173
219
|
chartTitle: chartTitle,
|
|
174
220
|
chartData: Object.values(mapLegendToDataPoint),
|
|
175
221
|
},
|
|
176
|
-
hideLegend: ((
|
|
177
|
-
width: (
|
|
222
|
+
hideLegend: ((_g = input.layout) === null || _g === void 0 ? void 0 : _g.showlegend) === false ? true : false,
|
|
223
|
+
width: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.width,
|
|
178
224
|
height: height,
|
|
179
225
|
innerRadius: innerRadius,
|
|
180
226
|
hideLabels: hideLabels,
|
|
@@ -182,24 +228,29 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
182
228
|
};
|
|
183
229
|
};
|
|
184
230
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
185
|
-
var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fallbackVSBC) {
|
|
231
|
+
var transformPlotlyJsonToVSBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme, fallbackVSBC) {
|
|
186
232
|
var _a, _b, _c;
|
|
187
233
|
var mapXToDataPoints = {};
|
|
188
234
|
var yMaxValue = 0;
|
|
189
235
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
190
236
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
191
237
|
input.data.forEach(function (series, index1) {
|
|
192
|
-
var _a;
|
|
238
|
+
var _a, _b, _c;
|
|
193
239
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
194
|
-
|
|
240
|
+
// extract bar colors for each series only once
|
|
241
|
+
var extractedBarColors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
242
|
+
// extract line colors for each series only once
|
|
243
|
+
var extractedLineColors = (0, exports._extractColor)(useFluentVizColorPalette, (_b = series.line) === null || _b === void 0 ? void 0 : _b.color, colorMap, isDarkTheme);
|
|
244
|
+
(_c = series.x) === null || _c === void 0 ? void 0 : _c.forEach(function (x, index2) {
|
|
195
245
|
var _a, _b, _c;
|
|
196
246
|
if (!mapXToDataPoints[x]) {
|
|
197
247
|
mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
|
|
198
248
|
}
|
|
199
249
|
var legend = legends[index1];
|
|
250
|
+
// resolve color for each legend's bars from the extracted colors
|
|
251
|
+
var color = (0, exports._resolveColor)(extractedBarColors, index1, legend, colorMap, isDarkTheme);
|
|
200
252
|
var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
|
|
201
253
|
if (series.type === 'bar') {
|
|
202
|
-
var color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
|
|
203
254
|
mapXToDataPoints[x].chartData.push({
|
|
204
255
|
legend: legend,
|
|
205
256
|
data: yVal,
|
|
@@ -208,11 +259,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
208
259
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
209
260
|
}
|
|
210
261
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
211
|
-
var
|
|
262
|
+
var lineColor = (0, exports._resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
212
263
|
var lineOptions = getLineOptions(series.line);
|
|
213
264
|
var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
|
|
214
265
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
215
|
-
mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color:
|
|
266
|
+
mapXToDataPoints[x].lineData.push(tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, y: yVal, color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
|
|
216
267
|
if (!usesSecondaryYScale(series)) {
|
|
217
268
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
218
269
|
}
|
|
@@ -223,21 +274,24 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
223
274
|
return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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, barWidth: 'auto', yMaxValue: yMaxValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend });
|
|
224
275
|
};
|
|
225
276
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
226
|
-
var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
|
|
277
|
+
var transformPlotlyJsonToGVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
227
278
|
var _a, _b, _c;
|
|
228
279
|
var mapXToDataPoints = {};
|
|
229
280
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
230
281
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
231
282
|
input.data.forEach(function (series, index1) {
|
|
232
|
-
var _a;
|
|
233
|
-
|
|
283
|
+
var _a, _b;
|
|
284
|
+
// extract colors for each series only once
|
|
285
|
+
var extractedColors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
286
|
+
(_b = series.x) === null || _b === void 0 ? void 0 : _b.forEach(function (x, xIndex) {
|
|
234
287
|
var _a, _b;
|
|
235
288
|
if (!mapXToDataPoints[x]) {
|
|
236
289
|
mapXToDataPoints[x] = { name: x.toString(), series: [] };
|
|
237
290
|
}
|
|
238
291
|
if (series.type === 'bar') {
|
|
239
292
|
var legend = legends[index1];
|
|
240
|
-
|
|
293
|
+
// resolve color for each legend's bars from the extracted colors
|
|
294
|
+
var color = (0, exports._resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
241
295
|
mapXToDataPoints[x].series.push({
|
|
242
296
|
key: legend,
|
|
243
297
|
data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -253,19 +307,21 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
253
307
|
return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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, barwidth: 'auto', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend });
|
|
254
308
|
};
|
|
255
309
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
256
|
-
var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
|
|
310
|
+
var transformPlotlyJsonToVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
257
311
|
var _a, _b, _c;
|
|
258
312
|
var vbcData = [];
|
|
259
313
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
260
314
|
input.data.forEach(function (series, seriesIdx) {
|
|
261
|
-
var _a, _b, _c;
|
|
315
|
+
var _a, _b, _c, _d;
|
|
262
316
|
if (!series.x) {
|
|
263
317
|
return;
|
|
264
318
|
}
|
|
319
|
+
// extract colors for each series only once
|
|
320
|
+
var extractedColors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
265
321
|
var isXString = isStringArray(series.x);
|
|
266
322
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
267
323
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
268
|
-
var xBins = createBins(series.x, (
|
|
324
|
+
var xBins = createBins(series.x, (_b = series.xbins) === null || _b === void 0 ? void 0 : _b.start, (_c = series.xbins) === null || _c === void 0 ? void 0 : _c.end, (_d = series.xbins) === null || _d === void 0 ? void 0 : _d.size);
|
|
269
325
|
var yBins = xBins.map(function () { return []; });
|
|
270
326
|
var total = 0;
|
|
271
327
|
series.x.forEach(function (xVal, index) {
|
|
@@ -282,7 +338,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
282
338
|
});
|
|
283
339
|
xBins.forEach(function (bin, index) {
|
|
284
340
|
var legend = legends[seriesIdx];
|
|
285
|
-
|
|
341
|
+
// resolve color for each legend's bars from the extracted colors
|
|
342
|
+
var color = (0, exports._resolveColor)(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
|
|
286
343
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
287
344
|
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
|
|
288
345
|
? {}
|
|
@@ -305,22 +362,25 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
305
362
|
};
|
|
306
363
|
};
|
|
307
364
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
308
|
-
var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, isDarkTheme) {
|
|
365
|
+
var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
309
366
|
var _a, _b, _c, _d, _e, _f;
|
|
310
367
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
311
368
|
var mode = 'tonexty';
|
|
312
369
|
var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
313
370
|
var chartData = input.data.map(function (series, index) {
|
|
314
|
-
var _a;
|
|
371
|
+
var _a, _b;
|
|
372
|
+
// extract colors for each series only once
|
|
373
|
+
var extractedColors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = series.line) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
315
374
|
var xValues = series.x;
|
|
316
375
|
var isString = typeof xValues[0] === 'string';
|
|
317
376
|
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
318
377
|
var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
|
|
319
378
|
var legend = legends[index];
|
|
320
|
-
|
|
379
|
+
// resolve color for each legend's lines from the extracted colors
|
|
380
|
+
var lineColor = (0, exports._resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
321
381
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
322
382
|
var lineOptions = getLineOptions(series.line);
|
|
323
|
-
var dashType = ((
|
|
383
|
+
var dashType = ((_b = series.line) === null || _b === void 0 ? void 0 : _b.dash) || 'solid';
|
|
324
384
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
325
385
|
return tslib_1.__assign(tslib_1.__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
|
|
326
386
|
var _a, _b;
|
|
@@ -345,13 +405,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
345
405
|
}
|
|
346
406
|
};
|
|
347
407
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
348
|
-
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, isDarkTheme) {
|
|
408
|
+
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
349
409
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
350
410
|
var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
|
|
351
411
|
var chartData = input.data
|
|
352
412
|
.map(function (series, index) {
|
|
413
|
+
var _a;
|
|
414
|
+
// extract colors for each series only once
|
|
415
|
+
var extractedColors = (0, exports._extractColor)(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
353
416
|
var legend = legends[index];
|
|
354
|
-
|
|
417
|
+
// resolve color for each legend's bars from the extracted colors
|
|
418
|
+
var color = (0, exports._resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
355
419
|
return series.y.map(function (yValue, i) {
|
|
356
420
|
return {
|
|
357
421
|
x: series.x[i],
|
|
@@ -391,6 +455,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
391
455
|
width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
|
|
392
456
|
hideTickOverlap: true,
|
|
393
457
|
hideLegend: hideLegend,
|
|
458
|
+
noOfCharsToTruncate: 20,
|
|
459
|
+
showYAxisLablesTooltip: true,
|
|
394
460
|
};
|
|
395
461
|
};
|
|
396
462
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
@@ -489,6 +555,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
489
555
|
width: (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width,
|
|
490
556
|
height: (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.height) !== null && _m !== void 0 ? _m : 350,
|
|
491
557
|
hideTickOverlap: true,
|
|
558
|
+
noOfCharsToTruncate: 20,
|
|
559
|
+
showYAxisLablesTooltip: true,
|
|
492
560
|
};
|
|
493
561
|
};
|
|
494
562
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
@@ -501,7 +569,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
501
569
|
source: link === null || link === void 0 ? void 0 : link.source[index],
|
|
502
570
|
target: link === null || link === void 0 ? void 0 : link.target[index],
|
|
503
571
|
}); })
|
|
504
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
505
572
|
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
506
573
|
.filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
|
|
507
574
|
var sankeyChartData = {
|
|
@@ -794,7 +861,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "../../utilities/
|
|
|
794
861
|
var hideLegends = data.every(function (series) { return series.showlegend === false; });
|
|
795
862
|
return {
|
|
796
863
|
legends: legends,
|
|
797
|
-
hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : hideLegends,
|
|
864
|
+
hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
|
|
798
865
|
};
|
|
799
866
|
};
|
|
800
867
|
});
|