@fluentui/react-charts 9.2.1 → 9.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -2
- package/dist/index.d.ts +79 -5
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +57 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +110 -81
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +20 -10
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +95 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +164 -77
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +161 -141
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -11
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +57 -51
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +26 -37
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +68 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +109 -80
- 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/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +19 -9
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +120 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +164 -77
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +159 -139
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +11 -10
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +56 -50
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +29 -37
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
CustomPoints: function() {
|
|
16
16
|
return CustomPoints;
|
|
17
17
|
},
|
|
18
|
+
DEFAULT_WRAP_WIDTH: function() {
|
|
19
|
+
return DEFAULT_WRAP_WIDTH;
|
|
20
|
+
},
|
|
18
21
|
HighContrastSelector: function() {
|
|
19
22
|
return HighContrastSelector;
|
|
20
23
|
},
|
|
@@ -255,7 +258,7 @@ function defaultYAxisTickFormatter(value) {
|
|
|
255
258
|
return yAxisTickFormatterInternal(value);
|
|
256
259
|
}
|
|
257
260
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
258
|
-
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap } = xAxisParams;
|
|
261
|
+
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
259
262
|
const xAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
260
263
|
domainNRangeValues.dStartValue,
|
|
261
264
|
domainNRangeValues.dEndValue
|
|
@@ -273,7 +276,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
|
273
276
|
return (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
|
|
274
277
|
};
|
|
275
278
|
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
276
|
-
const longestLabelWidth =
|
|
279
|
+
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 20;
|
|
277
280
|
const [start, end] = xAxisScale.range();
|
|
278
281
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
279
282
|
}
|
|
@@ -482,7 +485,7 @@ function getDateFormatLevel(date, useUTC) {
|
|
|
482
485
|
return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
|
|
483
486
|
}
|
|
484
487
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
485
|
-
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount } = xAxisParams;
|
|
488
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth } = xAxisParams;
|
|
486
489
|
const isUtcSet = useUTC === true || useUTC === 'utc';
|
|
487
490
|
const xAxisScale = isUtcSet ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
|
|
488
491
|
xAxisScale.domain([
|
|
@@ -523,7 +526,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
523
526
|
}
|
|
524
527
|
return (0, _chartutilities.formatDateToLocaleString)(domainValue, culture, useUTC ? true : false, false, formatOptions);
|
|
525
528
|
};
|
|
526
|
-
const longestLabelWidth =
|
|
529
|
+
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
|
|
527
530
|
const [start, end] = xAxisScale.range();
|
|
528
531
|
const maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
529
532
|
tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
|
|
@@ -545,7 +548,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
545
548
|
};
|
|
546
549
|
}
|
|
547
550
|
function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
548
|
-
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap } = xAxisParams;
|
|
551
|
+
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
549
552
|
const xAxisScale = (0, _d3scale.scaleBand)().domain(dataset).range([
|
|
550
553
|
domainNRangeValues.rStartValue,
|
|
551
554
|
domainNRangeValues.rEndValue
|
|
@@ -557,9 +560,9 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
|
557
560
|
};
|
|
558
561
|
if (hideTickOverlap) {
|
|
559
562
|
let nonOverlappingTickValues = [];
|
|
560
|
-
const tickSizes = tickValues.map((value
|
|
561
|
-
|
|
562
|
-
]
|
|
563
|
+
const tickSizes = tickValues.map((value)=>calcMaxLabelWidth([
|
|
564
|
+
value
|
|
565
|
+
]));
|
|
563
566
|
// for LTR
|
|
564
567
|
let start = 0;
|
|
565
568
|
let end = containerWidth;
|
|
@@ -800,22 +803,21 @@ function silceOrAppendToArray(array, value) {
|
|
|
800
803
|
return array.slice(0, pos).concat(array.slice(pos + 1));
|
|
801
804
|
}
|
|
802
805
|
}
|
|
806
|
+
const DEFAULT_WRAP_WIDTH = 10;
|
|
803
807
|
function createWrapOfXLabels(wrapLabelProps) {
|
|
804
|
-
const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip } = wrapLabelProps;
|
|
808
|
+
const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip, width = DEFAULT_WRAP_WIDTH } = wrapLabelProps;
|
|
805
809
|
if (node === null) {
|
|
806
810
|
return;
|
|
807
811
|
}
|
|
808
812
|
const axisNode = (0, _d3selection.select)(node).call(xAxis);
|
|
809
813
|
let removeVal = 0;
|
|
810
|
-
|
|
811
|
-
const arr = [];
|
|
814
|
+
let maxLines = 1;
|
|
812
815
|
axisNode.selectAll('.tick text').each(function() {
|
|
813
816
|
const text = (0, _d3selection.select)(this);
|
|
814
817
|
const totalWord = text.text();
|
|
815
818
|
const truncatedWord = `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
816
819
|
const totalWordLength = text.text().length;
|
|
817
820
|
const words = text.text().split(/\s+/).reverse();
|
|
818
|
-
arr.push(words.length);
|
|
819
821
|
let word = '';
|
|
820
822
|
let line = [];
|
|
821
823
|
let lineNumber = 0;
|
|
@@ -824,9 +826,9 @@ function createWrapOfXLabels(wrapLabelProps) {
|
|
|
824
826
|
const dy = parseFloat(text.attr('dy'));
|
|
825
827
|
let tspan = text.text(null).append('tspan').attr('x', 0).attr('y', y).attr('id', 'BaseSpan').attr('dy', dy + 'em').attr('data-', totalWord);
|
|
826
828
|
if (showXAxisLablesTooltip && totalWordLength > noOfCharsToTruncate) {
|
|
827
|
-
tspan = text.append('tspan').attr('id', 'showDots').attr('x', 0).attr('y', y).attr('dy',
|
|
829
|
+
tspan = text.append('tspan').attr('id', 'showDots').attr('x', 0).attr('y', y).attr('dy', dy + 'em').text(truncatedWord);
|
|
828
830
|
} else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
|
|
829
|
-
tspan = text.append('tspan').attr('id', 'LessLength').attr('x', 0).attr('y', y).attr('dy',
|
|
831
|
+
tspan = text.append('tspan').attr('id', 'LessLength').attr('x', 0).attr('y', y).attr('dy', dy + 'em').text(totalWord);
|
|
830
832
|
} else {
|
|
831
833
|
while(word = words.pop()){
|
|
832
834
|
line.push(word);
|
|
@@ -840,30 +842,20 @@ function createWrapOfXLabels(wrapLabelProps) {
|
|
|
840
842
|
tspan = text.append('tspan').attr('id', 'WordBreakId').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(word);
|
|
841
843
|
}
|
|
842
844
|
}
|
|
843
|
-
const maxDigit = Math.max(...arr);
|
|
844
|
-
let maxHeight = 12; // intial value to render corretly first time
|
|
845
|
-
axisNode.selectAll('text').each(()=>{
|
|
846
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
847
|
-
const outerHTMLElement = document.getElementById('WordBreakId');
|
|
848
|
-
const BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
|
|
849
|
-
const boxHeight = BoxCordinates && BoxCordinates.height;
|
|
850
|
-
if (boxHeight > maxHeight) {
|
|
851
|
-
maxHeight = boxHeight;
|
|
852
|
-
}
|
|
853
|
-
});
|
|
854
|
-
// If we take directly maxDigit * maxheight, then it will show more height between x axis tick values and bottom.
|
|
855
|
-
// To avoid this, reducing maxDigit value by removing some digit based on legth of word.
|
|
856
|
-
let removeDigit = 4;
|
|
857
|
-
if (maxDigit <= 2) {
|
|
858
|
-
removeDigit = 1;
|
|
859
|
-
} else if (maxDigit > 2 && maxDigit <= 6) {
|
|
860
|
-
removeDigit = 2;
|
|
861
|
-
} else if (maxDigit > 6 && maxDigit <= 9) {
|
|
862
|
-
removeDigit = 3;
|
|
863
|
-
}
|
|
864
|
-
removeVal = (maxDigit - removeDigit) * maxHeight;
|
|
865
845
|
}
|
|
846
|
+
maxLines = Math.max(maxLines, lineNumber + 1);
|
|
866
847
|
});
|
|
848
|
+
if (!showXAxisLablesTooltip) {
|
|
849
|
+
let maxHeight = 12; // intial value to render corretly first time
|
|
850
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
851
|
+
const outerHTMLElement = document.getElementById('WordBreakId');
|
|
852
|
+
const BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
|
|
853
|
+
const boxHeight = BoxCordinates && BoxCordinates.height;
|
|
854
|
+
if (boxHeight > maxHeight) {
|
|
855
|
+
maxHeight = boxHeight;
|
|
856
|
+
}
|
|
857
|
+
removeVal = (maxLines - 1) * maxHeight;
|
|
858
|
+
}
|
|
867
859
|
return removeVal > 0 ? removeVal : 0;
|
|
868
860
|
}
|
|
869
861
|
function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
|
|
@@ -877,7 +869,7 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, isRt
|
|
|
877
869
|
const totalWord = text.text();
|
|
878
870
|
const truncatedWord = isRtl ? `...${text.text().slice(0, noOfCharsToTruncate)}` : `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
879
871
|
const totalWordLength = text.text().length;
|
|
880
|
-
const padding =
|
|
872
|
+
const padding = 0; // ems
|
|
881
873
|
const y = text.attr('y');
|
|
882
874
|
const x = text.attr('x');
|
|
883
875
|
const dy = parseFloat(text.attr('dy'));
|