@fluentui/react-charts 9.3.3 → 9.3.5
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.md +45 -7
- package/dist/index.d.ts +6 -2
- package/lib/components/AreaChart/AreaChart.js +188 -36
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +17 -13
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +30 -27
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +3 -6
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +8 -4
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +148 -80
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +12 -7
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +5 -5
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +3 -1
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +5 -5
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +5 -4
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +3 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +12 -4
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +8 -8
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +63 -18
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +188 -36
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +16 -13
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +30 -27
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +3 -6
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +114 -63
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +12 -7
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -5
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -5
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +5 -4
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +12 -4
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +8 -8
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +63 -18
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +13 -13
|
@@ -497,7 +497,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
497
497
|
};
|
|
498
498
|
};
|
|
499
499
|
const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
500
|
-
var
|
|
500
|
+
var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
|
|
501
501
|
const mapXToDataPoints = {};
|
|
502
502
|
let yMaxValue = 0;
|
|
503
503
|
let yMinValue = 0;
|
|
@@ -505,7 +505,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
505
505
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
506
506
|
let colorScale = undefined;
|
|
507
507
|
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
508
|
-
const
|
|
508
|
+
const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
|
|
509
509
|
input.data.forEach((series, index1)=>{
|
|
510
510
|
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
|
|
511
511
|
colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
|
|
@@ -513,7 +513,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
513
513
|
const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
514
514
|
// extract line colors for each series only once
|
|
515
515
|
const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
|
|
516
|
-
const validXYRanges = getValidXYRanges(series,
|
|
516
|
+
const validXYRanges = getValidXYRanges(series, resolveXValue);
|
|
517
517
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
518
518
|
const rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
519
519
|
const rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
@@ -521,7 +521,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
521
521
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
522
522
|
if (!mapXToDataPoints[x]) {
|
|
523
523
|
mapXToDataPoints[x] = {
|
|
524
|
-
xAxisPoint:
|
|
524
|
+
xAxisPoint: resolveXValue(x),
|
|
525
525
|
chartData: [],
|
|
526
526
|
lineData: []
|
|
527
527
|
};
|
|
@@ -574,15 +574,38 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
574
574
|
});
|
|
575
575
|
});
|
|
576
576
|
});
|
|
577
|
-
var
|
|
578
|
-
const xCategories = (
|
|
577
|
+
var _input_data;
|
|
578
|
+
const xCategories = Array.from(new Set(((_input_data = input.data) !== null && _input_data !== void 0 ? _input_data : []).flatMap((trace)=>{
|
|
579
|
+
const xData = trace.x;
|
|
580
|
+
if (!xData) {
|
|
581
|
+
return [];
|
|
582
|
+
}
|
|
583
|
+
if (Array.isArray(xData)) {
|
|
584
|
+
return xData.flat().map((x)=>{
|
|
585
|
+
return x;
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
return [];
|
|
589
|
+
}).filter((x)=>x !== undefined && x !== null)));
|
|
579
590
|
var _input_layout_shapes;
|
|
580
591
|
((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').forEach((shape, shapeIdx)=>{
|
|
581
592
|
var _shape_line;
|
|
582
593
|
const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
|
|
583
594
|
const resolveX = (val)=>{
|
|
584
|
-
if (
|
|
585
|
-
|
|
595
|
+
if (shape.xref === 'x domain') {
|
|
596
|
+
if (val === 0) {
|
|
597
|
+
return xCategories[0];
|
|
598
|
+
}
|
|
599
|
+
if (val === 1) {
|
|
600
|
+
return xCategories[xCategories.length - 1];
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (typeof val === 'number' && Array.isArray(xCategories)) {
|
|
604
|
+
if (xCategories[val] !== undefined) {
|
|
605
|
+
return xCategories[val];
|
|
606
|
+
} else {
|
|
607
|
+
return xCategories[shapeIdx];
|
|
608
|
+
}
|
|
586
609
|
}
|
|
587
610
|
return val;
|
|
588
611
|
};
|
|
@@ -901,8 +924,9 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
901
924
|
let mode = 'tonexty';
|
|
902
925
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
903
926
|
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
904
|
-
const
|
|
905
|
-
const
|
|
927
|
+
const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
|
|
928
|
+
const resolveXValue = getAxisValueResolver(xAxisType);
|
|
929
|
+
const shouldWrapLabels = xAxisType === 'category';
|
|
906
930
|
const chartData = input.data.map((series, index)=>{
|
|
907
931
|
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
|
|
908
932
|
const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
|
|
@@ -917,7 +941,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
917
941
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
918
942
|
const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
919
943
|
const legendShape = getLegendShape(series);
|
|
920
|
-
const validXYRanges = getValidXYRanges(series,
|
|
944
|
+
const validXYRanges = getValidXYRanges(series, resolveXValue);
|
|
921
945
|
return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
922
946
|
var _series_marker, _series_marker1, _series_marker2, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
|
|
923
947
|
const rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
@@ -932,7 +956,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
932
956
|
data: rangeXValues.map((x, i)=>{
|
|
933
957
|
var _series_marker, _series_marker1;
|
|
934
958
|
return {
|
|
935
|
-
x:
|
|
959
|
+
x: resolveXValue(x),
|
|
936
960
|
y: rangeYValues[i],
|
|
937
961
|
...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
|
|
938
962
|
markerSize: markerSizes[i]
|
|
@@ -1142,46 +1166,71 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
1142
1166
|
};
|
|
1143
1167
|
const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1144
1168
|
var _input_layout, _input_layout1;
|
|
1145
|
-
const
|
|
1169
|
+
const data = input.data.filter((series)=>series.type !== 'scatter' || series.mode !== 'markers');
|
|
1170
|
+
const { legends, hideLegend } = getLegendProps(data, input.layout, isMultiPlot);
|
|
1146
1171
|
let colorScale = undefined;
|
|
1147
|
-
const
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1172
|
+
const xAxisType = getAxisType(data, getAxisObjects(data, input.layout).x);
|
|
1173
|
+
const resolveXValue = getAxisValueResolver(xAxisType, parseLocalDate);
|
|
1174
|
+
const resolveGanttXValue = (value)=>{
|
|
1175
|
+
const resolvedValue = resolveXValue(value);
|
|
1176
|
+
return typeof resolvedValue === 'string' ? 0 : resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : 0;
|
|
1177
|
+
};
|
|
1178
|
+
const isXDate = xAxisType === 'date';
|
|
1179
|
+
const ganttData = [];
|
|
1180
|
+
data.forEach((series, index)=>{
|
|
1153
1181
|
const legend = legends[index];
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1182
|
+
if (series.type === 'bar') {
|
|
1183
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
|
|
1184
|
+
colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
|
|
1185
|
+
// extract colors for each series only once
|
|
1186
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
1187
|
+
series.y.forEach((yVal, i)=>{
|
|
1188
|
+
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
|
|
1189
|
+
if ((0, _chartutilities.isInvalidValue)(yVal)) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
1193
|
+
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
|
|
1194
|
+
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
|
|
1195
|
+
const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
|
|
1196
|
+
const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
|
|
1197
|
+
var _rgb_copy_formatHex8;
|
|
1198
|
+
ganttData.push({
|
|
1199
|
+
x: {
|
|
1200
|
+
start: isXDate ? new Date(base) : base,
|
|
1201
|
+
end: isXDate ? new Date(base + xVal) : base + xVal
|
|
1202
|
+
},
|
|
1203
|
+
y: yVal,
|
|
1204
|
+
legend,
|
|
1205
|
+
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1206
|
+
opacity
|
|
1207
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
1208
|
+
});
|
|
1209
|
+
});
|
|
1210
|
+
} else if (series.type === 'scatter' && series.mode === 'none' && series.fill === 'toself') {
|
|
1211
|
+
for(let i = 0; i < series.y.length; i += 5){
|
|
1212
|
+
if ((0, _chartutilities.isInvalidValue)(series.y[i]) || (0, _chartutilities.isInvalidValue)(series.y[i + 3])) {
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
const x0 = resolveGanttXValue(series.x[i]);
|
|
1216
|
+
const x1 = resolveGanttXValue(series.x[i + 1]);
|
|
1217
|
+
const y0 = series.y[i];
|
|
1218
|
+
const y1 = series.y[i + 3];
|
|
1219
|
+
ganttData.push({
|
|
1220
|
+
x: {
|
|
1221
|
+
start: x0,
|
|
1222
|
+
end: x1
|
|
1223
|
+
},
|
|
1224
|
+
y: Math.round((y0 + y1) / 2),
|
|
1225
|
+
legend,
|
|
1226
|
+
color: series.fillcolor
|
|
1227
|
+
});
|
|
1162
1228
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
|
|
1166
|
-
const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
|
|
1167
|
-
const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
|
|
1168
|
-
var _rgb_copy_formatHex8;
|
|
1169
|
-
return {
|
|
1170
|
-
x: {
|
|
1171
|
-
start: isXDate ? new Date(base) : base,
|
|
1172
|
-
end: isXDate ? new Date(base + xVal) : base + xVal
|
|
1173
|
-
},
|
|
1174
|
-
y: yVal,
|
|
1175
|
-
legend,
|
|
1176
|
-
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1177
|
-
opacity
|
|
1178
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
1179
|
-
};
|
|
1180
|
-
}).filter((point)=>point !== null);
|
|
1181
|
-
}).flat();
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1182
1231
|
var _input_layout_height;
|
|
1183
1232
|
return {
|
|
1184
|
-
data:
|
|
1233
|
+
data: ganttData,
|
|
1185
1234
|
showYAxisLables: true,
|
|
1186
1235
|
height: (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
1187
1236
|
width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
|
|
@@ -1192,9 +1241,9 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
|
|
|
1192
1241
|
roundCorners: true,
|
|
1193
1242
|
useUTC: false,
|
|
1194
1243
|
...getTitles(input.layout),
|
|
1195
|
-
...getAxisCategoryOrderProps(
|
|
1196
|
-
...getBarProps(
|
|
1197
|
-
...getAxisTickProps(
|
|
1244
|
+
...getAxisCategoryOrderProps(data, input.layout),
|
|
1245
|
+
...getBarProps(data, input.layout, true),
|
|
1246
|
+
...getAxisTickProps(data, input.layout)
|
|
1198
1247
|
};
|
|
1199
1248
|
};
|
|
1200
1249
|
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -2428,8 +2477,14 @@ const getAxisScaleTypeProps = (data, layout)=>{
|
|
|
2428
2477
|
const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
|
|
2429
2478
|
if (axId === 'x') {
|
|
2430
2479
|
props.tickValues = tickValues;
|
|
2480
|
+
props.xAxis = {
|
|
2481
|
+
tickText: ax.ticktext
|
|
2482
|
+
};
|
|
2431
2483
|
} else if (axId === 'y') {
|
|
2432
2484
|
props.yAxisTickValues = tickValues;
|
|
2485
|
+
props.yAxis = {
|
|
2486
|
+
tickText: ax.ticktext
|
|
2487
|
+
};
|
|
2433
2488
|
}
|
|
2434
2489
|
return;
|
|
2435
2490
|
}
|
|
@@ -2537,14 +2592,7 @@ const getAxisObjects = (data, layout)=>{
|
|
|
2537
2592
|
}
|
|
2538
2593
|
return axisObjects;
|
|
2539
2594
|
};
|
|
2540
|
-
|
|
2541
|
-
let ax;
|
|
2542
|
-
if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
|
|
2543
|
-
ax = arg2;
|
|
2544
|
-
} else if (typeof arg3 === 'string') {
|
|
2545
|
-
const layout = arg2;
|
|
2546
|
-
ax = getAxisObjects(data, layout)[arg3];
|
|
2547
|
-
}
|
|
2595
|
+
const getAxisType = (data, ax)=>{
|
|
2548
2596
|
if (!ax) {
|
|
2549
2597
|
return 'category';
|
|
2550
2598
|
}
|
|
@@ -2577,9 +2625,12 @@ function getAxisType(data, arg2, arg3) {
|
|
|
2577
2625
|
return 'date';
|
|
2578
2626
|
}
|
|
2579
2627
|
return 'category';
|
|
2580
|
-
}
|
|
2581
|
-
const getAxisValueResolver = (
|
|
2582
|
-
const
|
|
2628
|
+
};
|
|
2629
|
+
const getAxisValueResolver = (axType, dateParser)=>{
|
|
2630
|
+
const toDate = (value)=>{
|
|
2631
|
+
const date = dateParser ? dateParser(value) : new Date(value);
|
|
2632
|
+
return isNaN(date.getTime()) ? null : date;
|
|
2633
|
+
};
|
|
2583
2634
|
return (value)=>{
|
|
2584
2635
|
if ((0, _chartutilities.isInvalidValue)(value)) {
|
|
2585
2636
|
return null;
|
|
@@ -2590,10 +2641,10 @@ const getAxisValueResolver = (data, layout, axisId)=>{
|
|
|
2590
2641
|
return (0, _chartutilities.isNumber)(value) ? +value : null;
|
|
2591
2642
|
case 'date':
|
|
2592
2643
|
if ((0, _chartutilities.isNumber)(value)) {
|
|
2593
|
-
return
|
|
2644
|
+
return toDate(+value);
|
|
2594
2645
|
}
|
|
2595
2646
|
if (typeof value === 'string') {
|
|
2596
|
-
return
|
|
2647
|
+
return toDate(value);
|
|
2597
2648
|
}
|
|
2598
2649
|
return null;
|
|
2599
2650
|
case 'category':
|