@fluentui/react-charting 5.24.5 → 5.24.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +43 -1
- package/CHANGELOG.md +22 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/lib/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +3 -2
- package/lib/components/CommonComponents/CartesianChart.base.js +134 -112
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +35 -62
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.styles.js +2 -18
- package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +15 -24
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.styles.js +3 -11
- package/lib/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.styles.js +2 -1
- package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.styles.js +3 -14
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +14 -12
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +13 -17
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib/utilities/Common.styles.d.ts +6 -0
- package/lib/utilities/Common.styles.js +51 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/SVGTooltipText.d.ts +1 -1
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.d.ts +1 -0
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.d.ts +3 -0
- package/lib/utilities/utilities.js +25 -38
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.d.ts +18 -0
- package/lib/utilities/vbc-utils.js +29 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib-amd/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +3 -2
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +133 -111
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +33 -61
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -17
- package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -23
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -13
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.styles.js +3 -10
- package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js +2 -2
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +3 -13
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +13 -11
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js +3 -13
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +12 -16
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -13
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib-amd/utilities/Common.styles.d.ts +6 -0
- package/lib-amd/utilities/Common.styles.js +57 -0
- package/lib-amd/utilities/Common.styles.js.map +1 -0
- package/lib-amd/utilities/SVGTooltipText.d.ts +1 -1
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/index.d.ts +1 -0
- package/lib-amd/utilities/index.js +2 -1
- package/lib-amd/utilities/index.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +3 -0
- package/lib-amd/utilities/utilities.js +26 -39
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-amd/utilities/vbc-utils.d.ts +18 -0
- package/lib-amd/utilities/vbc-utils.js +34 -1
- package/lib-amd/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.styles.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +3 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +133 -111
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +33 -60
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +13 -10
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -18
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -23
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js +3 -14
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.styles.js +3 -11
- package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +2 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +3 -14
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +13 -11
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js +3 -14
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +12 -16
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js +3 -14
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.d.ts +6 -0
- package/lib-commonjs/utilities/Common.styles.js +58 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.d.ts +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.d.ts +1 -0
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +3 -0
- package/lib-commonjs/utilities/utilities.js +27 -40
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.d.ts +18 -0
- package/lib-commonjs/utilities/vbc-utils.js +34 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FontSizes, FontWeights, HighContrastSelector } from '@fluentui/react/lib/Styling';
|
|
1
|
+
import { getBarLabelStyle, getTooltipStyle } from '../../utilities/index';
|
|
3
2
|
export var getStyles = function (props) {
|
|
4
|
-
var _a;
|
|
5
3
|
var shouldHighlight = props.shouldHighlight, theme = props.theme;
|
|
6
4
|
return {
|
|
7
5
|
opacityChangeOnHover: {
|
|
@@ -18,17 +16,8 @@ export var getStyles = function (props) {
|
|
|
18
16
|
transform: 'scaleX(-1)',
|
|
19
17
|
},
|
|
20
18
|
],
|
|
21
|
-
tooltip:
|
|
22
|
-
barLabel:
|
|
23
|
-
fontSize: FontSizes.small,
|
|
24
|
-
fontWeight: FontWeights.semibold,
|
|
25
|
-
fill: theme.palette.neutralPrimary,
|
|
26
|
-
selectors: (_a = {},
|
|
27
|
-
_a[HighContrastSelector] = {
|
|
28
|
-
fill: 'CanvasText',
|
|
29
|
-
},
|
|
30
|
-
_a),
|
|
31
|
-
},
|
|
19
|
+
tooltip: getTooltipStyle(theme),
|
|
20
|
+
barLabel: getBarLabelStyle(theme),
|
|
32
21
|
};
|
|
33
22
|
};
|
|
34
23
|
//# sourceMappingURL=VerticalBarChart.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalBarChart.styles.js","sourceRoot":"../src/","sources":["components/VerticalBarChart/VerticalBarChart.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VerticalBarChart.styles.js","sourceRoot":"../src/","sources":["components/VerticalBarChart/VerticalBarChart.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE1E,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAAkC;IAClD,IAAA,eAAe,GAAY,KAAK,gBAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACzC,OAAO;QACL,oBAAoB,EAAE;YACpB,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;SACtC;QAED,UAAU,EAAE,EAAE;QAEd,UAAU,EAAE;YACV;gBACE,SAAS,EAAE,YAAY;aACxB;SACF;QACD,WAAW,EAAE;YACX;gBACE,SAAS,EAAE,YAAY;aACxB;SACF;QACD,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;QAC/B,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC;KAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { IVerticalBarChartStyleProps, IVerticalBarChartStyles } from '../../index';\nimport { getBarLabelStyle, getTooltipStyle } from '../../utilities/index';\n\nexport const getStyles = (props: IVerticalBarChartStyleProps): IVerticalBarChartStyles => {\n const { shouldHighlight, theme } = props;\n return {\n opacityChangeOnHover: {\n opacity: shouldHighlight ? '' : '0.1',\n },\n\n xAxisTicks: [],\n\n yAxisTicks: [\n {\n transform: 'scaleX(-1)',\n },\n ],\n yAxisDomain: [\n {\n transform: 'scaleX(-1)',\n },\n ],\n tooltip: getTooltipStyle(theme),\n barLabel: getBarLabelStyle(theme),\n };\n};\n"]}
|
|
@@ -9,7 +9,7 @@ import { Legends } from '../Legends/index';
|
|
|
9
9
|
import { CartesianChart, ChartHoverCard, } from '../../index';
|
|
10
10
|
import { FocusZoneDirection } from '@fluentui/react-focus';
|
|
11
11
|
import { formatDateToLocaleString } from '@fluentui/chart-utilities';
|
|
12
|
-
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, getNextGradient, areArraysEqual, calculateLongestLabelWidth, YAxisType, sortAxisCategories, } from '../../utilities/index';
|
|
12
|
+
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, getNextGradient, areArraysEqual, calculateLongestLabelWidth, YAxisType, sortAxisCategories, calcTotalWidth, calcBandwidth, calcRequiredWidth, } from '../../utilities/index';
|
|
13
13
|
import { toImage } from '../../utilities/image-export-utils';
|
|
14
14
|
var getClassNames = classNamesFunction();
|
|
15
15
|
var COMPONENT_NAME = 'VERTICAL STACKED BAR CHART';
|
|
@@ -265,7 +265,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
265
265
|
if (!barsToDisplay.length) {
|
|
266
266
|
return undefined;
|
|
267
267
|
}
|
|
268
|
-
var _a = _this._getBarGapAndScale(barsToDisplay, yBarScale), gapHeight = _a.gapHeight, heightValueScale = _a.heightValueScale,
|
|
268
|
+
var _a = _this._getBarGapAndScale(barsToDisplay, yBarScale), gapHeight = _a.gapHeight, heightValueScale = _a.heightValueScale, absStackTotal = _a.absStackTotal;
|
|
269
269
|
if (heightValueScale < 0) {
|
|
270
270
|
return undefined;
|
|
271
271
|
}
|
|
@@ -316,7 +316,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
316
316
|
}
|
|
317
317
|
else {
|
|
318
318
|
barHeight = Math.abs(heightValueScale * point.data);
|
|
319
|
-
|
|
319
|
+
// FIXME: The current scaling logic may produce different min and gap heights for each bar stack.
|
|
320
|
+
var minHeight = Math.max((heightValueScale * absStackTotal) / 100.0, barMinimumHeight);
|
|
320
321
|
if (barHeight < minHeight) {
|
|
321
322
|
barHeight = minHeight;
|
|
322
323
|
}
|
|
@@ -528,9 +529,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
528
529
|
var _a;
|
|
529
530
|
_this._domainMargin = MIN_DOMAIN_MARGIN;
|
|
530
531
|
/** Total width available to render the bars */
|
|
531
|
-
var totalWidth = containerWidth
|
|
532
|
-
/** Rate at which the space between the bars changes wrt the bar width */
|
|
533
|
-
var barGapRate = _this._xAxisInnerPadding / (1 - _this._xAxisInnerPadding);
|
|
532
|
+
var totalWidth = calcTotalWidth(containerWidth, _this.margins, MIN_DOMAIN_MARGIN);
|
|
534
533
|
if (_this._xAxisType === XAxisTypes.StringAxis) {
|
|
535
534
|
if (isScalePaddingDefined(_this.props.xAxisOuterPadding, _this.props.xAxisPadding)) {
|
|
536
535
|
// Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
|
|
@@ -542,7 +541,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
542
541
|
// the following calculations don't use the previous bar width.
|
|
543
542
|
_this._barWidth = getBarWidth(_this.props.barWidth, _this.props.maxBarWidth);
|
|
544
543
|
/** Total width required to render the bars. Directly proportional to bar width */
|
|
545
|
-
var reqWidth = (_this.
|
|
544
|
+
var reqWidth = calcRequiredWidth(_this._barWidth, _this._xAxisLabels.length, _this._xAxisInnerPadding);
|
|
546
545
|
if (totalWidth >= reqWidth) {
|
|
547
546
|
// Center align the chart by setting equal left and right margins for domain
|
|
548
547
|
_this._domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
|
|
@@ -550,17 +549,14 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
550
549
|
}
|
|
551
550
|
else if (_this.props.mode === 'plotly' && _this._xAxisLabels.length > 1) {
|
|
552
551
|
// Calculate the remaining width after rendering bars at their maximum allowable width
|
|
553
|
-
var bandwidth = totalWidth
|
|
552
|
+
var bandwidth = calcBandwidth(totalWidth, _this._xAxisLabels.length, _this._xAxisInnerPadding);
|
|
554
553
|
var barWidth = getBarWidth(_this.props.barWidth, _this.props.maxBarWidth, bandwidth);
|
|
555
|
-
var reqWidth = (_this._xAxisLabels.length
|
|
554
|
+
var reqWidth = calcRequiredWidth(barWidth, _this._xAxisLabels.length, _this._xAxisInnerPadding);
|
|
556
555
|
var margin1 = (totalWidth - reqWidth) / 2;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
reqWidth = (_this._xAxisLabels.length - _this._xAxisInnerPadding) * step;
|
|
562
|
-
margin2 = (totalWidth - reqWidth) / 2;
|
|
563
|
-
}
|
|
556
|
+
// Calculate the remaining width after accounting for the space required to render x-axis labels
|
|
557
|
+
var step = calculateLongestLabelWidth(_this._xAxisLabels) + 20;
|
|
558
|
+
reqWidth = (_this._xAxisLabels.length - _this._xAxisInnerPadding) * step;
|
|
559
|
+
var margin2 = (totalWidth - reqWidth) / 2;
|
|
564
560
|
_this._domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
|
|
565
561
|
}
|
|
566
562
|
}
|
|
@@ -994,7 +990,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
994
990
|
return {
|
|
995
991
|
gapHeight: gapHeight,
|
|
996
992
|
heightValueScale: heightValueScale,
|
|
997
|
-
|
|
993
|
+
absStackTotal: totalData,
|
|
998
994
|
};
|
|
999
995
|
};
|
|
1000
996
|
VerticalStackedBarChartBase.prototype._isChartEmpty = function () {
|