@fluentui/react-charting 5.24.11 → 5.24.13
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 +61 -1
- package/CHANGELOG.md +25 -2
- package/bundle-size/GanttChart.fixture.js +7 -0
- package/dist/react-charting.d.ts +128 -3
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +44 -2
- package/lib/GanttChart.d.ts +1 -0
- package/lib/GanttChart.js +2 -0
- package/lib/GanttChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +22 -4
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +23 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -63
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib/components/GanttChart/GanttChart.base.js +329 -0
- package/lib/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib/components/GanttChart/GanttChart.js +10 -0
- package/lib/components/GanttChart/GanttChart.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib/components/GanttChart/GanttChart.styles.js +4 -0
- package/lib/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib/components/GanttChart/GanttChart.types.js +2 -0
- package/lib/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib/components/GanttChart/index.d.ts +2 -0
- package/lib/components/GanttChart/index.js +3 -0
- package/lib/components/GanttChart/index.js.map +1 -0
- package/lib/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib/components/LineChart/LineChart.base.js +34 -11
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +37 -23
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +49 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib/utilities/scatterpolar-utils.js +38 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/test-data.d.ts +4 -1
- package/lib/utilities/test-data.js +213 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.d.ts +14 -6
- package/lib/utilities/utilities.js +25 -9
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/GanttChart.d.ts +1 -0
- package/lib-amd/GanttChart.js +6 -0
- package/lib-amd/GanttChart.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -5
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +25 -2
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib-amd/components/GanttChart/GanttChart.base.js +325 -0
- package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib-amd/components/GanttChart/GanttChart.js +12 -0
- package/lib-amd/components/GanttChart/GanttChart.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.js +10 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib-amd/components/GanttChart/GanttChart.types.js +5 -0
- package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib-amd/components/GanttChart/index.d.ts +2 -0
- package/lib-amd/components/GanttChart/index.js +7 -0
- package/lib-amd/components/GanttChart/index.js.map +1 -0
- package/lib-amd/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-amd/components/LineChart/LineChart.base.js +33 -11
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +36 -23
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +3 -1
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +49 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib-amd/utilities/scatterpolar-utils.js +43 -0
- package/lib-amd/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-amd/utilities/test-data.d.ts +4 -1
- package/lib-amd/utilities/test-data.js +214 -2
- package/lib-amd/utilities/test-data.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +14 -6
- package/lib-amd/utilities/utilities.js +27 -9
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/GanttChart.d.ts +1 -0
- package/lib-commonjs/GanttChart.js +5 -0
- package/lib-commonjs/GanttChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -5
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib-commonjs/components/GanttChart/GanttChart.base.js +332 -0
- package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js +13 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.js +8 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js +3 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib-commonjs/components/GanttChart/index.d.ts +2 -0
- package/lib-commonjs/components/GanttChart/index.js +6 -0
- package/lib-commonjs/components/GanttChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.js +33 -10
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +36 -22
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +3 -1
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +49 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js +42 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/test-data.d.ts +4 -1
- package/lib-commonjs/utilities/test-data.js +214 -1
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +14 -6
- package/lib-commonjs/utilities/utilities.js +28 -10
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +5 -2
- package/src/components/GanttChart/GanttChart.types.ts +83 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToFunnelChartProps = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.SINGLE_REPEAT = exports.NON_PLOT_KEY_PREFIX = void 0;
|
|
3
|
+
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToFunnelChartProps = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToGanttChartProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.SINGLE_REPEAT = exports.NON_PLOT_KEY_PREFIX = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var d3_array_1 = require("d3-array");
|
|
6
6
|
var d3_scale_1 = require("d3-scale");
|
|
@@ -272,18 +272,13 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
272
272
|
var colorScale = undefined;
|
|
273
273
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
274
274
|
input.data.forEach(function (series, index1) {
|
|
275
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
276
|
-
|
|
277
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
278
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
279
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
280
|
-
colorScale = createColorScale(input.layout, series);
|
|
281
|
-
}
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
276
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
282
277
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
283
278
|
// extract bar colors for each series only once
|
|
284
|
-
var extractedBarColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
279
|
+
var extractedBarColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
285
280
|
// extract line colors for each series only once
|
|
286
|
-
var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
281
|
+
var extractedLineColors = (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, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
|
|
287
282
|
var xValues = series.x;
|
|
288
283
|
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
289
284
|
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
@@ -348,22 +343,6 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
348
343
|
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, 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, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
|
|
349
344
|
};
|
|
350
345
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
351
|
-
var createColorScale = function (layout, series) {
|
|
352
|
-
var _a, _b, _c, _d, _e, _f;
|
|
353
|
-
var scale = (_a = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _a === void 0 ? void 0 : _a.colorscale;
|
|
354
|
-
var colorValues = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color;
|
|
355
|
-
var _g = [
|
|
356
|
-
(_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),
|
|
357
|
-
(_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),
|
|
358
|
-
], dMin = _g[0], dMax = _g[1];
|
|
359
|
-
// Normalize colorscale domain to actual data domain
|
|
360
|
-
var scaleDomain = scale.map(function (_a) {
|
|
361
|
-
var pos = _a[0];
|
|
362
|
-
return dMin + pos * (dMax - dMin);
|
|
363
|
-
});
|
|
364
|
-
var scaleColors = scale.map(function (item) { return item[1]; });
|
|
365
|
-
return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
|
|
366
|
-
};
|
|
367
346
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
368
347
|
var _a, _b, _c, _d;
|
|
369
348
|
var mapXToDataPoints = {};
|
|
@@ -372,16 +351,11 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
372
351
|
var colorScale = undefined;
|
|
373
352
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
374
353
|
input.data.forEach(function (series, index1) {
|
|
375
|
-
var _a, _b, _c, _d, _e
|
|
376
|
-
|
|
377
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
378
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
379
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
380
|
-
colorScale = createColorScale(input.layout, series);
|
|
381
|
-
}
|
|
354
|
+
var _a, _b, _c, _d, _e;
|
|
355
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
382
356
|
// extract colors for each series only once
|
|
383
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
384
|
-
(
|
|
357
|
+
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
358
|
+
(_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
|
|
385
359
|
var _a, _b, _c, _d, _e, _f;
|
|
386
360
|
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
387
361
|
return;
|
|
@@ -421,18 +395,13 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
|
|
|
421
395
|
var _e = getLegendProps(input.data, input.layout, isMultiPlot), legends = _e.legends, hideLegend = _e.hideLegend;
|
|
422
396
|
var colorScale = undefined;
|
|
423
397
|
input.data.forEach(function (series, seriesIdx) {
|
|
424
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
398
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
425
399
|
if (!series.x) {
|
|
426
400
|
return;
|
|
427
401
|
}
|
|
428
|
-
|
|
429
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
430
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
431
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
432
|
-
colorScale = createColorScale(input.layout, series);
|
|
433
|
-
}
|
|
402
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
434
403
|
// extract colors for each series only once
|
|
435
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
404
|
+
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
436
405
|
var xValues = [];
|
|
437
406
|
var yValues = [];
|
|
438
407
|
series.x.forEach(function (xVal, index) {
|
|
@@ -446,7 +415,7 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
|
|
|
446
415
|
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
447
416
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
448
417
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
449
|
-
var xBins = createBins(xValues, (
|
|
418
|
+
var xBins = createBins(xValues, (_e = series.xbins) === null || _e === void 0 ? void 0 : _e.start, (_f = series.xbins) === null || _f === void 0 ? void 0 : _f.end, (_g = series.xbins) === null || _g === void 0 ? void 0 : _g.size);
|
|
450
419
|
var yBins = xBins.map(function () { return []; });
|
|
451
420
|
var total = 0;
|
|
452
421
|
xValues.forEach(function (xVal, index) {
|
|
@@ -528,11 +497,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
528
497
|
var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
529
498
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
530
499
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
531
|
-
var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
500
|
+
var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
532
501
|
var legendShape = getLegendShape(series);
|
|
533
502
|
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
534
503
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
535
|
-
var _b, _c;
|
|
504
|
+
var _b, _c, _d;
|
|
536
505
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
537
506
|
var rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
538
507
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
@@ -552,7 +521,10 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
552
521
|
: {})), (textValues ? { text: textValues[i] } : {})), { yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat) }));
|
|
553
522
|
}),
|
|
554
523
|
color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
|
|
555
|
-
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode
|
|
524
|
+
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
|
|
525
|
+
// originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
|
|
526
|
+
// scatter polar coordingates to cartesian coordinates
|
|
527
|
+
originXOffset: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.__polarOriginX }),
|
|
556
528
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
557
529
|
};
|
|
558
530
|
});
|
|
@@ -585,15 +557,10 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
|
|
|
585
557
|
var colorScale = undefined;
|
|
586
558
|
var chartData = input.data
|
|
587
559
|
.map(function (series, index) {
|
|
588
|
-
var _a, _b, _c, _d
|
|
589
|
-
|
|
590
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
591
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
592
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
593
|
-
colorScale = createColorScale(input.layout, series);
|
|
594
|
-
}
|
|
560
|
+
var _a, _b, _c, _d;
|
|
561
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
595
562
|
// extract colors for each series only once
|
|
596
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
563
|
+
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
597
564
|
var legend = legends[index];
|
|
598
565
|
return series.y
|
|
599
566
|
.map(function (yValue, i) {
|
|
@@ -631,6 +598,53 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
|
|
|
631
598
|
: ((_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));
|
|
632
599
|
};
|
|
633
600
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
601
|
+
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
602
|
+
var _a, _b, _c;
|
|
603
|
+
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
604
|
+
var colorScale = undefined;
|
|
605
|
+
var chartData = input.data
|
|
606
|
+
.map(function (series, index) {
|
|
607
|
+
var _a, _b, _c, _d, _e, _f;
|
|
608
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
609
|
+
// extract colors for each series only once
|
|
610
|
+
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
611
|
+
var legend = legends[index];
|
|
612
|
+
var isXDate = ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.xaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' || (0, chart_utilities_1.isDateArray)(series.x);
|
|
613
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
614
|
+
var convertXValueToNumber = function (value) {
|
|
615
|
+
return (0, chart_utilities_1.isInvalidValue)(value) ? 0 : isXDate ? new Date(value).getTime() : value;
|
|
616
|
+
};
|
|
617
|
+
return series.y
|
|
618
|
+
.map(function (yVal, i) {
|
|
619
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
620
|
+
if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
624
|
+
var color = colorScale
|
|
625
|
+
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
626
|
+
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
627
|
+
: 0)
|
|
628
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
629
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
630
|
+
var base = convertXValueToNumber((_e = series.base) === null || _e === void 0 ? void 0 : _e[i]);
|
|
631
|
+
var xVal = convertXValueToNumber((_f = series.x) === null || _f === void 0 ? void 0 : _f[i]);
|
|
632
|
+
return {
|
|
633
|
+
x: {
|
|
634
|
+
start: isXDate ? new Date(base) : base,
|
|
635
|
+
end: isXDate ? new Date(base + xVal) : base + xVal,
|
|
636
|
+
},
|
|
637
|
+
y: yVal,
|
|
638
|
+
legend: legend,
|
|
639
|
+
color: (_g = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _g !== void 0 ? _g : color,
|
|
640
|
+
};
|
|
641
|
+
})
|
|
642
|
+
.filter(function (point) { return point !== null; });
|
|
643
|
+
})
|
|
644
|
+
.flat();
|
|
645
|
+
return tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout));
|
|
646
|
+
};
|
|
647
|
+
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
634
648
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
635
649
|
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;
|
|
636
650
|
var firstData = input.data[0];
|
|
@@ -1123,23 +1137,120 @@ var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot, colorM
|
|
|
1123
1137
|
};
|
|
1124
1138
|
exports.transformPlotlyJsonToFunnelChartProps = transformPlotlyJsonToFunnelChartProps;
|
|
1125
1139
|
var projectPolarToCartesian = function (input) {
|
|
1126
|
-
var _a, _b
|
|
1140
|
+
var _a, _b;
|
|
1127
1141
|
var projection = tslib_1.__assign({}, input);
|
|
1142
|
+
// 1. Find the global min and max radius across all series
|
|
1143
|
+
var minRadius = 0;
|
|
1144
|
+
var maxRadius = 0;
|
|
1128
1145
|
for (var sindex = 0; sindex < input.data.length; sindex++) {
|
|
1146
|
+
var rVals = input.data[sindex].r;
|
|
1147
|
+
if (rVals && (0, chart_utilities_1.isArrayOrTypedArray)(rVals)) {
|
|
1148
|
+
for (var ptindex = 0; ptindex < rVals.length; ptindex++) {
|
|
1149
|
+
if (!(0, chart_utilities_1.isInvalidValue)(rVals[ptindex])) {
|
|
1150
|
+
minRadius = Math.min(minRadius, rVals[ptindex]);
|
|
1151
|
+
maxRadius = Math.max(maxRadius, rVals[ptindex]);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
// 2. If there are negative radii, compute the shift
|
|
1157
|
+
var radiusShift = minRadius < 0 ? -minRadius : 0;
|
|
1158
|
+
// 3. Project all points and create a perfect square domain
|
|
1159
|
+
var allX = [];
|
|
1160
|
+
var allY = [];
|
|
1161
|
+
var originX = null;
|
|
1162
|
+
var _loop_1 = function (sindex) {
|
|
1129
1163
|
var series = input.data[sindex];
|
|
1164
|
+
// If scatterpolar, set text to theta values as strings
|
|
1165
|
+
if (series.type === 'scatterpolar' && Array.isArray(series.theta)) {
|
|
1166
|
+
series.text = series.theta.map(function (v) { return String(v); });
|
|
1167
|
+
}
|
|
1130
1168
|
series.x = [];
|
|
1131
1169
|
series.y = [];
|
|
1132
|
-
|
|
1133
|
-
|
|
1170
|
+
var thetas = series.theta;
|
|
1171
|
+
var rVals = series.r;
|
|
1172
|
+
// Skip if rVals or thetas are not arrays
|
|
1173
|
+
if (!(0, chart_utilities_1.isArrayOrTypedArray)(rVals) || !(0, chart_utilities_1.isArrayOrTypedArray)(thetas)) {
|
|
1174
|
+
projection.data[sindex] = series;
|
|
1175
|
+
return "continue";
|
|
1176
|
+
}
|
|
1177
|
+
// Compute tick positions if categorical
|
|
1178
|
+
var uniqueTheta = [];
|
|
1179
|
+
var categorical = false;
|
|
1180
|
+
if (!(0, chart_utilities_1.isNumberArray)(thetas)) {
|
|
1181
|
+
uniqueTheta = Array.from(new Set(thetas));
|
|
1182
|
+
categorical = true;
|
|
1183
|
+
}
|
|
1184
|
+
for (var ptindex = 0; ptindex < rVals.length; ptindex++) {
|
|
1185
|
+
if ((0, chart_utilities_1.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, chart_utilities_1.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
|
|
1134
1186
|
continue;
|
|
1135
1187
|
}
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1138
|
-
|
|
1139
|
-
|
|
1188
|
+
// 4. Map theta to angle in radians
|
|
1189
|
+
var thetaRad = void 0;
|
|
1190
|
+
if (categorical) {
|
|
1191
|
+
var idx = uniqueTheta.indexOf(thetas[ptindex]);
|
|
1192
|
+
var step = (2 * Math.PI) / uniqueTheta.length;
|
|
1193
|
+
thetaRad = idx * step;
|
|
1194
|
+
}
|
|
1195
|
+
else {
|
|
1196
|
+
thetaRad = (thetas[ptindex] * Math.PI) / 180;
|
|
1197
|
+
}
|
|
1198
|
+
// 5. Shift only the polar origin (not the cartesian)
|
|
1199
|
+
var rawRadius = rVals[ptindex];
|
|
1200
|
+
var polarRadius = rawRadius + radiusShift; // Only for projection
|
|
1201
|
+
// 6. Calculate cartesian coordinates (with shifted polar origin)
|
|
1202
|
+
var x = polarRadius * Math.cos(thetaRad);
|
|
1203
|
+
var y = polarRadius * Math.sin(thetaRad);
|
|
1204
|
+
// Calculate the cartesian coordinates of the original polar origin (0,0)
|
|
1205
|
+
// This is the point that should be mapped to (0,0) in cartesian coordinates
|
|
1206
|
+
if (sindex === 0 && ptindex === 0) {
|
|
1207
|
+
// For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
|
|
1208
|
+
// But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
|
|
1209
|
+
originX = radiusShift;
|
|
1210
|
+
}
|
|
1211
|
+
series.x.push(x);
|
|
1212
|
+
series.y.push(y);
|
|
1213
|
+
allX.push(x);
|
|
1214
|
+
allY.push(y);
|
|
1215
|
+
}
|
|
1216
|
+
// Map text to each data point for downstream chart rendering
|
|
1217
|
+
if (series.x && series.y) {
|
|
1218
|
+
series.data = series.x.map(function (xVal, idx) { return (tslib_1.__assign({ x: xVal, y: series.y[idx] }, (series.text ? { text: series.text[idx] } : {}))); });
|
|
1140
1219
|
}
|
|
1141
1220
|
projection.data[sindex] = series;
|
|
1221
|
+
};
|
|
1222
|
+
for (var sindex = 0; sindex < input.data.length; sindex++) {
|
|
1223
|
+
_loop_1(sindex);
|
|
1224
|
+
}
|
|
1225
|
+
// 7. Recenter all cartesian coordinates
|
|
1226
|
+
if (originX !== null) {
|
|
1227
|
+
for (var sindex = 0; sindex < projection.data.length; sindex++) {
|
|
1228
|
+
var series = projection.data[sindex];
|
|
1229
|
+
if (series.x && series.y) {
|
|
1230
|
+
series.x = series.x.map(function (v) { return v - originX; });
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
// Also recenter allX for normalization
|
|
1234
|
+
for (var i = 0; i < allX.length; i++) {
|
|
1235
|
+
allX[i] = allX[i] - originX;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
// 8. Find the maximum absolute value among all x and y
|
|
1239
|
+
var maxAbs = Math.max.apply(Math, tslib_1.__spreadArray(tslib_1.__spreadArray([], allX.map(Math.abs), false), allY.map(Math.abs), false));
|
|
1240
|
+
maxAbs = maxAbs === 0 ? 1 : maxAbs;
|
|
1241
|
+
// 9. Rescale all points so that the largest |x| or |y| is 0.5
|
|
1242
|
+
for (var sindex = 0; sindex < projection.data.length; sindex++) {
|
|
1243
|
+
var series = projection.data[sindex];
|
|
1244
|
+
if (series.x && series.y) {
|
|
1245
|
+
series.x = series.x.map(function (v) { return v / (2 * maxAbs); });
|
|
1246
|
+
series.y = series.y.map(function (v) { return v / (2 * maxAbs); });
|
|
1247
|
+
}
|
|
1142
1248
|
}
|
|
1249
|
+
// 10. Customize layout for perfect square with absolute positioning
|
|
1250
|
+
var size = ((_a = input.layout) === null || _a === void 0 ? void 0 : _a.width) || ((_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) || 500;
|
|
1251
|
+
projection.layout = tslib_1.__assign(tslib_1.__assign({}, projection.layout), { width: size, height: size });
|
|
1252
|
+
// Attach originX as custom properties
|
|
1253
|
+
projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
|
|
1143
1254
|
return projection;
|
|
1144
1255
|
};
|
|
1145
1256
|
exports.projectPolarToCartesian = projectPolarToCartesian;
|