@fluentui/react-charts 9.2.2 → 9.2.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.md +74 -2
- package/dist/index.d.ts +187 -15
- package/lib/components/AreaChart/AreaChart.js +7 -4
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +4 -3
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +5 -16
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +90 -6
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +83 -38
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +19 -3
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -23
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +214 -107
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1618 -259
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +8 -3
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +8 -3
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +4 -2
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.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/GaugeChart/GaugeChart.js +1 -2
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +31 -10
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +6 -18
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +6 -22
- 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 +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -3
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.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/LineChart/LineChart.js +349 -176
- 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 +28 -8
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +9 -14
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +139 -81
- 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 +29 -8
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +10 -15
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +28 -5
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +10 -7
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +7 -20
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +159 -47
- 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 +9 -7
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +6 -20
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js +3 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.js +52 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/utilities.js +324 -147
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +6 -3
- 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 +4 -15
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +90 -6
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +83 -37
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +17 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -22
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +212 -107
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +31 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1652 -260
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +12 -3
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -2
- 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/useDonutChartStyles.styles.js +32 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +4 -2
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.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/GaugeChart/GaugeChart.js +1 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +30 -9
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +5 -21
- 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 +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +10 -3
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.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/LineChart/LineChart.js +347 -175
- 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 +35 -5
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +7 -13
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +137 -79
- 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 +39 -6
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +9 -14
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +27 -4
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +7 -4
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -18
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +158 -46
- 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 +7 -4
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +5 -19
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +3 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +337 -137
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -13,6 +13,33 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
13
13
|
const _useChartTableStylesstyles = require("./useChartTableStyles.styles");
|
|
14
14
|
const _utilities = require("../../utilities/utilities");
|
|
15
15
|
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
16
|
+
const _reacttheme = require("@fluentui/react-theme");
|
|
17
|
+
const _d3color = /*#__PURE__*/ _interop_require_wildcard._(require("d3-color"));
|
|
18
|
+
const _colors = require("../../utilities/colors");
|
|
19
|
+
function invertHexColor(hex) {
|
|
20
|
+
const color = _d3color.color(hex);
|
|
21
|
+
if (!color) {
|
|
22
|
+
return _reacttheme.tokens.colorNeutralForeground1;
|
|
23
|
+
}
|
|
24
|
+
const rgb = color.rgb();
|
|
25
|
+
return _d3color.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();
|
|
26
|
+
}
|
|
27
|
+
function getSafeBackgroundColor(foreground, background) {
|
|
28
|
+
const fallbackFg = _reacttheme.tokens.colorNeutralForeground1;
|
|
29
|
+
const fallbackBg = _reacttheme.tokens.colorNeutralBackground1;
|
|
30
|
+
const fg = _d3color.color(foreground || fallbackFg);
|
|
31
|
+
const bg = _d3color.color(background || fallbackBg);
|
|
32
|
+
if (!fg || !bg) {
|
|
33
|
+
return fallbackBg;
|
|
34
|
+
}
|
|
35
|
+
const contrast = (0, _colors.getColorContrast)(fg.formatHex(), bg.formatHex());
|
|
36
|
+
if (contrast >= 3) {
|
|
37
|
+
return bg.formatHex();
|
|
38
|
+
}
|
|
39
|
+
const invertedBg = invertHexColor(bg.formatHex());
|
|
40
|
+
const invertedContrast = (0, _colors.getColorContrast)(fg.formatHex(), invertedBg);
|
|
41
|
+
return invertedContrast >= 3 ? invertedBg : fallbackBg;
|
|
42
|
+
}
|
|
16
43
|
const ChartTable = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
17
44
|
const { headers, rows, width, height } = props;
|
|
18
45
|
const _isRTL = (0, _utilities.useRtl)();
|
|
@@ -27,6 +54,38 @@ const ChartTable = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
27
54
|
if (!headers || headers.length === 0) {
|
|
28
55
|
return /*#__PURE__*/ _react.createElement("div", null, "No data available");
|
|
29
56
|
}
|
|
57
|
+
const bgColorSet = new Set();
|
|
58
|
+
headers.forEach((header)=>{
|
|
59
|
+
var _header_style, _d3_color;
|
|
60
|
+
const bg = header === null || header === void 0 ? void 0 : (_header_style = header.style) === null || _header_style === void 0 ? void 0 : _header_style.backgroundColor;
|
|
61
|
+
const normalized = (_d3_color = _d3color.color(bg || '')) === null || _d3_color === void 0 ? void 0 : _d3_color.formatHex();
|
|
62
|
+
if (normalized) {
|
|
63
|
+
bgColorSet.add(normalized);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
let sharedBackgroundColor;
|
|
67
|
+
let useSharedBackground = false;
|
|
68
|
+
/*
|
|
69
|
+
If we have only one or two unique background colors, we can consider using a shared background color
|
|
70
|
+
for the table headers. This is to ensure better contrast with the foreground text.
|
|
71
|
+
For size 1, we will consider that as default color if it satisfies the contrast ratio.
|
|
72
|
+
There could also be a scenario where backgroundcolor array is of size 2, for eg: ["dimsgray", "gray"],
|
|
73
|
+
which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background
|
|
74
|
+
color won't run here. So will consider for size 2 as well.
|
|
75
|
+
For size greater than this, we will consider that user wants different colors and will let color contrast fail
|
|
76
|
+
if any.
|
|
77
|
+
*/ if (bgColorSet.size === 1 || bgColorSet.size === 2) {
|
|
78
|
+
const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];
|
|
79
|
+
for (const header of headers){
|
|
80
|
+
var _header_style;
|
|
81
|
+
const fg = header === null || header === void 0 ? void 0 : (_header_style = header.style) === null || _header_style === void 0 ? void 0 : _header_style.color;
|
|
82
|
+
if (fg && (0, _colors.getColorContrast)(fg, candidateBg) >= 3) {
|
|
83
|
+
sharedBackgroundColor = candidateBg;
|
|
84
|
+
useSharedBackground = true;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
30
89
|
return /*#__PURE__*/ _react.createElement("div", {
|
|
31
90
|
ref: (el)=>_rootElem.current = el,
|
|
32
91
|
className: classes.root,
|
|
@@ -54,15 +113,40 @@ const ChartTable = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
54
113
|
width: width ? `${width}px` : '100%',
|
|
55
114
|
height: height ? `${height}px` : '650px'
|
|
56
115
|
}
|
|
57
|
-
}, /*#__PURE__*/ _react.createElement("thead", null, /*#__PURE__*/ _react.createElement("tr", null, headers.map((header, idx)
|
|
116
|
+
}, /*#__PURE__*/ _react.createElement("thead", null, /*#__PURE__*/ _react.createElement("tr", null, headers.map((header, idx)=>{
|
|
117
|
+
const style = {
|
|
118
|
+
...header === null || header === void 0 ? void 0 : header.style
|
|
119
|
+
};
|
|
120
|
+
const fg = style.color;
|
|
121
|
+
const bg = style.backgroundColor;
|
|
122
|
+
if (useSharedBackground) {
|
|
123
|
+
style.backgroundColor = sharedBackgroundColor;
|
|
124
|
+
} else if (fg || bg) {
|
|
125
|
+
style.backgroundColor = getSafeBackgroundColor(fg, bg);
|
|
126
|
+
}
|
|
127
|
+
return /*#__PURE__*/ _react.createElement("th", {
|
|
58
128
|
key: idx,
|
|
59
|
-
className: classes.headerCell
|
|
60
|
-
|
|
129
|
+
className: classes.headerCell,
|
|
130
|
+
style: style,
|
|
131
|
+
tabIndex: 0
|
|
132
|
+
}, header.value);
|
|
133
|
+
}))), rows && rows.length > 0 && /*#__PURE__*/ _react.createElement("tbody", null, rows.map((row, rowIdx)=>/*#__PURE__*/ _react.createElement("tr", {
|
|
61
134
|
key: rowIdx
|
|
62
|
-
}, row.map((cell, colIdx)
|
|
135
|
+
}, row.map((cell, colIdx)=>{
|
|
136
|
+
const style = {
|
|
137
|
+
...cell === null || cell === void 0 ? void 0 : cell.style
|
|
138
|
+
};
|
|
139
|
+
const fg = style.color;
|
|
140
|
+
const bg = style.backgroundColor;
|
|
141
|
+
if (fg || bg) {
|
|
142
|
+
style.backgroundColor = getSafeBackgroundColor(fg, bg);
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/ _react.createElement("td", {
|
|
63
145
|
key: colIdx,
|
|
64
146
|
className: classes.bodyCell,
|
|
65
|
-
style:
|
|
66
|
-
|
|
147
|
+
style: style,
|
|
148
|
+
tabIndex: 0
|
|
149
|
+
}, cell.value);
|
|
150
|
+
})))))))));
|
|
67
151
|
});
|
|
68
152
|
ChartTable.displayName = 'ChartTable';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ChartTable/ChartTable.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChartTableProps } from './ChartTable.types';\nimport { useChartTableStyles } from './useChartTableStyles.styles';\nimport { useRtl } from '../../utilities/utilities';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nexport const ChartTable: React.FunctionComponent<ChartTableProps> = React.forwardRef<HTMLDivElement, ChartTableProps>(\n (props, forwardedRef) => {\n const { headers, rows, width, height } = props;\n const _isRTL: boolean = useRtl();\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\n const classes = useChartTableStyles(props);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, undefined, _isRTL, opts);\n },\n }),\n [],\n );\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n return (\n <div\n ref={el => (_rootElem.current = el)}\n className={classes.root as string}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classes.table}\n style={{\n width: width ? `${width}px` : '100%',\n height: height ? `${height}px` : '650px',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => (\n <th key={idx} className={classes.headerCell}>\n {header.value}\n </th>\n ))}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => (\n <td key={colIdx} className={classes.bodyCell} style={cell.style}>\n {cell.value}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n },\n);\n\nChartTable.displayName = 'ChartTable';\n"],"names":["React","useChartTableStyles","useRtl","toImage","ChartTable","forwardRef","props","forwardedRef","headers","rows","width","height","_isRTL","_rootElem","useRef","classes","useImperativeHandle","componentRef","chartContainer","current","opts","undefined","length","div","ref","el","className","root","style","overflow","svg","foreignObject","x","y","maxHeight","overflowY","overflowX","table","thead","tr","map","header","idx","th","key","headerCell","value","tbody","row","rowIdx","cell","colIdx","td","bodyCell","displayName"],"mappings":";;;;+BAOaI;;;;;;;iEAPU,QAAQ;2CAEK,+BAA+B;2BAC5C,4BAA4B;kCAE3B,qCAAqC;AAEtD,mBAAMA,WAAAA,GAAuDJ,OAAMK,UAAU,CAClF,CAACC,OAAOC;IACN,MAAM,EAAEC,OAAO,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGL;IACzC,MAAMM,SAAkBV,qBAAAA;IACxB,MAAMW,YAAYb,OAAMc,MAAM,CAAwB;IACtD,MAAMC,cAAUd,8CAAAA,EAAoBK;IAEpCN,OAAMgB,mBAAmB,CACvBV,MAAMW,YAAY,EAClB,IAAO;YACLC,gBAAgBL,UAAUM,OAAO;YACjChB,SAAS,CAACiB;gBACR,WAAOjB,yBAAAA,EAAQU,UAAUM,OAAO,EAAEE,WAAWT,QAAQQ;YACvD;QACF,CAAA,GACA,EAAE;IAGJ,IAAI,CAACZ,WAAWA,QAAQc,MAAM,KAAK,GAAG;QACpC,OAAA,WAAA,GAAO,OAAA,aAAA,CAACC,OAAAA,MAAI;IACd;IAEA,OAAA,WAAA,GACE,OAAA,aAAA,CAACA,OAAAA;QACCC,KAAKC,CAAAA,KAAOZ,UAAUM,OAAO,GAAGM;QAChCC,WAAWX,QAAQY,IAAI;QACvBC,OAAO;YAAEjB,QAAQA,SAAS,GAAGA,OAAO,EAAE,CAAC,GAAG;YAASkB,UAAU;QAAS;qBAEtE,OAAA,aAAA,CAACC,OAAAA;QAAIpB,OAAOA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,QAAS;QAAQC,QAAQA,WAAAA,QAAAA,WAAAA,KAAAA,IAAAA,SAAU;qBAC7C,OAAA,aAAA,CAACoB,iBAAAA;QAAcC,GAAE;QAAIC,GAAE;QAAIvB,OAAM;QAAOC,QAAO;qBAC7C,OAAA,aAAA,CAACY,OAAAA;QACCK,OAAO;YACLM,WAAWvB,SAAS,GAAGA,OAAO,EAAE,CAAC,GAAG;YACpCwB,WAAW;YACXC,WAAW;QACb;qBAEA,OAAA,aAAA,CAACC,SAAAA;QACCX,WAAWX,QAAQsB,KAAK;QACxBT,OAAO;YACLlB,OAAOA,QAAQ,GAAGA,MAAM,EAAE,CAAC,GAAG;YAC9BC,QAAQA,SAAS,GAAGA,OAAO,EAAE,CAAC,GAAG;QACnC;qBAEA,OAAA,aAAA,CAAC2B,SAAAA,MAAAA,WAAAA,GACC,OAAA,aAAA,CAACC,MAAAA,MACE/B,QAAQgC,GAAG,CAAC,CAACC,QAAQC,MAAAA,WAAAA,GACpB,OAAA,aAAA,CAACC,MAAAA;YAAGC,KAAKF;YAAKhB,WAAWX,QAAQ8B,UAAU;WACxCJ,OAAOK,KAAK,MAKpBrC,QAAQA,KAAKa,MAAM,GAAG,KAAA,WAAA,GACrB,OAAA,aAAA,CAACyB,SAAAA,MACEtC,KAAK+B,GAAG,CAAC,CAACQ,KAAKC,SAAAA,WAAAA,GACd,OAAA,aAAA,CAACV,MAAAA;YAAGK,KAAKK;WACND,IAAIR,GAAG,CAAC,CAACU,MAAMC,SAAAA,WAAAA,GACd,OAAA,aAAA,CAACC,MAAAA;gBAAGR,KAAKO;gBAAQzB,WAAWX,QAAQsC,QAAQ;gBAAEzB,OAAOsB,KAAKtB,KAAK;eAC5DsB,KAAKJ,KAAK;AAarC,GACA;AAEF1C,WAAWkD,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/ChartTable/ChartTable.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChartTableProps } from './ChartTable.types';\nimport { useChartTableStyles } from './useChartTableStyles.styles';\nimport { useRtl } from '../../utilities/utilities';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\nimport { tokens } from '@fluentui/react-theme';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\n\nfunction invertHexColor(hex: string): string {\n const color = d3.color(hex);\n if (!color) {\n return tokens.colorNeutralForeground1!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(foreground?: string, background?: string): string {\n const fallbackFg = tokens.colorNeutralForeground1;\n const fallbackBg = tokens.colorNeutralBackground1;\n\n const fg = d3.color(foreground || fallbackFg);\n const bg = d3.color(background || fallbackBg);\n if (!fg || !bg) {\n return fallbackBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex());\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\n\nexport const ChartTable: React.FunctionComponent<ChartTableProps> = React.forwardRef<HTMLDivElement, ChartTableProps>(\n (props, forwardedRef) => {\n const { headers, rows, width, height } = props;\n const _isRTL: boolean = useRtl();\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\n const classes = useChartTableStyles(props);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, undefined, _isRTL, opts);\n },\n }),\n [],\n );\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\n }\n\n return (\n <div\n ref={el => (_rootElem.current = el)}\n className={classes.root as string}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classes.table}\n style={{\n width: width ? `${width}px` : '100%',\n height: height ? `${height}px` : '650px',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => {\n const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(fg, bg);\n }\n return (\n <th key={idx} className={classes.headerCell} style={style} tabIndex={0}>\n {header.value}\n </th>\n );\n })}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => {\n const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(fg, bg);\n }\n return (\n <td key={colIdx} className={classes.bodyCell} style={style} tabIndex={0}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n },\n);\n\nChartTable.displayName = 'ChartTable';\n"],"names":["React","useChartTableStyles","useRtl","toImage","tokens","d3","getColorContrast","invertHexColor","hex","color","colorNeutralForeground1","rgb","r","g","b","formatHex","getSafeBackgroundColor","foreground","background","fallbackFg","fallbackBg","colorNeutralBackground1","fg","bg","contrast","invertedBg","invertedContrast","ChartTable","forwardRef","props","forwardedRef","headers","rows","width","height","_isRTL","_rootElem","useRef","classes","useImperativeHandle","componentRef","chartContainer","current","opts","undefined","length","div","bgColorSet","Set","forEach","header","style","backgroundColor","normalized","add","sharedBackgroundColor","useSharedBackground","size","candidateBg","Array","from","ref","el","className","root","overflow","svg","foreignObject","x","y","maxHeight","overflowY","overflowX","table","thead","tr","map","idx","th","key","headerCell","tabIndex","value","tbody","row","rowIdx","cell","colIdx","td","bodyCell","displayName"],"mappings":"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"}
|
|
@@ -46,10 +46,12 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
46
46
|
const [containerHeight, setContainerHeight] = _react.useState(0);
|
|
47
47
|
const [startFromX, setStartFromX] = _react.useState(0);
|
|
48
48
|
const [prevProps, setPrevProps] = _react.useState(null);
|
|
49
|
-
const
|
|
49
|
+
const chartTypesWithStringYAxis = [
|
|
50
50
|
_index.ChartTypes.HorizontalBarChartWithAxis,
|
|
51
51
|
_index.ChartTypes.HeatMapChart,
|
|
52
|
-
_index.ChartTypes.
|
|
52
|
+
_index.ChartTypes.VerticalStackedBarChart,
|
|
53
|
+
_index.ChartTypes.GanttChart,
|
|
54
|
+
_index.ChartTypes.ScatterChart
|
|
53
55
|
];
|
|
54
56
|
var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
|
|
55
57
|
/**
|
|
@@ -64,17 +66,35 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
64
66
|
right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
|
|
65
67
|
left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
|
|
66
68
|
};
|
|
69
|
+
const TITLE_MARGIN_HORIZONTAL = 24;
|
|
70
|
+
const TITLE_MARGIN_VERTICAL = 20;
|
|
67
71
|
if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
|
|
68
72
|
var _props_margins6;
|
|
69
73
|
var _props_margins_bottom1;
|
|
70
|
-
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 :
|
|
74
|
+
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : margins.bottom + TITLE_MARGIN_VERTICAL;
|
|
71
75
|
}
|
|
72
76
|
if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
|
|
73
77
|
var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
|
|
74
78
|
var _props_margins_right2, _props_margins_left2;
|
|
75
|
-
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ?
|
|
79
|
+
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : margins.left + TITLE_MARGIN_HORIZONTAL;
|
|
76
80
|
var _props_margins_left3, _props_margins_right3;
|
|
77
|
-
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 :
|
|
81
|
+
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : margins.left + TITLE_MARGIN_HORIZONTAL : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
82
|
+
}
|
|
83
|
+
if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
|
|
84
|
+
var _props_margins11;
|
|
85
|
+
var _props_margins_top1;
|
|
86
|
+
margins.top = (_props_margins_top1 = (_props_margins11 = props.margins) === null || _props_margins11 === void 0 ? void 0 : _props_margins11.top) !== null && _props_margins_top1 !== void 0 ? _props_margins_top1 : margins.top + TITLE_MARGIN_VERTICAL;
|
|
87
|
+
}
|
|
88
|
+
if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
|
|
89
|
+
if (_useRtl) {
|
|
90
|
+
var _props_margins12;
|
|
91
|
+
var _props_margins_right4;
|
|
92
|
+
margins.left = (_props_margins_right4 = (_props_margins12 = props.margins) === null || _props_margins12 === void 0 ? void 0 : _props_margins12.right) !== null && _props_margins_right4 !== void 0 ? _props_margins_right4 : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
93
|
+
} else {
|
|
94
|
+
var _props_margins13;
|
|
95
|
+
var _props_margins_right5;
|
|
96
|
+
margins.right = (_props_margins_right5 = (_props_margins13 = props.margins) === null || _props_margins13 === void 0 ? void 0 : _props_margins13.right) !== null && _props_margins_right5 !== void 0 ? _props_margins_right5 : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
97
|
+
}
|
|
78
98
|
}
|
|
79
99
|
const classes = (0, _useCartesianChartStylesstyles.useCartesianChartStyles)(props);
|
|
80
100
|
const focusAttributes = (0, _reacttabster.useFocusableGroup)();
|
|
@@ -87,8 +107,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
87
107
|
if (props !== null) {
|
|
88
108
|
setPrevProps(props);
|
|
89
109
|
}
|
|
90
|
-
if (
|
|
91
|
-
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(
|
|
110
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
111
|
+
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
92
112
|
if (startFromX !== maxYAxisLabelLength) {
|
|
93
113
|
setStartFromX(maxYAxisLabelLength);
|
|
94
114
|
}
|
|
@@ -110,8 +130,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
110
130
|
_fitParentContainer();
|
|
111
131
|
}
|
|
112
132
|
}
|
|
113
|
-
if (
|
|
114
|
-
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(
|
|
133
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
134
|
+
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
115
135
|
if (startFromX !== maxYAxisLabelLength) {
|
|
116
136
|
setStartFromX(maxYAxisLabelLength);
|
|
117
137
|
}
|
|
@@ -142,19 +162,14 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
142
162
|
function _generateCallout(calloutProps) {
|
|
143
163
|
return /*#__PURE__*/ _react.createElement(_ChartPopover.ChartPopover, calloutProps);
|
|
144
164
|
}
|
|
145
|
-
function calculateMaxYAxisLabelLength(
|
|
165
|
+
function calculateMaxYAxisLabelLength(className) {
|
|
146
166
|
const formatTickLabel = (str)=>{
|
|
147
167
|
if (props.showYAxisLablesTooltip) {
|
|
148
168
|
return (0, _index.truncateString)(str, props.noOfCharsToTruncate || 4);
|
|
149
169
|
}
|
|
150
170
|
return str;
|
|
151
171
|
};
|
|
152
|
-
|
|
153
|
-
var _points__data, _points_;
|
|
154
|
-
return (0, _index.calculateLongestLabelWidth)((_points_ = points[0]) === null || _points_ === void 0 ? void 0 : (_points__data = _points_.data) === null || _points__data === void 0 ? void 0 : _points__data.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
|
|
155
|
-
} else {
|
|
156
|
-
return (0, _index.calculateLongestLabelWidth)(points === null || points === void 0 ? void 0 : points.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
|
|
157
|
-
}
|
|
172
|
+
return (0, _index.calculateLongestLabelWidth)(props.stringDatasetForYAxisDomain.map((label)=>formatTickLabel(label)), `.${className} text`);
|
|
158
173
|
}
|
|
159
174
|
const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
|
|
160
175
|
if (props.parentRef) {
|
|
@@ -163,7 +178,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
163
178
|
const margin = {
|
|
164
179
|
...margins
|
|
165
180
|
};
|
|
166
|
-
|
|
181
|
+
// Note: This check is unnecessary since startFromX is only set for charts with string y-axis.
|
|
182
|
+
if (chartTypesWithStringYAxis.includes(props.chartType)) {
|
|
167
183
|
if (!_useRtl) {
|
|
168
184
|
margin.left += startFromX;
|
|
169
185
|
} else {
|
|
@@ -175,6 +191,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
175
191
|
let callout = null;
|
|
176
192
|
let children = null;
|
|
177
193
|
if (props.enableFirstRenderOptimization && chartContainer.current || !props.enableFirstRenderOptimization) {
|
|
194
|
+
var _props_xAxis, _props_xAxis1, _props_yAxis, _props_yAxis1;
|
|
178
195
|
_isFirstRender.current = false;
|
|
179
196
|
var _props_showRoundOffXTickValues;
|
|
180
197
|
const XAxisParams = {
|
|
@@ -197,7 +214,9 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
197
214
|
xAxisOuterPadding: props.xAxisOuterPadding,
|
|
198
215
|
containerWidth: containerWidth,
|
|
199
216
|
hideTickOverlap: props.rotateXAxisLables ? false : props.hideTickOverlap,
|
|
200
|
-
calcMaxLabelWidth: _calcMaxLabelWidthWithTransform
|
|
217
|
+
calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,
|
|
218
|
+
tickStep: (_props_xAxis = props.xAxis) === null || _props_xAxis === void 0 ? void 0 : _props_xAxis.tickStep,
|
|
219
|
+
tick0: (_props_xAxis1 = props.xAxis) === null || _props_xAxis1 === void 0 ? void 0 : _props_xAxis1.tick0
|
|
201
220
|
};
|
|
202
221
|
/**
|
|
203
222
|
* These scales used for 2 purposes.
|
|
@@ -209,7 +228,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
209
228
|
let tickValues;
|
|
210
229
|
switch(props.xAxisType){
|
|
211
230
|
case _index.XAxisTypes.NumericAxis:
|
|
212
|
-
({ xScale, tickValues } = (0, _index.createNumericXAxis)(XAxisParams, props.tickParams, props.chartType, culture));
|
|
231
|
+
({ xScale, tickValues } = (0, _index.createNumericXAxis)(XAxisParams, props.tickParams, props.chartType, culture, props.xScaleType));
|
|
213
232
|
break;
|
|
214
233
|
case _index.XAxisTypes.DateAxis:
|
|
215
234
|
({ xScale, tickValues } = (0, _index.createDateXAxis)(XAxisParams, props.tickParams, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter, props.useUTC, props.chartType));
|
|
@@ -218,7 +237,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
218
237
|
({ xScale, tickValues } = (0, _index.createStringXAxis)(XAxisParams, props.tickParams, props.datasetForXAxisDomain, culture));
|
|
219
238
|
break;
|
|
220
239
|
default:
|
|
221
|
-
({ xScale, tickValues } = (0, _index.createNumericXAxis)(XAxisParams, props.tickParams, props.chartType, culture));
|
|
240
|
+
({ xScale, tickValues } = (0, _index.createNumericXAxis)(XAxisParams, props.tickParams, props.chartType, culture, props.xScaleType));
|
|
222
241
|
}
|
|
223
242
|
_xScale = xScale;
|
|
224
243
|
_tickValues = tickValues;
|
|
@@ -238,7 +257,10 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
238
257
|
// please note these padding default values must be consistent in here
|
|
239
258
|
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
240
259
|
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
241
|
-
yAxisPadding: props.yAxisPadding || 0
|
|
260
|
+
yAxisPadding: props.yAxisPadding || 0,
|
|
261
|
+
tickValues: props.yAxisTickValues,
|
|
262
|
+
tickStep: (_props_yAxis = props.yAxis) === null || _props_yAxis === void 0 ? void 0 : _props_yAxis.tickStep,
|
|
263
|
+
tick0: (_props_yAxis1 = props.yAxis) === null || _props_yAxis1 === void 0 ? void 0 : _props_yAxis1.tick0
|
|
242
264
|
};
|
|
243
265
|
/**
|
|
244
266
|
* These scales used for 2 purposes.
|
|
@@ -253,7 +275,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
253
275
|
yAxisDomainValues: []
|
|
254
276
|
};
|
|
255
277
|
if (props.yAxisType && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
256
|
-
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth);
|
|
278
|
+
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth, props.chartType);
|
|
257
279
|
} else {
|
|
258
280
|
// TODO: Since the scale domain values are now computed independently for both the primary and
|
|
259
281
|
// secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately
|
|
@@ -276,11 +298,11 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
276
298
|
yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType, true),
|
|
277
299
|
yAxisPadding: props.yAxisPadding
|
|
278
300
|
};
|
|
279
|
-
yScaleSecondary = props.createYAxis(YAxisParamsSecondary, _useRtl, axisData, isIntegralDataset, chartType, true, props.roundedTicks);
|
|
301
|
+
yScaleSecondary = props.createYAxis(YAxisParamsSecondary, _useRtl, axisData, isIntegralDataset, chartType, true, props.roundedTicks, props.secondaryYScaleType);
|
|
280
302
|
}
|
|
281
|
-
yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks);
|
|
303
|
+
yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks, props.yScaleType);
|
|
282
304
|
}
|
|
283
|
-
if (
|
|
305
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
284
306
|
// Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
|
|
285
307
|
// of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
|
|
286
308
|
// in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
|
|
@@ -335,6 +357,12 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
335
357
|
};
|
|
336
358
|
const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
|
|
337
359
|
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - titleMargin;
|
|
360
|
+
const commonSvgToolTipProps = {
|
|
361
|
+
wrapContent: _index.wrapContent,
|
|
362
|
+
showBackground: true,
|
|
363
|
+
className: classes.svgTooltip,
|
|
364
|
+
content: ''
|
|
365
|
+
};
|
|
338
366
|
/**
|
|
339
367
|
* When screen resizes, along with screen, chart also auto adjusted.
|
|
340
368
|
* This method used to adjust height and width of the charts.
|
|
@@ -494,6 +522,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
494
522
|
transform: `translate(0, ${svgDimensions.height - margins.bottom - _removalValueForTextTuncate})`,
|
|
495
523
|
className: classes.xAxis
|
|
496
524
|
}), props.xAxisTitle !== undefined && props.xAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
525
|
+
...commonSvgToolTipProps,
|
|
497
526
|
content: props.xAxisTitle,
|
|
498
527
|
textProps: {
|
|
499
528
|
x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
@@ -501,10 +530,18 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
501
530
|
className: classes.axisTitle,
|
|
502
531
|
textAnchor: 'middle'
|
|
503
532
|
},
|
|
504
|
-
maxWidth: xAxisTitleMaximumAllowedWidth
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
533
|
+
maxWidth: xAxisTitleMaximumAllowedWidth
|
|
534
|
+
}), props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
535
|
+
...commonSvgToolTipProps,
|
|
536
|
+
content: props.xAxisAnnotation,
|
|
537
|
+
textProps: {
|
|
538
|
+
x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
539
|
+
y: titleMargin + 3,
|
|
540
|
+
className: classes.axisAnnotation,
|
|
541
|
+
textAnchor: 'middle',
|
|
542
|
+
'aria-hidden': true
|
|
543
|
+
},
|
|
544
|
+
maxWidth: xAxisTitleMaximumAllowedWidth
|
|
508
545
|
}), /*#__PURE__*/ _react.createElement("g", {
|
|
509
546
|
ref: (e)=>{
|
|
510
547
|
yAxisElement.current = e;
|
|
@@ -520,6 +557,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
520
557
|
transform: `translate(${_useRtl ? margins.left + startFromX : svgDimensions.width - margins.right - startFromX}, 0)`,
|
|
521
558
|
className: classes.yAxis
|
|
522
559
|
}), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
560
|
+
...commonSvgToolTipProps,
|
|
523
561
|
content: props.secondaryYAxistitle,
|
|
524
562
|
textProps: {
|
|
525
563
|
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
@@ -529,11 +567,9 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
529
567
|
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
530
568
|
className: classes.axisTitle
|
|
531
569
|
},
|
|
532
|
-
maxWidth: yAxisTitleMaximumAllowedHeight
|
|
533
|
-
wrapContent: _index.wrapContent,
|
|
534
|
-
showBackground: true,
|
|
535
|
-
className: classes.svgTooltip
|
|
570
|
+
maxWidth: yAxisTitleMaximumAllowedHeight
|
|
536
571
|
})), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
572
|
+
...commonSvgToolTipProps,
|
|
537
573
|
content: props.yAxisTitle,
|
|
538
574
|
textProps: {
|
|
539
575
|
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
@@ -543,10 +579,20 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
543
579
|
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
544
580
|
className: classes.axisTitle
|
|
545
581
|
},
|
|
546
|
-
maxWidth: yAxisTitleMaximumAllowedHeight
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
582
|
+
maxWidth: yAxisTitleMaximumAllowedHeight
|
|
583
|
+
}), props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
584
|
+
...commonSvgToolTipProps,
|
|
585
|
+
content: props.yAxisAnnotation,
|
|
586
|
+
textProps: {
|
|
587
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
588
|
+
y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
|
|
589
|
+
textAnchor: 'middle',
|
|
590
|
+
transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
|
|
591
|
+
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
592
|
+
className: classes.axisAnnotation,
|
|
593
|
+
'aria-hidden': true
|
|
594
|
+
},
|
|
595
|
+
maxWidth: yAxisTitleMaximumAllowedHeight
|
|
550
596
|
}))), !props.hideLegend && /*#__PURE__*/ _react.createElement("div", {
|
|
551
597
|
ref: (e)=>legendContainer = e,
|
|
552
598
|
className: classes.legendContainer
|