@fluentui/react-charts 9.2.1 → 9.2.3
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 +57 -2
- package/dist/index.d.ts +168 -15
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +58 -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 +170 -100
- 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/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +2 -2
- 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/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.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 +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.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 +251 -78
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +56 -37
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +41 -42
- 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 +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +69 -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 +169 -98
- 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/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +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/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.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 +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.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 +250 -78
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +44 -41
- 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 +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GanttChart/useGanttChartStyles.styles.ts"],"sourcesContent":["import { GanttChartStyles, GanttChartProps } from '../../index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n/**\n * @internal\n */\nexport const ganttClassNames: SlotClassNames<GanttChartStyles> = {\n root: '',\n xAxis: '',\n yAxis: '',\n legendContainer: '',\n hover: '',\n descriptionMessage: '',\n tooltip: '',\n axisTitle: '',\n chartTitle: '',\n opacityChangeOnHover: '',\n shapeStyles: '',\n chartWrapper: '',\n svgTooltip: '',\n chart: '',\n};\n\n/**\n * Apply styling to the GanttChart component\n */\nexport const useGanttChartStyles = (props: GanttChartProps): GanttChartStyles => {\n return {};\n};\n"],"names":["ganttClassNames","root","xAxis","yAxis","legendContainer","hover","descriptionMessage","tooltip","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","svgTooltip","chart","useGanttChartStyles","props"],"mappings":"AAGA;;CAEC,GACD;;;;;;;;;;;mBAAaA;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/GanttChart/useGanttChartStyles.styles.ts"],"sourcesContent":["import { GanttChartStyles, GanttChartProps } from '../../index';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\n/**\n * @internal\n */\nexport const ganttClassNames: SlotClassNames<GanttChartStyles> = {\n root: '',\n xAxis: '',\n yAxis: '',\n legendContainer: '',\n hover: '',\n descriptionMessage: '',\n tooltip: '',\n axisTitle: '',\n chartTitle: '',\n opacityChangeOnHover: '',\n shapeStyles: '',\n chartWrapper: '',\n svgTooltip: '',\n chart: '',\n axisAnnotation: '',\n};\n\n/**\n * Apply styling to the GanttChart component\n */\nexport const useGanttChartStyles = (props: GanttChartProps): GanttChartStyles => {\n return {};\n};\n"],"names":["ganttClassNames","root","xAxis","yAxis","legendContainer","hover","descriptionMessage","tooltip","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","svgTooltip","chart","axisAnnotation","useGanttChartStyles","props"],"mappings":"AAGA;;CAEC,GACD;;;;;;;;;;;mBAAaA;;;uBAqBAgB;;;;AArBN,MAAMhB,kBAAoD;IAC/DC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,iBAAiB;IACjBC,OAAO;IACPC,oBAAoB;IACpBC,SAAS;IACTC,WAAW;IACXC,YAAY;IACZC,sBAAsB;IACtBC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC,OAAO;IACPC,gBAAgB;AAClB,EAAE;AAKK,MAAMC,sBAAsB,CAACC;IAClC,OAAO,CAAC;AACV,EAAE"}
|
|
@@ -20,20 +20,17 @@ const _index1 = require("../../index");
|
|
|
20
20
|
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
21
21
|
const MIN_DOMAIN_MARGIN = 8;
|
|
22
22
|
const X1_INNER_PADDING = 0.1;
|
|
23
|
-
// x1_inner_padding = space_between_bars / (space_between_bars + bar_width)
|
|
24
|
-
// => space_between_bars = (x1_inner_padding / (1 - x1_inner_padding)) * bar_width
|
|
25
|
-
/** Rate at which the space between the bars in a group changes wrt the bar width */ const BAR_GAP_RATE = X1_INNER_PADDING / (1 - X1_INNER_PADDING);
|
|
26
23
|
const VERTICAL_BAR_GAP = 1;
|
|
27
24
|
const MIN_BAR_HEIGHT = 1;
|
|
28
25
|
const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
29
|
-
maxBarWidth: 24
|
|
26
|
+
maxBarWidth: 24,
|
|
27
|
+
xAxisCategoryOrder: 'default'
|
|
30
28
|
}, forwardedRef)=>{
|
|
31
29
|
var _props_legendProps, _props_legendProps1;
|
|
32
30
|
const _tooltipId = (0, _reactutilities.useId)('GVBCTooltipId_');
|
|
33
31
|
const _emptyChartId = (0, _reactutilities.useId)('_GVBC_empty');
|
|
34
32
|
const _useRtl = (0, _index.useRtl)();
|
|
35
33
|
let _domainMargin = MIN_DOMAIN_MARGIN;
|
|
36
|
-
let _keys = [];
|
|
37
34
|
let _xAxisLabels = [];
|
|
38
35
|
let _datasetForBars = [];
|
|
39
36
|
let _margins = {
|
|
@@ -43,13 +40,14 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
43
40
|
left: 0
|
|
44
41
|
};
|
|
45
42
|
let _groupedVerticalBarGraph = [];
|
|
46
|
-
let _refArray = [];
|
|
47
43
|
let _yMax = 0;
|
|
48
44
|
let _calloutAnchorPoint = null;
|
|
49
45
|
let _barWidth = 0;
|
|
50
46
|
let _groupWidth = 0;
|
|
51
47
|
let _xAxisInnerPadding = 0;
|
|
52
48
|
let _xAxisOuterPadding = 0;
|
|
49
|
+
let _legends = [];
|
|
50
|
+
let _legendColorMap = {};
|
|
53
51
|
const cartesianChartRef = _react.useRef(null);
|
|
54
52
|
const Y_ORIGIN = 0;
|
|
55
53
|
const _legendsRef = _react.useRef(null);
|
|
@@ -93,44 +91,53 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
93
91
|
_barWidth = (0, _index.getBarWidth)(props.barWidth, props.maxBarWidth);
|
|
94
92
|
// x0_inner_padding = space_between_groups / (space_between_groups + group_width)
|
|
95
93
|
// space_between_groups = 2 * bar_width
|
|
96
|
-
// group_width =
|
|
97
|
-
_xAxisInnerPadding = (0, _index.getScalePadding)(props.xAxisInnerPadding, undefined, 2 / (2 +
|
|
94
|
+
// group_width = _legends.length * bar_width + (_legends.length - 1) * space_between_bars
|
|
95
|
+
_xAxisInnerPadding = (0, _index.getScalePadding)(props.xAxisInnerPadding, undefined, 2 / (2 + (0, _index.calcTotalBandUnits)(_legends.length, X1_INNER_PADDING)));
|
|
98
96
|
_xAxisOuterPadding = (0, _index.getScalePadding)(props.xAxisOuterPadding);
|
|
99
97
|
};
|
|
100
98
|
const _createDataset = (points)=>{
|
|
101
99
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
100
|
const datasetForBars = [];
|
|
103
|
-
const dataset = [];
|
|
104
101
|
points.forEach((point, index)=>{
|
|
105
|
-
const singleDatasetPoint = {};
|
|
106
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
103
|
const singleDatasetPointForBars = {};
|
|
108
|
-
const
|
|
109
|
-
point.series.forEach((seriesPoint
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
const legendToBarPoint = {};
|
|
105
|
+
point.series.forEach((seriesPoint)=>{
|
|
106
|
+
if (!singleDatasetPointForBars[seriesPoint.legend]) {
|
|
107
|
+
singleDatasetPointForBars[seriesPoint.legend] = [
|
|
108
|
+
{
|
|
109
|
+
...seriesPoint
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
legendToBarPoint[seriesPoint.legend] = {
|
|
113
|
+
...seriesPoint
|
|
114
|
+
};
|
|
115
|
+
} else {
|
|
116
|
+
singleDatasetPointForBars[seriesPoint.legend].push({
|
|
117
|
+
...seriesPoint
|
|
118
|
+
});
|
|
119
|
+
legendToBarPoint[seriesPoint.legend].data += seriesPoint.data;
|
|
120
|
+
}
|
|
115
121
|
});
|
|
116
122
|
singleDatasetPointForBars.xAxisPoint = point.name;
|
|
117
123
|
singleDatasetPointForBars.indexNum = index;
|
|
118
|
-
singleDatasetPointForBars.groupSeries =
|
|
124
|
+
singleDatasetPointForBars.groupSeries = Object.values(legendToBarPoint);
|
|
119
125
|
singleDatasetPointForBars.stackCallOutAccessibilityData = point.stackCallOutAccessibilityData;
|
|
120
126
|
datasetForBars.push(singleDatasetPointForBars);
|
|
121
|
-
dataset.push(singleDatasetPoint);
|
|
122
127
|
});
|
|
123
128
|
return datasetForBars;
|
|
124
129
|
};
|
|
125
130
|
const _createDataSetOfGVBC = (points)=>{
|
|
126
|
-
const
|
|
127
|
-
const xAxisLabels = points
|
|
128
|
-
points
|
|
129
|
-
|
|
131
|
+
const legends = new Set();
|
|
132
|
+
const xAxisLabels = _getOrderedXAxisLabels(points);
|
|
133
|
+
points.forEach((point)=>{
|
|
134
|
+
point.series.forEach((seriesPoint)=>{
|
|
135
|
+
legends.add(seriesPoint.legend);
|
|
136
|
+
});
|
|
130
137
|
});
|
|
131
138
|
const datasetForBars = _createDataset(points);
|
|
132
139
|
return {
|
|
133
|
-
|
|
140
|
+
legends: Array.from(legends),
|
|
134
141
|
xAxisLabels,
|
|
135
142
|
datasetForBars
|
|
136
143
|
};
|
|
@@ -146,36 +153,22 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
146
153
|
props.legendProps.onChange(selectedLegends, event, currentLegend);
|
|
147
154
|
}
|
|
148
155
|
};
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
149
157
|
const _getLegendData = (points)=>{
|
|
150
|
-
const data = points;
|
|
151
|
-
const defaultPalette = [
|
|
152
|
-
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color1),
|
|
153
|
-
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color2),
|
|
154
|
-
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color3),
|
|
155
|
-
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color4),
|
|
156
|
-
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color5)
|
|
157
|
-
];
|
|
158
158
|
const actions = [];
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
_legends.forEach((legendTitle)=>{
|
|
160
|
+
const legend = {
|
|
161
|
+
title: legendTitle,
|
|
162
|
+
color: _legendColorMap[legendTitle][0],
|
|
163
|
+
hoverAction: ()=>{
|
|
164
|
+
_handleChartMouseLeave();
|
|
165
|
+
_onLegendHover(legendTitle);
|
|
166
|
+
},
|
|
167
|
+
onMouseOutAction: ()=>{
|
|
168
|
+
_onLegendLeave();
|
|
165
169
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
color,
|
|
169
|
-
hoverAction: ()=>{
|
|
170
|
-
_handleChartMouseLeave();
|
|
171
|
-
_onLegendHover(point.legend);
|
|
172
|
-
},
|
|
173
|
-
onMouseOutAction: ()=>{
|
|
174
|
-
_onLegendLeave();
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
actions.push(legend);
|
|
178
|
-
});
|
|
170
|
+
};
|
|
171
|
+
actions.push(legend);
|
|
179
172
|
});
|
|
180
173
|
return /*#__PURE__*/ _react.createElement(_index1.Legends, {
|
|
181
174
|
legends: actions,
|
|
@@ -186,13 +179,60 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
186
179
|
legendRef: _legendsRef
|
|
187
180
|
});
|
|
188
181
|
};
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
const _addDefaultColors = (data)=>{
|
|
183
|
+
_legendColorMap = {};
|
|
184
|
+
let colorIndex = 0;
|
|
185
|
+
var _data_map;
|
|
186
|
+
return (_data_map = data === null || data === void 0 ? void 0 : data.map((point)=>{
|
|
187
|
+
var _point_series;
|
|
188
|
+
var _point_series_map;
|
|
189
|
+
return {
|
|
190
|
+
...point,
|
|
191
|
+
series: (_point_series_map = (_point_series = point.series) === null || _point_series === void 0 ? void 0 : _point_series.map((seriesPoint)=>{
|
|
192
|
+
// TODO: Add support for gradient colors
|
|
193
|
+
let startColor = seriesPoint.color ? seriesPoint.color : (0, _index.getNextColor)(colorIndex, 0);
|
|
194
|
+
let endColor = startColor;
|
|
195
|
+
if (!_legendColorMap[seriesPoint.legend]) {
|
|
196
|
+
_legendColorMap[seriesPoint.legend] = [
|
|
197
|
+
startColor,
|
|
198
|
+
endColor
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
colorIndex += 1;
|
|
202
|
+
var _seriesPoint_color;
|
|
203
|
+
return {
|
|
204
|
+
...seriesPoint,
|
|
205
|
+
color: (_seriesPoint_color = seriesPoint.color) !== null && _seriesPoint_color !== void 0 ? _seriesPoint_color : _legendColorMap[seriesPoint.legend][0]
|
|
206
|
+
};
|
|
207
|
+
})) !== null && _point_series_map !== void 0 ? _point_series_map : []
|
|
208
|
+
};
|
|
209
|
+
})) !== null && _data_map !== void 0 ? _data_map : [];
|
|
210
|
+
};
|
|
211
|
+
const _getOrderedXAxisLabels = (points)=>{
|
|
212
|
+
if (_xAxisType !== _index.XAxisTypes.StringAxis) {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
return (0, _index.sortAxisCategories)(_mapCategoryToValues(points), props.xAxisCategoryOrder);
|
|
216
|
+
};
|
|
217
|
+
const _mapCategoryToValues = (points)=>{
|
|
218
|
+
const categoryToValues = {};
|
|
219
|
+
points.forEach((point)=>{
|
|
220
|
+
if (!categoryToValues[point.name]) {
|
|
221
|
+
categoryToValues[point.name] = [];
|
|
222
|
+
}
|
|
223
|
+
point.series.forEach((seriesPoint)=>{
|
|
224
|
+
categoryToValues[point.name].push(seriesPoint.data);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
return categoryToValues;
|
|
228
|
+
};
|
|
229
|
+
const points = _addDefaultColors(props.data);
|
|
230
|
+
const _xAxisType = (0, _index.getTypeOfAxis)(points[0].name, true);
|
|
231
|
+
const { legends, xAxisLabels, datasetForBars } = _createDataSetOfGVBC(points);
|
|
232
|
+
_legends = legends;
|
|
192
233
|
_xAxisLabels = xAxisLabels;
|
|
193
234
|
_datasetForBars = datasetForBars;
|
|
194
|
-
const
|
|
195
|
-
const legends = _getLegendData(points);
|
|
235
|
+
const legendBars = _getLegendData(points);
|
|
196
236
|
_adjustProps();
|
|
197
237
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Add commentMore actions
|
|
198
238
|
function _getMinMaxOfYAxis(datasetForBars, yAxisType, useSecondaryYScale) {
|
|
@@ -252,8 +292,8 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
252
292
|
const xScale0 = _createX0Scale(containerWidth);
|
|
253
293
|
// Setting the bar width here is safe because there are no dependencies earlier in the code
|
|
254
294
|
// that rely on the width of bars in vertical bar charts with string x-axis.
|
|
255
|
-
_barWidth = (0, _index.getBarWidth)(props.barWidth, props.maxBarWidth, xScale0.bandwidth()
|
|
256
|
-
_groupWidth = (
|
|
295
|
+
_barWidth = (0, _index.getBarWidth)(props.barWidth, props.maxBarWidth, (0, _index.calcBandwidth)(xScale0.bandwidth(), _legends.length, X1_INNER_PADDING));
|
|
296
|
+
_groupWidth = (0, _index.calcRequiredWidth)(_barWidth, _legends.length, X1_INNER_PADDING);
|
|
257
297
|
const xScale1 = _createX1Scale();
|
|
258
298
|
const allGroupsBars = [];
|
|
259
299
|
_datasetForBars.forEach((singleSet)=>{
|
|
@@ -264,10 +304,6 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
264
304
|
const _getMargins = (margins)=>{
|
|
265
305
|
_margins = margins;
|
|
266
306
|
};
|
|
267
|
-
const _getOpacity = (legendTitle)=>{
|
|
268
|
-
const opacity = _legendHighlighted(legendTitle) || _noLegendHighlighted() ? '' : '0.1';
|
|
269
|
-
return opacity;
|
|
270
|
-
};
|
|
271
307
|
function updatePosition(newX, newY) {
|
|
272
308
|
const threshold = 1; // Set a threshold for movement
|
|
273
309
|
const { x, y } = clickPosition;
|
|
@@ -304,93 +340,99 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
304
340
|
_calloutAnchorPoint = null;
|
|
305
341
|
setPopoverOpen(false);
|
|
306
342
|
};
|
|
307
|
-
const onBarFocus = (event, pointData, groupData
|
|
343
|
+
const onBarFocus = (event, pointData, groupData)=>{
|
|
308
344
|
let x = 0;
|
|
309
345
|
let y = 0;
|
|
310
346
|
const targetRect = event.target.getBoundingClientRect();
|
|
311
347
|
x = targetRect.left + targetRect.width / 2;
|
|
312
348
|
y = targetRect.top + targetRect.height / 2;
|
|
313
349
|
updatePosition(x, y);
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
setYValueHover(groupData.groupSeries);
|
|
324
|
-
setHoverXValue(pointData.xAxisCalloutData);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
const _refCallback = (element, legendTitle, refIndexNumber)=>{
|
|
329
|
-
_refArray[refIndexNumber] = {
|
|
330
|
-
index: legendTitle,
|
|
331
|
-
refElement: element
|
|
332
|
-
};
|
|
350
|
+
setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(pointData.legend));
|
|
351
|
+
setCalloutLegend(pointData.legend);
|
|
352
|
+
setDataForHoverCard(pointData.data);
|
|
353
|
+
setColor(pointData.color);
|
|
354
|
+
setXCalloutValue(pointData.xAxisCalloutData);
|
|
355
|
+
setYCalloutValue(pointData.yAxisCalloutData);
|
|
356
|
+
setCallOutAccessibilityData(props.isCalloutForStack ? groupData.stackCallOutAccessibilityData : pointData.callOutAccessibilityData);
|
|
357
|
+
setYValueHover(groupData.groupSeries);
|
|
358
|
+
setHoverXValue(pointData.xAxisCalloutData);
|
|
333
359
|
};
|
|
334
360
|
const _buildGraph = (singleSet, xScale0, xScale1, yScalePrimary, yScaleSecondary, containerHeight, xElement)=>{
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
335
362
|
const singleGroup = [];
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
336
364
|
const barLabelsForGroup = [];
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
365
|
+
// Get the actual legends present at this x-axis point
|
|
366
|
+
const presentLegends = Object.keys(singleSet).filter((key)=>key in _legendColorMap);
|
|
367
|
+
const effectiveGroupWidth = (0, _index.calcRequiredWidth)(_barWidth, presentLegends.length, X1_INNER_PADDING);
|
|
368
|
+
// For stacked bars, center the single bar group in the available space
|
|
369
|
+
// Instead of using the global legend position, use the local position within present legends
|
|
370
|
+
const localScale = (0, _d3scale.scaleBand)().domain(presentLegends).range(_useRtl ? [
|
|
371
|
+
effectiveGroupWidth,
|
|
372
|
+
0
|
|
373
|
+
] : [
|
|
374
|
+
0,
|
|
375
|
+
effectiveGroupWidth
|
|
376
|
+
]).paddingInner(X1_INNER_PADDING);
|
|
377
|
+
_legends.forEach((legendTitle, legendIndex)=>{
|
|
378
|
+
const barPoints = singleSet[legendTitle];
|
|
379
|
+
if (barPoints) {
|
|
380
|
+
const yBarScale = barPoints[0].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
381
|
+
var _localScale;
|
|
382
|
+
const xPoint = ((_localScale = localScale(legendTitle)) !== null && _localScale !== void 0 ? _localScale : 0) + (localScale.bandwidth() - _barWidth) / 2;
|
|
383
|
+
const isLegendActive = _legendHighlighted(legendTitle) || _noLegendHighlighted();
|
|
384
|
+
const barOpacity = isLegendActive ? '' : '0.1';
|
|
385
|
+
let barTotalValue = 0;
|
|
347
386
|
const yBaseline = yBarScale(Y_ORIGIN);
|
|
348
387
|
let yPositiveStart = yBaseline;
|
|
349
388
|
let yNegativeStart = yBaseline;
|
|
350
389
|
let yPoint = Y_ORIGIN;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
390
|
+
barPoints.forEach((pointData, pointIndex)=>{
|
|
391
|
+
if (!pointData.data) {
|
|
392
|
+
// Not rendering data with 0.
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const barGap = VERTICAL_BAR_GAP / 2 * (pointIndex > 0 ? 2 : 0);
|
|
396
|
+
const height = Math.max(yBarScale(Y_ORIGIN) - yBarScale(Math.abs(pointData.data)), MIN_BAR_HEIGHT);
|
|
397
|
+
const pointColor = pointData.color; // Use the color of the current point
|
|
398
|
+
if (pointData.data >= Y_ORIGIN) {
|
|
399
|
+
yPositiveStart -= height + barGap;
|
|
400
|
+
yPoint = yPositiveStart;
|
|
401
|
+
} else {
|
|
402
|
+
yPoint = yNegativeStart + barGap;
|
|
403
|
+
yNegativeStart = yPoint + height;
|
|
404
|
+
}
|
|
405
|
+
singleGroup.push(/*#__PURE__*/ _react.createElement("rect", {
|
|
406
|
+
key: `${singleSet.indexNum}-${legendIndex}-${pointIndex}`,
|
|
407
|
+
className: classes.opacityChangeOnHover,
|
|
408
|
+
height: height,
|
|
409
|
+
width: _barWidth,
|
|
410
|
+
x: xPoint,
|
|
411
|
+
y: yPoint,
|
|
412
|
+
opacity: barOpacity,
|
|
413
|
+
fill: pointColor,
|
|
414
|
+
rx: 0,
|
|
415
|
+
onMouseOver: (event)=>onBarHover(pointData, singleSet, event),
|
|
416
|
+
onMouseMove: (event)=>onBarHover(pointData, singleSet, event),
|
|
417
|
+
onMouseOut: _onBarLeave,
|
|
418
|
+
onFocus: (event)=>onBarFocus(event, pointData, singleSet),
|
|
419
|
+
onBlur: _onBarLeave,
|
|
420
|
+
onClick: pointData.onClick,
|
|
421
|
+
"aria-label": getAriaLabel(pointData, singleSet.xAxisPoint),
|
|
422
|
+
tabIndex: _legendHighlighted(pointData.legend) || _noLegendHighlighted() ? 0 : undefined,
|
|
423
|
+
role: "img"
|
|
424
|
+
}));
|
|
425
|
+
barTotalValue += pointData.data;
|
|
426
|
+
});
|
|
427
|
+
if (barTotalValue !== null && !props.hideLabels && _barWidth >= 16 && isLegendActive) {
|
|
386
428
|
barLabelsForGroup.push(/*#__PURE__*/ _react.createElement("text", {
|
|
387
|
-
key: `${singleSet.indexNum}-${
|
|
429
|
+
key: `${singleSet.indexNum}-${legendIndex}`,
|
|
388
430
|
x: xPoint + _barWidth / 2,
|
|
389
|
-
y:
|
|
431
|
+
y: barTotalValue >= Y_ORIGIN ? yPositiveStart - 6 : yNegativeStart + 12,
|
|
390
432
|
textAnchor: "middle",
|
|
391
433
|
className: classes.barLabel,
|
|
392
434
|
"aria-hidden": true
|
|
393
|
-
}, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(
|
|
435
|
+
}, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barTotalValue) : (0, _index.formatScientificLimitWidth)(barTotalValue)));
|
|
394
436
|
}
|
|
395
437
|
}
|
|
396
438
|
});
|
|
@@ -410,7 +452,7 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
410
452
|
}
|
|
411
453
|
return /*#__PURE__*/ _react.createElement("g", {
|
|
412
454
|
key: singleSet.indexNum,
|
|
413
|
-
transform: `translate(${xScale0(singleSet.xAxisPoint) + (xScale0.bandwidth() -
|
|
455
|
+
transform: `translate(${xScale0(singleSet.xAxisPoint) + (xScale0.bandwidth() - effectiveGroupWidth) / 2}, 0)`
|
|
414
456
|
}, singleGroup, barLabelsForGroup);
|
|
415
457
|
};
|
|
416
458
|
// For grouped vertical bar chart, First need to define total scale (from start to end)
|
|
@@ -427,7 +469,7 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
427
469
|
};
|
|
428
470
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
429
471
|
const _createX1Scale = ()=>{
|
|
430
|
-
return (0, _d3scale.scaleBand)().domain(
|
|
472
|
+
return (0, _d3scale.scaleBand)().domain(_legends) // When there is only one group, xScale0 adds padding around it,
|
|
431
473
|
// causing the bandwidth to become smaller than the actual group width.
|
|
432
474
|
// So to render bars in the group correctly, use groupWidth instead of the generated scale bandwidth.
|
|
433
475
|
.range(_useRtl ? [
|
|
@@ -478,8 +520,7 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
478
520
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
479
521
|
};
|
|
480
522
|
const _getDomainMargins = (containerWidth)=>{
|
|
481
|
-
/** Total width available to render the bars */ const totalWidth =
|
|
482
|
-
/** Rate at which the space between the groups changes wrt the group width */ const groupGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
|
|
523
|
+
/** Total width available to render the bars */ const totalWidth = (0, _index.calcTotalWidth)(containerWidth, _margins, MIN_DOMAIN_MARGIN);
|
|
483
524
|
if (_xAxisType === _index.XAxisTypes.StringAxis) {
|
|
484
525
|
if ((0, _index.isScalePaddingDefined)(props.xAxisOuterPadding)) {
|
|
485
526
|
// Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
|
|
@@ -489,19 +530,19 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
489
530
|
// Update the bar width so that when CartesianChart rerenders,
|
|
490
531
|
// the following calculations don't use the previous bar width.
|
|
491
532
|
_barWidth = (0, _index.getBarWidth)(props.barWidth, props.maxBarWidth);
|
|
492
|
-
const groupWidth = (
|
|
493
|
-
/** Total width required to render the groups. Directly proportional to group width */ const reqWidth = (
|
|
533
|
+
const groupWidth = (0, _index.calcRequiredWidth)(_barWidth, _legends.length, X1_INNER_PADDING);
|
|
534
|
+
/** Total width required to render the groups. Directly proportional to group width */ const reqWidth = (0, _index.calcRequiredWidth)(groupWidth, _xAxisLabels.length, _xAxisInnerPadding);
|
|
494
535
|
if (totalWidth >= reqWidth) {
|
|
495
536
|
// Center align the chart by setting equal left and right margins for domain
|
|
496
537
|
_domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
|
|
497
538
|
}
|
|
498
539
|
} else if (props.mode === 'plotly' && xAxisLabels.length > 1) {
|
|
499
540
|
// Calculate the remaining width after rendering groups at their maximum allowable width
|
|
500
|
-
const groupBandwidth =
|
|
501
|
-
const barBandwidth =
|
|
541
|
+
const groupBandwidth = (0, _index.calcBandwidth)(totalWidth, _xAxisLabels.length, _xAxisInnerPadding);
|
|
542
|
+
const barBandwidth = (0, _index.calcBandwidth)(groupBandwidth, _legends.length, X1_INNER_PADDING);
|
|
502
543
|
const barWidth = (0, _index.getBarWidth)(props.barWidth, props.maxBarWidth, barBandwidth);
|
|
503
|
-
const groupWidth = (
|
|
504
|
-
let reqWidth = (
|
|
544
|
+
const groupWidth = (0, _index.calcRequiredWidth)(barWidth, _legends.length, X1_INNER_PADDING);
|
|
545
|
+
let reqWidth = (0, _index.calcRequiredWidth)(groupWidth, _xAxisLabels.length, _xAxisInnerPadding);
|
|
505
546
|
const margin1 = (totalWidth - reqWidth) / 2;
|
|
506
547
|
let margin2 = Number.POSITIVE_INFINITY;
|
|
507
548
|
if (!props.hideTickOverlap) {
|
|
@@ -523,7 +564,7 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
523
564
|
return !(props.data && props.data.length > 0 && props.data.filter((item)=>item.series.length).length > 0);
|
|
524
565
|
};
|
|
525
566
|
const _getChartTitle = ()=>{
|
|
526
|
-
return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Vertical bar chart with ${_xAxisLabels.length} groups of ${
|
|
567
|
+
return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Vertical bar chart with ${_xAxisLabels.length} groups of ${_legends.length} bars each. `;
|
|
527
568
|
};
|
|
528
569
|
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index1.CartesianChart, {
|
|
529
570
|
...props,
|
|
@@ -534,7 +575,7 @@ const GroupedVerticalBarChart = /*#__PURE__*/ _react.forwardRef((props = {
|
|
|
534
575
|
getMinMaxOfYAxis: _getMinMaxOfYAxis,
|
|
535
576
|
createStringYAxis: _index.createStringYAxis,
|
|
536
577
|
calloutProps: calloutProps,
|
|
537
|
-
legendBars:
|
|
578
|
+
legendBars: legendBars,
|
|
538
579
|
xAxisType: _xAxisType,
|
|
539
580
|
createYAxis: _index.createNumericYAxis,
|
|
540
581
|
datasetForXAxisDomain: _xAxisLabels,
|