@fluentui/react-charting 5.24.0 → 5.24.2
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 +43 -1
- package/CHANGELOG.md +22 -2
- package/dist/react-charting.d.ts +5 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +3 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +113 -42
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +23 -17
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.styles.js +9 -0
- package/lib/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.d.ts +2 -0
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +4 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +115 -43
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +23 -17
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.styles.js +9 -1
- package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -0
- package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +4 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +115 -43
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +23 -17
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.styles.js +9 -0
- package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +4 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LineChart/LineChart.types.ts +4 -1
|
@@ -1015,6 +1015,7 @@ export interface ILineChartDataPoint {
|
|
|
1015
1015
|
hideCallout?: boolean;
|
|
1016
1016
|
markerSize?: number;
|
|
1017
1017
|
onDataPointClick?: () => void;
|
|
1018
|
+
text?: string;
|
|
1018
1019
|
x: number | Date;
|
|
1019
1020
|
xAxisCalloutAccessibilityData?: IAccessibilityProps;
|
|
1020
1021
|
xAxisCalloutData?: string;
|
|
@@ -1082,6 +1083,8 @@ export interface ILineChartStyleProps extends ICartesianChartStyleProps {
|
|
|
1082
1083
|
|
|
1083
1084
|
// @public
|
|
1084
1085
|
export interface ILineChartStyles extends ICartesianChartStyles {
|
|
1086
|
+
// (undocumented)
|
|
1087
|
+
markerLabel?: IStyle;
|
|
1085
1088
|
}
|
|
1086
1089
|
|
|
1087
1090
|
// @public (undocumented)
|
|
@@ -15,6 +15,7 @@ import type { ColorwayType } from './PlotlyColorAdapter';
|
|
|
15
15
|
export declare const isMonthArray: (data: Datum[] | Datum[][] | TypedArray) => boolean;
|
|
16
16
|
export declare const correctYearMonth: (xValues: Datum[] | Datum[][] | TypedArray) => any[];
|
|
17
17
|
export declare const _getGaugeAxisColor: (colorway: string[] | undefined, colorwayType: ColorwayType, color: Color | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
|
|
18
|
+
export declare const resolveXAxisPoint: (x: Datum, isXYearCategory: boolean, isXString: boolean, isXDate: boolean, isXNumber: boolean) => string | Date | number;
|
|
18
19
|
export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
|
|
19
20
|
export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
|
|
20
21
|
export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
|
|
@@ -150,6 +150,25 @@ export var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMa
|
|
|
150
150
|
var extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
151
151
|
return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
|
|
152
152
|
};
|
|
153
|
+
export var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
|
|
154
|
+
if (x === null || x === undefined) {
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
if (isXYearCategory) {
|
|
158
|
+
return x.toString();
|
|
159
|
+
}
|
|
160
|
+
if (isXString) {
|
|
161
|
+
if (isXDate) {
|
|
162
|
+
var date = new Date(x);
|
|
163
|
+
return date;
|
|
164
|
+
}
|
|
165
|
+
if (isXNumber) {
|
|
166
|
+
return parseFloat(x);
|
|
167
|
+
}
|
|
168
|
+
return x;
|
|
169
|
+
}
|
|
170
|
+
return x;
|
|
171
|
+
};
|
|
153
172
|
export var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
154
173
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
155
174
|
var firstData = input.data[0];
|
|
@@ -209,26 +228,45 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
|
|
|
209
228
|
var yMinValue = 0;
|
|
210
229
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
211
230
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
231
|
+
var colorScale = undefined;
|
|
212
232
|
input.data.forEach(function (series, index1) {
|
|
213
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
233
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
234
|
+
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
235
|
+
isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
236
|
+
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
237
|
+
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
238
|
+
colorScale = createColorScale(input.layout, series);
|
|
239
|
+
}
|
|
214
240
|
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
215
241
|
// extract bar colors for each series only once
|
|
216
|
-
var extractedBarColors = extractColor((
|
|
242
|
+
var extractedBarColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
|
|
217
243
|
// extract line colors for each series only once
|
|
218
|
-
var extractedLineColors = extractColor((
|
|
244
|
+
var extractedLineColors = extractColor((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, (_q = series.line) === null || _q === void 0 ? void 0 : _q.color, colorMap, isDarkTheme);
|
|
245
|
+
var xValues = series.x;
|
|
246
|
+
var isXDate = isDateArray(xValues);
|
|
247
|
+
var isXString = isStringArray(xValues);
|
|
248
|
+
var isXNumber = isNumberArray(xValues);
|
|
219
249
|
var validXYRanges = getValidXYRanges(series);
|
|
220
250
|
validXYRanges.forEach(function (_a, rangeIdx) {
|
|
221
251
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
222
252
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
223
253
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
224
254
|
rangeXValues.forEach(function (x, index2) {
|
|
225
|
-
var _a, _b;
|
|
255
|
+
var _a, _b, _c, _d, _e, _f;
|
|
226
256
|
if (!mapXToDataPoints[x]) {
|
|
227
|
-
mapXToDataPoints[x] = {
|
|
257
|
+
mapXToDataPoints[x] = {
|
|
258
|
+
xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
259
|
+
chartData: [],
|
|
260
|
+
lineData: [],
|
|
261
|
+
};
|
|
228
262
|
}
|
|
229
263
|
var legend = legends[index1];
|
|
230
|
-
// resolve color for each legend's bars from the extracted colors
|
|
231
|
-
var color =
|
|
264
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
265
|
+
var color = colorScale
|
|
266
|
+
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
267
|
+
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
268
|
+
: 0)
|
|
269
|
+
: resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
232
270
|
var yVal = rangeYValues[index2];
|
|
233
271
|
if (series.type === 'bar') {
|
|
234
272
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -243,10 +281,10 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
|
|
|
243
281
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
244
282
|
var lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
245
283
|
var lineOptions = getLineOptions(series.line);
|
|
246
|
-
var dashType = ((
|
|
284
|
+
var dashType = ((_e = series.line) === null || _e === void 0 ? void 0 : _e.dash) || 'solid';
|
|
247
285
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
|
|
248
286
|
? 'dottedLine'
|
|
249
|
-
: ((
|
|
287
|
+
: ((_f = series.mode) === null || _f === void 0 ? void 0 : _f.includes('markers'))
|
|
250
288
|
? 'circle'
|
|
251
289
|
: 'default';
|
|
252
290
|
mapXToDataPoints[x].lineData.push({
|
|
@@ -268,14 +306,20 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
|
|
|
268
306
|
var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
|
|
269
307
|
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, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true });
|
|
270
308
|
};
|
|
271
|
-
var createColorScale = function (
|
|
272
|
-
var
|
|
309
|
+
var createColorScale = function (layout, series) {
|
|
310
|
+
var _a, _b, _c, _d, _e, _f;
|
|
311
|
+
var scale = (_a = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _a === void 0 ? void 0 : _a.colorscale;
|
|
312
|
+
var colorValues = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color;
|
|
313
|
+
var _g = [
|
|
314
|
+
(_d = (_c = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _c === void 0 ? void 0 : _c.cmin) !== null && _d !== void 0 ? _d : Math.min.apply(Math, colorValues),
|
|
315
|
+
(_f = (_e = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _e === void 0 ? void 0 : _e.cmax) !== null && _f !== void 0 ? _f : Math.max.apply(Math, colorValues),
|
|
316
|
+
], dMin = _g[0], dMax = _g[1];
|
|
273
317
|
// Normalize colorscale domain to actual data domain
|
|
274
|
-
var scaleDomain =
|
|
318
|
+
var scaleDomain = scale.map(function (_a) {
|
|
275
319
|
var pos = _a[0];
|
|
276
320
|
return dMin + pos * (dMax - dMin);
|
|
277
321
|
});
|
|
278
|
-
var scaleColors =
|
|
322
|
+
var scaleColors = scale.map(function (item) { return item[1]; });
|
|
279
323
|
return d3ScaleLinear().domain(scaleDomain).range(scaleColors);
|
|
280
324
|
};
|
|
281
325
|
export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -285,23 +329,17 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayT
|
|
|
285
329
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
286
330
|
var colorScale = undefined;
|
|
287
331
|
input.data.forEach(function (series, index1) {
|
|
288
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
332
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
289
333
|
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
290
334
|
isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
291
335
|
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
292
336
|
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
293
|
-
|
|
294
|
-
var colorValues = (_h = series.marker) === null || _h === void 0 ? void 0 : _h.color;
|
|
295
|
-
var _t = [
|
|
296
|
-
(_k = (_j = input.layout.coloraxis) === null || _j === void 0 ? void 0 : _j.cmin) !== null && _k !== void 0 ? _k : Math.min.apply(Math, colorValues),
|
|
297
|
-
(_m = (_l = input.layout.coloraxis) === null || _l === void 0 ? void 0 : _l.cmax) !== null && _m !== void 0 ? _m : Math.max.apply(Math, colorValues),
|
|
298
|
-
], dMin = _t[0], dMax = _t[1];
|
|
299
|
-
colorScale = createColorScale(scale, [dMin, dMax]);
|
|
337
|
+
colorScale = createColorScale(input.layout, series);
|
|
300
338
|
}
|
|
301
339
|
// extract colors for each series only once
|
|
302
|
-
var extractedColors = extractColor((
|
|
303
|
-
(
|
|
304
|
-
var _a, _b, _c, _d;
|
|
340
|
+
var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
|
|
341
|
+
(_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
|
|
342
|
+
var _a, _b, _c, _d, _e;
|
|
305
343
|
if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
306
344
|
return;
|
|
307
345
|
}
|
|
@@ -312,7 +350,9 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayT
|
|
|
312
350
|
var legend = legends[index1];
|
|
313
351
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
314
352
|
var color = colorScale
|
|
315
|
-
? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
353
|
+
? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
354
|
+
? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
|
|
355
|
+
: 0)
|
|
316
356
|
: resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
317
357
|
mapXToDataPoints[x].series.push({
|
|
318
358
|
key: legend,
|
|
@@ -332,13 +372,20 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
|
|
|
332
372
|
var _a, _b, _c;
|
|
333
373
|
var vbcData = [];
|
|
334
374
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
375
|
+
var colorScale = undefined;
|
|
335
376
|
input.data.forEach(function (series, seriesIdx) {
|
|
336
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
377
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
337
378
|
if (!series.x) {
|
|
338
379
|
return;
|
|
339
380
|
}
|
|
381
|
+
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
382
|
+
isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
383
|
+
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
384
|
+
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
385
|
+
colorScale = createColorScale(input.layout, series);
|
|
386
|
+
}
|
|
340
387
|
// extract colors for each series only once
|
|
341
|
-
var extractedColors = extractColor((
|
|
388
|
+
var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
|
|
342
389
|
var xValues = [];
|
|
343
390
|
var yValues = [];
|
|
344
391
|
series.x.forEach(function (xVal, index) {
|
|
@@ -352,7 +399,7 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
|
|
|
352
399
|
var isXString = isStringArray(xValues);
|
|
353
400
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
354
401
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
355
|
-
var xBins = createBins(xValues, (
|
|
402
|
+
var xBins = createBins(xValues, (_m = series.xbins) === null || _m === void 0 ? void 0 : _m.start, (_o = series.xbins) === null || _o === void 0 ? void 0 : _o.end, (_p = series.xbins) === null || _p === void 0 ? void 0 : _p.size);
|
|
356
403
|
var yBins = xBins.map(function () { return []; });
|
|
357
404
|
var total = 0;
|
|
358
405
|
xValues.forEach(function (xVal, index) {
|
|
@@ -367,9 +414,14 @@ export var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayTy
|
|
|
367
414
|
return yVal;
|
|
368
415
|
});
|
|
369
416
|
xBins.forEach(function (bin, index) {
|
|
417
|
+
var _a, _b, _c, _d;
|
|
370
418
|
var legend = legends[seriesIdx];
|
|
371
|
-
// resolve color for each legend's bars from the extracted colors
|
|
372
|
-
var color =
|
|
419
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
420
|
+
var color = colorScale
|
|
421
|
+
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
422
|
+
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
423
|
+
: 0)
|
|
424
|
+
: resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
373
425
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
374
426
|
vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
|
|
375
427
|
? {}
|
|
@@ -399,22 +451,29 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
|
|
|
399
451
|
var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
|
|
400
452
|
var chartData = input.data
|
|
401
453
|
.map(function (series, index) {
|
|
402
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
454
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
455
|
+
var colors = isScatterMarkers
|
|
456
|
+
? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
|
|
457
|
+
? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
|
|
458
|
+
: (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color
|
|
459
|
+
: (_d = series.line) === null || _d === void 0 ? void 0 : _d.color;
|
|
403
460
|
// extract colors for each series only once
|
|
404
|
-
var extractedColors = extractColor((
|
|
461
|
+
var extractedColors = 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, colors, colorMap, isDarkTheme);
|
|
405
462
|
var xValues = series.x;
|
|
406
|
-
var
|
|
463
|
+
var isXString = isStringArray(xValues);
|
|
407
464
|
var isXDate = isDateArray(xValues);
|
|
408
465
|
var isXNumber = isNumberArray(xValues);
|
|
466
|
+
// string case is not possible for scatter chart as it is already filtered out in declarative chart
|
|
467
|
+
var isXYearCategory = false;
|
|
409
468
|
var legend = legends[index];
|
|
410
469
|
// resolve color for each legend's lines from the extracted colors
|
|
411
470
|
var seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
412
471
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
413
472
|
var lineOptions = getLineOptions(series.line);
|
|
414
|
-
var dashType = ((
|
|
473
|
+
var dashType = ((_h = series.line) === null || _h === void 0 ? void 0 : _h.dash) || 'solid';
|
|
415
474
|
var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
|
|
416
475
|
? 'dottedLine'
|
|
417
|
-
: ((
|
|
476
|
+
: ((_j = series.mode) === null || _j === void 0 ? void 0 : _j.includes('markers'))
|
|
418
477
|
? 'circle'
|
|
419
478
|
: 'default';
|
|
420
479
|
var validXYRanges = getValidXYRanges(series);
|
|
@@ -426,16 +485,17 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
|
|
|
426
485
|
var markerSizes = isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size)
|
|
427
486
|
? series.marker.size.slice(rangeStart, rangeEnd)
|
|
428
487
|
: [];
|
|
488
|
+
var textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
|
|
429
489
|
return {
|
|
430
490
|
legend: legend,
|
|
431
491
|
legendShape: legendShape,
|
|
432
492
|
data: rangeXValues.map(function (x, i) {
|
|
433
493
|
var _a, _b;
|
|
434
|
-
return (__assign({ x:
|
|
494
|
+
return (__assign(__assign({ x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
435
495
|
? { markerSize: markerSizes[i] }
|
|
436
496
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
437
497
|
? { markerSize: series.marker.size }
|
|
438
|
-
: {})));
|
|
498
|
+
: {})), (textValues ? { text: textValues[i] } : {})));
|
|
439
499
|
}),
|
|
440
500
|
color: seriesColor,
|
|
441
501
|
lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
@@ -461,20 +521,31 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart
|
|
|
461
521
|
export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
462
522
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
463
523
|
var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
|
|
524
|
+
var colorScale = undefined;
|
|
464
525
|
var chartData = input.data
|
|
465
526
|
.map(function (series, index) {
|
|
466
|
-
var _a, _b, _c, _d;
|
|
527
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
528
|
+
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
529
|
+
isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
530
|
+
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
531
|
+
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
532
|
+
colorScale = createColorScale(input.layout, series);
|
|
533
|
+
}
|
|
467
534
|
// extract colors for each series only once
|
|
468
|
-
var extractedColors = extractColor((
|
|
535
|
+
var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
|
|
469
536
|
var legend = legends[index];
|
|
470
|
-
// resolve color for each legend's bars from the extracted colors
|
|
471
|
-
var color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
472
537
|
return series.y
|
|
473
538
|
.map(function (yValue, i) {
|
|
474
|
-
var _a;
|
|
539
|
+
var _a, _b, _c, _d, _e;
|
|
475
540
|
if (isInvalidValue((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || isInvalidValue(yValue)) {
|
|
476
541
|
return null;
|
|
477
542
|
}
|
|
543
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
544
|
+
var color = colorScale
|
|
545
|
+
? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
546
|
+
? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
|
|
547
|
+
: 0)
|
|
548
|
+
: resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
478
549
|
return {
|
|
479
550
|
x: series.x[i],
|
|
480
551
|
y: yValue,
|