@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,7 +1,7 @@
|
|
|
1
1
|
define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter", "d3-color"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_shape_1, PlotlyColorAdapter_1, d3_color_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
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;
|
|
4
|
+
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;
|
|
5
5
|
exports.NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
6
6
|
exports.SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
7
7
|
var dashOptions = {
|
|
@@ -262,18 +262,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
262
262
|
var colorScale = undefined;
|
|
263
263
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
264
264
|
input.data.forEach(function (series, index1) {
|
|
265
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
266
|
-
|
|
267
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
268
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
269
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
270
|
-
colorScale = createColorScale(input.layout, series);
|
|
271
|
-
}
|
|
265
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
266
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
272
267
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
273
268
|
// extract bar colors for each series only once
|
|
274
|
-
var extractedBarColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
269
|
+
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);
|
|
275
270
|
// extract line colors for each series only once
|
|
276
|
-
var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
271
|
+
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);
|
|
277
272
|
var xValues = series.x;
|
|
278
273
|
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
279
274
|
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
@@ -338,22 +333,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
338
333
|
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);
|
|
339
334
|
};
|
|
340
335
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
341
|
-
var createColorScale = function (layout, series) {
|
|
342
|
-
var _a, _b, _c, _d, _e, _f;
|
|
343
|
-
var scale = (_a = layout === null || layout === void 0 ? void 0 : layout.coloraxis) === null || _a === void 0 ? void 0 : _a.colorscale;
|
|
344
|
-
var colorValues = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color;
|
|
345
|
-
var _g = [
|
|
346
|
-
(_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),
|
|
347
|
-
(_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),
|
|
348
|
-
], dMin = _g[0], dMax = _g[1];
|
|
349
|
-
// Normalize colorscale domain to actual data domain
|
|
350
|
-
var scaleDomain = scale.map(function (_a) {
|
|
351
|
-
var pos = _a[0];
|
|
352
|
-
return dMin + pos * (dMax - dMin);
|
|
353
|
-
});
|
|
354
|
-
var scaleColors = scale.map(function (item) { return item[1]; });
|
|
355
|
-
return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
|
|
356
|
-
};
|
|
357
336
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
358
337
|
var _a, _b, _c, _d;
|
|
359
338
|
var mapXToDataPoints = {};
|
|
@@ -362,16 +341,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
362
341
|
var colorScale = undefined;
|
|
363
342
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
364
343
|
input.data.forEach(function (series, index1) {
|
|
365
|
-
var _a, _b, _c, _d, _e
|
|
366
|
-
|
|
367
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
368
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
369
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
370
|
-
colorScale = createColorScale(input.layout, series);
|
|
371
|
-
}
|
|
344
|
+
var _a, _b, _c, _d, _e;
|
|
345
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
372
346
|
// extract colors for each series only once
|
|
373
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
374
|
-
(
|
|
347
|
+
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);
|
|
348
|
+
(_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
|
|
375
349
|
var _a, _b, _c, _d, _e, _f;
|
|
376
350
|
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
377
351
|
return;
|
|
@@ -411,18 +385,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
411
385
|
var _e = getLegendProps(input.data, input.layout, isMultiPlot), legends = _e.legends, hideLegend = _e.hideLegend;
|
|
412
386
|
var colorScale = undefined;
|
|
413
387
|
input.data.forEach(function (series, seriesIdx) {
|
|
414
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
388
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
415
389
|
if (!series.x) {
|
|
416
390
|
return;
|
|
417
391
|
}
|
|
418
|
-
|
|
419
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
420
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
421
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
422
|
-
colorScale = createColorScale(input.layout, series);
|
|
423
|
-
}
|
|
392
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
424
393
|
// extract colors for each series only once
|
|
425
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
394
|
+
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);
|
|
426
395
|
var xValues = [];
|
|
427
396
|
var yValues = [];
|
|
428
397
|
series.x.forEach(function (xVal, index) {
|
|
@@ -436,7 +405,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
436
405
|
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
437
406
|
// TODO: In case of a single bin, add an empty bin of the same size to prevent the
|
|
438
407
|
// default bar width from being used and ensure the bar spans the full intended range.
|
|
439
|
-
var xBins = createBins(xValues, (
|
|
408
|
+
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);
|
|
440
409
|
var yBins = xBins.map(function () { return []; });
|
|
441
410
|
var total = 0;
|
|
442
411
|
xValues.forEach(function (xVal, index) {
|
|
@@ -518,11 +487,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
518
487
|
var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
519
488
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
520
489
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
521
|
-
var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
490
|
+
var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
522
491
|
var legendShape = getLegendShape(series);
|
|
523
492
|
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
524
493
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
525
|
-
var _b, _c;
|
|
494
|
+
var _b, _c, _d;
|
|
526
495
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
527
496
|
var rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
528
497
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
@@ -542,7 +511,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
542
511
|
: {})), (textValues ? { text: textValues[i] } : {})), { yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat) }));
|
|
543
512
|
}),
|
|
544
513
|
color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
|
|
545
|
-
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode
|
|
514
|
+
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
|
|
515
|
+
// originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
|
|
516
|
+
// scatter polar coordingates to cartesian coordinates
|
|
517
|
+
originXOffset: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.__polarOriginX }),
|
|
546
518
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
547
519
|
};
|
|
548
520
|
});
|
|
@@ -575,15 +547,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
575
547
|
var colorScale = undefined;
|
|
576
548
|
var chartData = input.data
|
|
577
549
|
.map(function (series, index) {
|
|
578
|
-
var _a, _b, _c, _d
|
|
579
|
-
|
|
580
|
-
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
581
|
-
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
582
|
-
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
583
|
-
colorScale = createColorScale(input.layout, series);
|
|
584
|
-
}
|
|
550
|
+
var _a, _b, _c, _d;
|
|
551
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
585
552
|
// extract colors for each series only once
|
|
586
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
553
|
+
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);
|
|
587
554
|
var legend = legends[index];
|
|
588
555
|
return series.y
|
|
589
556
|
.map(function (yValue, i) {
|
|
@@ -621,6 +588,53 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
621
588
|
: ((_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));
|
|
622
589
|
};
|
|
623
590
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
591
|
+
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
592
|
+
var _a, _b, _c;
|
|
593
|
+
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
594
|
+
var colorScale = undefined;
|
|
595
|
+
var chartData = input.data
|
|
596
|
+
.map(function (series, index) {
|
|
597
|
+
var _a, _b, _c, _d, _e, _f;
|
|
598
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
599
|
+
// extract colors for each series only once
|
|
600
|
+
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);
|
|
601
|
+
var legend = legends[index];
|
|
602
|
+
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);
|
|
603
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
604
|
+
var convertXValueToNumber = function (value) {
|
|
605
|
+
return (0, chart_utilities_1.isInvalidValue)(value) ? 0 : isXDate ? new Date(value).getTime() : value;
|
|
606
|
+
};
|
|
607
|
+
return series.y
|
|
608
|
+
.map(function (yVal, i) {
|
|
609
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
610
|
+
if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
614
|
+
var color = colorScale
|
|
615
|
+
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
616
|
+
? (_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]
|
|
617
|
+
: 0)
|
|
618
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
619
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
620
|
+
var base = convertXValueToNumber((_e = series.base) === null || _e === void 0 ? void 0 : _e[i]);
|
|
621
|
+
var xVal = convertXValueToNumber((_f = series.x) === null || _f === void 0 ? void 0 : _f[i]);
|
|
622
|
+
return {
|
|
623
|
+
x: {
|
|
624
|
+
start: isXDate ? new Date(base) : base,
|
|
625
|
+
end: isXDate ? new Date(base + xVal) : base + xVal,
|
|
626
|
+
},
|
|
627
|
+
y: yVal,
|
|
628
|
+
legend: legend,
|
|
629
|
+
color: (_g = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _g !== void 0 ? _g : color,
|
|
630
|
+
};
|
|
631
|
+
})
|
|
632
|
+
.filter(function (point) { return point !== null; });
|
|
633
|
+
})
|
|
634
|
+
.flat();
|
|
635
|
+
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));
|
|
636
|
+
};
|
|
637
|
+
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
624
638
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
625
639
|
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;
|
|
626
640
|
var firstData = input.data[0];
|
|
@@ -1113,23 +1127,120 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1113
1127
|
};
|
|
1114
1128
|
exports.transformPlotlyJsonToFunnelChartProps = transformPlotlyJsonToFunnelChartProps;
|
|
1115
1129
|
var projectPolarToCartesian = function (input) {
|
|
1116
|
-
var _a, _b
|
|
1130
|
+
var _a, _b;
|
|
1117
1131
|
var projection = tslib_1.__assign({}, input);
|
|
1132
|
+
// 1. Find the global min and max radius across all series
|
|
1133
|
+
var minRadius = 0;
|
|
1134
|
+
var maxRadius = 0;
|
|
1118
1135
|
for (var sindex = 0; sindex < input.data.length; sindex++) {
|
|
1136
|
+
var rVals = input.data[sindex].r;
|
|
1137
|
+
if (rVals && (0, chart_utilities_1.isArrayOrTypedArray)(rVals)) {
|
|
1138
|
+
for (var ptindex = 0; ptindex < rVals.length; ptindex++) {
|
|
1139
|
+
if (!(0, chart_utilities_1.isInvalidValue)(rVals[ptindex])) {
|
|
1140
|
+
minRadius = Math.min(minRadius, rVals[ptindex]);
|
|
1141
|
+
maxRadius = Math.max(maxRadius, rVals[ptindex]);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
// 2. If there are negative radii, compute the shift
|
|
1147
|
+
var radiusShift = minRadius < 0 ? -minRadius : 0;
|
|
1148
|
+
// 3. Project all points and create a perfect square domain
|
|
1149
|
+
var allX = [];
|
|
1150
|
+
var allY = [];
|
|
1151
|
+
var originX = null;
|
|
1152
|
+
var _loop_1 = function (sindex) {
|
|
1119
1153
|
var series = input.data[sindex];
|
|
1154
|
+
// If scatterpolar, set text to theta values as strings
|
|
1155
|
+
if (series.type === 'scatterpolar' && Array.isArray(series.theta)) {
|
|
1156
|
+
series.text = series.theta.map(function (v) { return String(v); });
|
|
1157
|
+
}
|
|
1120
1158
|
series.x = [];
|
|
1121
1159
|
series.y = [];
|
|
1122
|
-
|
|
1123
|
-
|
|
1160
|
+
var thetas = series.theta;
|
|
1161
|
+
var rVals = series.r;
|
|
1162
|
+
// Skip if rVals or thetas are not arrays
|
|
1163
|
+
if (!(0, chart_utilities_1.isArrayOrTypedArray)(rVals) || !(0, chart_utilities_1.isArrayOrTypedArray)(thetas)) {
|
|
1164
|
+
projection.data[sindex] = series;
|
|
1165
|
+
return "continue";
|
|
1166
|
+
}
|
|
1167
|
+
// Compute tick positions if categorical
|
|
1168
|
+
var uniqueTheta = [];
|
|
1169
|
+
var categorical = false;
|
|
1170
|
+
if (!(0, chart_utilities_1.isNumberArray)(thetas)) {
|
|
1171
|
+
uniqueTheta = Array.from(new Set(thetas));
|
|
1172
|
+
categorical = true;
|
|
1173
|
+
}
|
|
1174
|
+
for (var ptindex = 0; ptindex < rVals.length; ptindex++) {
|
|
1175
|
+
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])) {
|
|
1124
1176
|
continue;
|
|
1125
1177
|
}
|
|
1126
|
-
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
|
|
1178
|
+
// 4. Map theta to angle in radians
|
|
1179
|
+
var thetaRad = void 0;
|
|
1180
|
+
if (categorical) {
|
|
1181
|
+
var idx = uniqueTheta.indexOf(thetas[ptindex]);
|
|
1182
|
+
var step = (2 * Math.PI) / uniqueTheta.length;
|
|
1183
|
+
thetaRad = idx * step;
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
thetaRad = (thetas[ptindex] * Math.PI) / 180;
|
|
1187
|
+
}
|
|
1188
|
+
// 5. Shift only the polar origin (not the cartesian)
|
|
1189
|
+
var rawRadius = rVals[ptindex];
|
|
1190
|
+
var polarRadius = rawRadius + radiusShift; // Only for projection
|
|
1191
|
+
// 6. Calculate cartesian coordinates (with shifted polar origin)
|
|
1192
|
+
var x = polarRadius * Math.cos(thetaRad);
|
|
1193
|
+
var y = polarRadius * Math.sin(thetaRad);
|
|
1194
|
+
// Calculate the cartesian coordinates of the original polar origin (0,0)
|
|
1195
|
+
// This is the point that should be mapped to (0,0) in cartesian coordinates
|
|
1196
|
+
if (sindex === 0 && ptindex === 0) {
|
|
1197
|
+
// For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
|
|
1198
|
+
// But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
|
|
1199
|
+
originX = radiusShift;
|
|
1200
|
+
}
|
|
1201
|
+
series.x.push(x);
|
|
1202
|
+
series.y.push(y);
|
|
1203
|
+
allX.push(x);
|
|
1204
|
+
allY.push(y);
|
|
1205
|
+
}
|
|
1206
|
+
// Map text to each data point for downstream chart rendering
|
|
1207
|
+
if (series.x && series.y) {
|
|
1208
|
+
series.data = series.x.map(function (xVal, idx) { return (tslib_1.__assign({ x: xVal, y: series.y[idx] }, (series.text ? { text: series.text[idx] } : {}))); });
|
|
1130
1209
|
}
|
|
1131
1210
|
projection.data[sindex] = series;
|
|
1211
|
+
};
|
|
1212
|
+
for (var sindex = 0; sindex < input.data.length; sindex++) {
|
|
1213
|
+
_loop_1(sindex);
|
|
1214
|
+
}
|
|
1215
|
+
// 7. Recenter all cartesian coordinates
|
|
1216
|
+
if (originX !== null) {
|
|
1217
|
+
for (var sindex = 0; sindex < projection.data.length; sindex++) {
|
|
1218
|
+
var series = projection.data[sindex];
|
|
1219
|
+
if (series.x && series.y) {
|
|
1220
|
+
series.x = series.x.map(function (v) { return v - originX; });
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
// Also recenter allX for normalization
|
|
1224
|
+
for (var i = 0; i < allX.length; i++) {
|
|
1225
|
+
allX[i] = allX[i] - originX;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
// 8. Find the maximum absolute value among all x and y
|
|
1229
|
+
var maxAbs = Math.max.apply(Math, tslib_1.__spreadArray(tslib_1.__spreadArray([], allX.map(Math.abs), false), allY.map(Math.abs), false));
|
|
1230
|
+
maxAbs = maxAbs === 0 ? 1 : maxAbs;
|
|
1231
|
+
// 9. Rescale all points so that the largest |x| or |y| is 0.5
|
|
1232
|
+
for (var sindex = 0; sindex < projection.data.length; sindex++) {
|
|
1233
|
+
var series = projection.data[sindex];
|
|
1234
|
+
if (series.x && series.y) {
|
|
1235
|
+
series.x = series.x.map(function (v) { return v / (2 * maxAbs); });
|
|
1236
|
+
series.y = series.y.map(function (v) { return v / (2 * maxAbs); });
|
|
1237
|
+
}
|
|
1132
1238
|
}
|
|
1239
|
+
// 10. Customize layout for perfect square with absolute positioning
|
|
1240
|
+
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;
|
|
1241
|
+
projection.layout = tslib_1.__assign(tslib_1.__assign({}, projection.layout), { width: size, height: size });
|
|
1242
|
+
// Attach originX as custom properties
|
|
1243
|
+
projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
|
|
1133
1244
|
return projection;
|
|
1134
1245
|
};
|
|
1135
1246
|
exports.projectPolarToCartesian = projectPolarToCartesian;
|