@fluentui/react-charting 5.24.3 → 5.24.4
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 +46 -1
- package/CHANGELOG.md +16 -2
- package/dist/react-charting.d.ts +34 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +7 -1
- package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib/components/AreaChart/AreaChart.base.js +4 -1
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +2 -2
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +67 -66
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +22 -3
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +84 -55
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +27 -6
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +48 -31
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +18 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +6 -3
- package/lib/utilities/utilities.js +58 -29
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -2
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +66 -66
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +83 -54
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +18 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +6 -3
- package/lib-amd/utilities/utilities.js +59 -30
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +66 -65
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +83 -54
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +18 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +6 -3
- package/lib-commonjs/utilities/utilities.js +59 -30
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +20 -1
- package/src/components/ScatterChart/ScatterChart.types.ts +7 -1
|
@@ -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, } 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, } 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';
|
|
@@ -603,33 +603,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
|
|
607
|
-
var legendToYValues_1 = {};
|
|
608
|
-
_this._points.forEach(function (xPoint) {
|
|
609
|
-
xPoint.chartData.forEach(function (bar) {
|
|
610
|
-
if (!legendToYValues_1[bar.legend]) {
|
|
611
|
-
legendToYValues_1[bar.legend] = ["".concat(bar.data)];
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
legendToYValues_1[bar.legend].push("".concat(bar.data));
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
});
|
|
618
|
-
var yAxisLabels_1 = new Set();
|
|
619
|
-
Object.values(legendToYValues_1).forEach(function (yValues) {
|
|
620
|
-
yValues.forEach(function (yVal) {
|
|
621
|
-
yAxisLabels_1.add(yVal);
|
|
622
|
-
});
|
|
623
|
-
});
|
|
624
|
-
Object.values(_this._lineObject).forEach(function (linePoints) {
|
|
625
|
-
linePoints.forEach(function (linePoint) {
|
|
626
|
-
if (!linePoint.useSecondaryYScale) {
|
|
627
|
-
yAxisLabels_1.add("".concat(linePoint.y));
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
});
|
|
631
|
-
_this._yAxisLabels = Array.from(yAxisLabels_1);
|
|
632
|
-
}
|
|
606
|
+
_this._yAxisLabels = _this._getOrderedYAxisLabels();
|
|
633
607
|
};
|
|
634
608
|
_this._getYDomainMargins = function (containerHeight) {
|
|
635
609
|
/**
|
|
@@ -656,6 +630,49 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
656
630
|
}
|
|
657
631
|
return __assign(__assign({}, _this.margins), { top: _this.margins.top + yAxisTickMarginTop });
|
|
658
632
|
};
|
|
633
|
+
_this._getOrderedXAxisLabels = function () {
|
|
634
|
+
if (_this._xAxisType !== XAxisTypes.StringAxis) {
|
|
635
|
+
return [];
|
|
636
|
+
}
|
|
637
|
+
return sortAxisCategories(_this._mapCategoryToValues(), _this.props.xAxisCategoryOrder);
|
|
638
|
+
};
|
|
639
|
+
_this._getOrderedYAxisLabels = function () {
|
|
640
|
+
if (_this._yAxisType !== YAxisType.StringAxis) {
|
|
641
|
+
return [];
|
|
642
|
+
}
|
|
643
|
+
return sortAxisCategories(_this._mapCategoryToValues(true), _this.props.yAxisCategoryOrder);
|
|
644
|
+
};
|
|
645
|
+
_this._mapCategoryToValues = function (isYAxis) {
|
|
646
|
+
if (isYAxis === void 0) { isYAxis = false; }
|
|
647
|
+
var categoryToValues = {};
|
|
648
|
+
_this._points.forEach(function (point) {
|
|
649
|
+
var _a;
|
|
650
|
+
point.chartData.forEach(function (bar) {
|
|
651
|
+
var category = (isYAxis ? bar.data : point.xAxisPoint);
|
|
652
|
+
var value = isYAxis ? point.xAxisPoint : bar.data;
|
|
653
|
+
if (!categoryToValues[category]) {
|
|
654
|
+
categoryToValues[category] = [];
|
|
655
|
+
}
|
|
656
|
+
if (typeof value === 'number') {
|
|
657
|
+
categoryToValues[category].push(value);
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
(_a = point.lineData) === null || _a === void 0 ? void 0 : _a.forEach(function (linePoint) {
|
|
661
|
+
if (isYAxis && linePoint.useSecondaryYScale) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
var category = (isYAxis ? linePoint.y : point.xAxisPoint);
|
|
665
|
+
var value = isYAxis ? point.xAxisPoint : linePoint.y;
|
|
666
|
+
if (!categoryToValues[category]) {
|
|
667
|
+
categoryToValues[category] = [];
|
|
668
|
+
}
|
|
669
|
+
if (typeof value === 'number') {
|
|
670
|
+
categoryToValues[category].push(value);
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
return categoryToValues;
|
|
675
|
+
};
|
|
659
676
|
initializeComponentRef(_this);
|
|
660
677
|
_this.state = {
|
|
661
678
|
isCalloutVisible: false,
|
|
@@ -758,9 +775,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
758
775
|
};
|
|
759
776
|
VerticalStackedBarChartBase.prototype._createDataSetLayer = function () {
|
|
760
777
|
var _this = this;
|
|
761
|
-
var tempArr = [];
|
|
762
778
|
var dataset = this._points.map(function (singlePointData) {
|
|
763
|
-
tempArr.push(singlePointData.xAxisPoint);
|
|
764
779
|
if (_this._yAxisType === YAxisType.StringAxis) {
|
|
765
780
|
return {
|
|
766
781
|
x: singlePointData.xAxisPoint,
|
|
@@ -776,7 +791,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
776
791
|
y: total,
|
|
777
792
|
};
|
|
778
793
|
});
|
|
779
|
-
this._xAxisLabels =
|
|
794
|
+
this._xAxisLabels = this._getOrderedXAxisLabels();
|
|
780
795
|
return dataset;
|
|
781
796
|
};
|
|
782
797
|
VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
|
|
@@ -988,6 +1003,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
988
1003
|
VerticalStackedBarChartBase.defaultProps = {
|
|
989
1004
|
maxBarWidth: 24,
|
|
990
1005
|
useUTC: true,
|
|
1006
|
+
xAxisCategoryOrder: 'default',
|
|
1007
|
+
yAxisCategoryOrder: 'default',
|
|
991
1008
|
};
|
|
992
1009
|
return VerticalStackedBarChartBase;
|
|
993
1010
|
}(React.Component));
|