@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
|
@@ -7,6 +7,7 @@ import { findNumericMinMaxOfY } from '../../utilities/utilities';
|
|
|
7
7
|
import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isYearArray, } from '@fluentui/chart-utilities';
|
|
8
8
|
import { timeParse } from 'd3-time-format';
|
|
9
9
|
import { curveCardinal as d3CurveCardinal } from 'd3-shape';
|
|
10
|
+
import { color as d3Color } from 'd3-color';
|
|
10
11
|
var dashOptions = {
|
|
11
12
|
dot: {
|
|
12
13
|
strokeDasharray: '1, 5',
|
|
@@ -139,13 +140,56 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
|
|
|
139
140
|
},
|
|
140
141
|
};
|
|
141
142
|
};
|
|
142
|
-
export var
|
|
143
|
-
var
|
|
143
|
+
export var getSchemaColors = function (colors, colorMap, isDarkTheme) {
|
|
144
|
+
var hexColors = [];
|
|
145
|
+
if (!colors) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
if (isArrayOrTypedArray(colors)) {
|
|
149
|
+
colors.forEach(function (element, index) {
|
|
150
|
+
var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
|
|
151
|
+
var nextFluentColor = getColor("Label_".concat(index), colorMap, isDarkTheme);
|
|
152
|
+
if (colorString) {
|
|
153
|
+
var parsedColor = d3Color(colorString);
|
|
154
|
+
hexColors.push(parsedColor ? parsedColor.formatHex() : nextFluentColor);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
hexColors.push(nextFluentColor);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
else if (typeof colors === 'string') {
|
|
162
|
+
var parsedColor = d3Color(colors);
|
|
163
|
+
return parsedColor ? parsedColor.formatHex() : getColor('Label_0', colorMap, isDarkTheme);
|
|
164
|
+
}
|
|
165
|
+
return hexColors;
|
|
166
|
+
};
|
|
167
|
+
export var _extractColor = function (useFluentVizColorPalette, colors, colorMap, isDarkTheme) {
|
|
168
|
+
return !useFluentVizColorPalette && colors ? getSchemaColors(colors, colorMap, isDarkTheme) : undefined;
|
|
169
|
+
};
|
|
170
|
+
export var _resolveColor = function (extractedColors, index, legend, colorMap, isDarkTheme) {
|
|
171
|
+
var color = '';
|
|
172
|
+
if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors[index]) {
|
|
173
|
+
color = extractedColors[index % extractedColors.length];
|
|
174
|
+
}
|
|
175
|
+
else if (typeof extractedColors === 'string') {
|
|
176
|
+
color = extractedColors;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
color = getColor(legend, colorMap, isDarkTheme);
|
|
180
|
+
}
|
|
181
|
+
return color;
|
|
182
|
+
};
|
|
183
|
+
export var transformPlotlyJsonToDonutProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
144
185
|
var firstData = input.data[0];
|
|
186
|
+
// extract colors for each series only once
|
|
187
|
+
var colors = _extractColor(useFluentVizColorPalette, (_a = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _a === void 0 ? void 0 : _a.colors, colorMap, isDarkTheme);
|
|
145
188
|
var mapLegendToDataPoint = {};
|
|
146
|
-
(
|
|
189
|
+
(_b = firstData.labels) === null || _b === void 0 ? void 0 : _b.forEach(function (label, index) {
|
|
147
190
|
var _a;
|
|
148
|
-
|
|
191
|
+
// resolve color for each legend from the extracted colors
|
|
192
|
+
var color = _resolveColor(colors, index, label, colorMap, isDarkTheme);
|
|
149
193
|
//ToDo how to handle string data?
|
|
150
194
|
var value = typeof ((_a = firstData.values) === null || _a === void 0 ? void 0 : _a[index]) === 'number' ? firstData.values[index] : 1;
|
|
151
195
|
if (!mapLegendToDataPoint[label]) {
|
|
@@ -159,8 +203,8 @@ export var transformPlotlyJsonToDonutProps = function (input, colorMap, isDarkTh
|
|
|
159
203
|
mapLegendToDataPoint[label].data += value;
|
|
160
204
|
}
|
|
161
205
|
});
|
|
162
|
-
var width = (
|
|
163
|
-
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;
|
|
164
208
|
var hideLabels = firstData.textinfo
|
|
165
209
|
? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
|
|
166
210
|
: false;
|
|
@@ -175,32 +219,37 @@ export var transformPlotlyJsonToDonutProps = function (input, colorMap, isDarkTh
|
|
|
175
219
|
chartTitle: chartTitle,
|
|
176
220
|
chartData: Object.values(mapLegendToDataPoint),
|
|
177
221
|
},
|
|
178
|
-
hideLegend: ((
|
|
179
|
-
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,
|
|
180
224
|
height: height,
|
|
181
225
|
innerRadius: innerRadius,
|
|
182
226
|
hideLabels: hideLabels,
|
|
183
227
|
showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
|
|
184
228
|
};
|
|
185
229
|
};
|
|
186
|
-
export var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkTheme, fallbackVSBC) {
|
|
230
|
+
export var transformPlotlyJsonToVSBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme, fallbackVSBC) {
|
|
187
231
|
var _a, _b, _c;
|
|
188
232
|
var mapXToDataPoints = {};
|
|
189
233
|
var yMaxValue = 0;
|
|
190
234
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
191
235
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
192
236
|
input.data.forEach(function (series, index1) {
|
|
193
|
-
var _a;
|
|
237
|
+
var _a, _b, _c;
|
|
194
238
|
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
195
|
-
|
|
239
|
+
// extract bar colors for each series only once
|
|
240
|
+
var extractedBarColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
241
|
+
// extract line colors for each series only once
|
|
242
|
+
var extractedLineColors = _extractColor(useFluentVizColorPalette, (_b = series.line) === null || _b === void 0 ? void 0 : _b.color, colorMap, isDarkTheme);
|
|
243
|
+
(_c = series.x) === null || _c === void 0 ? void 0 : _c.forEach(function (x, index2) {
|
|
196
244
|
var _a, _b, _c;
|
|
197
245
|
if (!mapXToDataPoints[x]) {
|
|
198
246
|
mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };
|
|
199
247
|
}
|
|
200
248
|
var legend = legends[index1];
|
|
249
|
+
// resolve color for each legend's bars from the extracted colors
|
|
250
|
+
var color = _resolveColor(extractedBarColors, index1, legend, colorMap, isDarkTheme);
|
|
201
251
|
var yVal = (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[index2]) !== null && _b !== void 0 ? _b : 0;
|
|
202
252
|
if (series.type === 'bar') {
|
|
203
|
-
var color = getColor(legend, colorMap, isDarkTheme);
|
|
204
253
|
mapXToDataPoints[x].chartData.push({
|
|
205
254
|
legend: legend,
|
|
206
255
|
data: yVal,
|
|
@@ -209,11 +258,11 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkThe
|
|
|
209
258
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
210
259
|
}
|
|
211
260
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
212
|
-
var
|
|
261
|
+
var lineColor = _resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
213
262
|
var lineOptions = getLineOptions(series.line);
|
|
214
263
|
var dashType = ((_c = series.line) === null || _c === void 0 ? void 0 : _c.dash) || 'solid';
|
|
215
264
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
216
|
-
mapXToDataPoints[x].lineData.push(__assign(__assign({ legend: legend, legendShape: legendShape, y: yVal, color:
|
|
265
|
+
mapXToDataPoints[x].lineData.push(__assign(__assign({ legend: legend, legendShape: legendShape, y: yVal, color: lineColor }, (lineOptions ? { lineOptions: lineOptions } : {})), { useSecondaryYScale: usesSecondaryYScale(series) }));
|
|
217
266
|
if (!usesSecondaryYScale(series)) {
|
|
218
267
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
219
268
|
}
|
|
@@ -223,21 +272,24 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, isDarkThe
|
|
|
223
272
|
var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
|
|
224
273
|
return __assign(__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 });
|
|
225
274
|
};
|
|
226
|
-
export var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkTheme) {
|
|
275
|
+
export var transformPlotlyJsonToGVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
227
276
|
var _a, _b, _c;
|
|
228
277
|
var mapXToDataPoints = {};
|
|
229
278
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
230
279
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
231
280
|
input.data.forEach(function (series, index1) {
|
|
232
|
-
var _a;
|
|
233
|
-
|
|
281
|
+
var _a, _b;
|
|
282
|
+
// extract colors for each series only once
|
|
283
|
+
var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
284
|
+
(_b = series.x) === null || _b === void 0 ? void 0 : _b.forEach(function (x, xIndex) {
|
|
234
285
|
var _a, _b;
|
|
235
286
|
if (!mapXToDataPoints[x]) {
|
|
236
287
|
mapXToDataPoints[x] = { name: x.toString(), series: [] };
|
|
237
288
|
}
|
|
238
289
|
if (series.type === 'bar') {
|
|
239
290
|
var legend = legends[index1];
|
|
240
|
-
|
|
291
|
+
// resolve color for each legend's bars from the extracted colors
|
|
292
|
+
var color = _resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
241
293
|
mapXToDataPoints[x].series.push({
|
|
242
294
|
key: legend,
|
|
243
295
|
data: (_b = (_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex]) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -252,19 +304,21 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, isDarkThe
|
|
|
252
304
|
var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
|
|
253
305
|
return __assign(__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
306
|
};
|
|
255
|
-
export var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkTheme) {
|
|
307
|
+
export var transformPlotlyJsonToVBCProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
256
308
|
var _a, _b, _c;
|
|
257
309
|
var vbcData = [];
|
|
258
310
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
259
311
|
input.data.forEach(function (series, seriesIdx) {
|
|
260
|
-
var _a, _b, _c;
|
|
312
|
+
var _a, _b, _c, _d;
|
|
261
313
|
if (!series.x) {
|
|
262
314
|
return;
|
|
263
315
|
}
|
|
316
|
+
// extract colors for each series only once
|
|
317
|
+
var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
264
318
|
var isXString = isStringArray(series.x);
|
|
265
319
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
266
320
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
267
|
-
var xBins = createBins(series.x, (
|
|
321
|
+
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);
|
|
268
322
|
var yBins = xBins.map(function () { return []; });
|
|
269
323
|
var total = 0;
|
|
270
324
|
series.x.forEach(function (xVal, index) {
|
|
@@ -281,7 +335,8 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkThem
|
|
|
281
335
|
});
|
|
282
336
|
xBins.forEach(function (bin, index) {
|
|
283
337
|
var legend = legends[seriesIdx];
|
|
284
|
-
|
|
338
|
+
// resolve color for each legend's bars from the extracted colors
|
|
339
|
+
var color = _resolveColor(extractedColors, seriesIdx, legend, colorMap, isDarkTheme);
|
|
285
340
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
286
341
|
vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
|
|
287
342
|
? {}
|
|
@@ -303,22 +358,25 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, isDarkThem
|
|
|
303
358
|
hideLegend: hideLegend,
|
|
304
359
|
};
|
|
305
360
|
};
|
|
306
|
-
export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, isDarkTheme) {
|
|
361
|
+
export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
307
362
|
var _a, _b, _c, _d, _e, _f;
|
|
308
363
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
309
364
|
var mode = 'tonexty';
|
|
310
365
|
var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
311
366
|
var chartData = input.data.map(function (series, index) {
|
|
312
|
-
var _a;
|
|
367
|
+
var _a, _b;
|
|
368
|
+
// extract colors for each series only once
|
|
369
|
+
var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.line) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
313
370
|
var xValues = series.x;
|
|
314
371
|
var isString = typeof xValues[0] === 'string';
|
|
315
372
|
var isXDate = isDateArray(xValues);
|
|
316
373
|
var isXNumber = isNumberArray(xValues);
|
|
317
374
|
var legend = legends[index];
|
|
318
|
-
|
|
375
|
+
// resolve color for each legend's lines from the extracted colors
|
|
376
|
+
var lineColor = _resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
319
377
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
320
378
|
var lineOptions = getLineOptions(series.line);
|
|
321
|
-
var dashType = ((
|
|
379
|
+
var dashType = ((_b = series.line) === null || _b === void 0 ? void 0 : _b.dash) || 'solid';
|
|
322
380
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
323
381
|
return __assign(__assign({ legend: legend, legendShape: legendShape, data: xValues.map(function (x, i) {
|
|
324
382
|
var _a, _b;
|
|
@@ -342,13 +400,17 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
|
|
|
342
400
|
return __assign(__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false });
|
|
343
401
|
}
|
|
344
402
|
};
|
|
345
|
-
export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, isDarkTheme) {
|
|
403
|
+
export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, useFluentVizColorPalette, isDarkTheme) {
|
|
346
404
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
347
405
|
var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
|
|
348
406
|
var chartData = input.data
|
|
349
407
|
.map(function (series, index) {
|
|
408
|
+
var _a;
|
|
409
|
+
// extract colors for each series only once
|
|
410
|
+
var extractedColors = _extractColor(useFluentVizColorPalette, (_a = series.marker) === null || _a === void 0 ? void 0 : _a.color, colorMap, isDarkTheme);
|
|
350
411
|
var legend = legends[index];
|
|
351
|
-
|
|
412
|
+
// resolve color for each legend's bars from the extracted colors
|
|
413
|
+
var color = _resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
352
414
|
return series.y.map(function (yValue, i) {
|
|
353
415
|
return {
|
|
354
416
|
x: series.x[i],
|
|
@@ -388,6 +450,8 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, co
|
|
|
388
450
|
width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
|
|
389
451
|
hideTickOverlap: true,
|
|
390
452
|
hideLegend: hideLegend,
|
|
453
|
+
noOfCharsToTruncate: 20,
|
|
454
|
+
showYAxisLablesTooltip: true,
|
|
391
455
|
};
|
|
392
456
|
};
|
|
393
457
|
export var transformPlotlyJsonToHeatmapProps = function (input) {
|
|
@@ -485,6 +549,8 @@ export var transformPlotlyJsonToHeatmapProps = function (input) {
|
|
|
485
549
|
width: (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width,
|
|
486
550
|
height: (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.height) !== null && _m !== void 0 ? _m : 350,
|
|
487
551
|
hideTickOverlap: true,
|
|
552
|
+
noOfCharsToTruncate: 20,
|
|
553
|
+
showYAxisLablesTooltip: true,
|
|
488
554
|
};
|
|
489
555
|
};
|
|
490
556
|
export var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkTheme) {
|
|
@@ -496,7 +562,6 @@ export var transformPlotlyJsonToSankeyProps = function (input, colorMap, isDarkT
|
|
|
496
562
|
source: link === null || link === void 0 ? void 0 : link.source[index],
|
|
497
563
|
target: link === null || link === void 0 ? void 0 : link.target[index],
|
|
498
564
|
}); })
|
|
499
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
500
565
|
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
501
566
|
.filter(function (x) { return x.source >= 0 && x.target >= 0 && x.source !== x.target; });
|
|
502
567
|
var sankeyChartData = {
|
|
@@ -785,7 +850,7 @@ var getLegendProps = function (data, layout) {
|
|
|
785
850
|
var hideLegends = data.every(function (series) { return series.showlegend === false; });
|
|
786
851
|
return {
|
|
787
852
|
legends: legends,
|
|
788
|
-
hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false ? true : hideLegends,
|
|
853
|
+
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,
|
|
789
854
|
};
|
|
790
855
|
};
|
|
791
856
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|