@fluentui/react-charts 9.2.0 → 9.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -3
- package/dist/index.d.ts +84 -5
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +57 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +110 -81
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +20 -10
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +95 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +161 -141
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -11
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +57 -51
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +26 -37
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +68 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +109 -80
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +19 -9
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +120 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +159 -139
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +11 -10
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +56 -50
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +29 -37
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
chartTableClassNames: function() {
|
|
13
|
+
return chartTableClassNames;
|
|
14
|
+
},
|
|
15
|
+
useChartTableStyles: function() {
|
|
16
|
+
return useChartTableStyles;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const chartTableClassNames = {
|
|
21
|
+
root: 'fui-ChartTable__root',
|
|
22
|
+
table: 'fui-ChartTable__table',
|
|
23
|
+
headerCell: 'fui-ChartTable__headerCell',
|
|
24
|
+
bodyCell: 'fui-ChartTable__bodyCell',
|
|
25
|
+
chart: 'fui-ChartTable__chart'
|
|
26
|
+
};
|
|
27
|
+
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
28
|
+
root: {
|
|
29
|
+
a9b677: "fly5x3f",
|
|
30
|
+
B68tc82: "f1oy3dpc"
|
|
31
|
+
},
|
|
32
|
+
table: {
|
|
33
|
+
po53p8: "fgkb47j"
|
|
34
|
+
},
|
|
35
|
+
headerCell: {
|
|
36
|
+
Bahqtrf: "fk6fouc",
|
|
37
|
+
Be2twd7: "fy9rknc",
|
|
38
|
+
Bhrd7zp: "fl43uef",
|
|
39
|
+
Bg96gwp: "fwrc4pm",
|
|
40
|
+
De3pzq: "f16xq7d1",
|
|
41
|
+
sj55zd: "f19n0e5",
|
|
42
|
+
z8tnut: "f17mpqex",
|
|
43
|
+
z189sj: [
|
|
44
|
+
"f1vdfbxk",
|
|
45
|
+
"f1f5gg8d"
|
|
46
|
+
],
|
|
47
|
+
Byoj8tv: "fdvome7",
|
|
48
|
+
uwmqm3: [
|
|
49
|
+
"f1f5gg8d",
|
|
50
|
+
"f1vdfbxk"
|
|
51
|
+
],
|
|
52
|
+
fsow6f: [
|
|
53
|
+
"f1o700av",
|
|
54
|
+
"fes3tcz"
|
|
55
|
+
],
|
|
56
|
+
B4j52fo: "f18zi460",
|
|
57
|
+
Bekrc4i: [
|
|
58
|
+
"f1wpluaz",
|
|
59
|
+
"fsfsuhs"
|
|
60
|
+
],
|
|
61
|
+
Bn0qgzm: "fmklw6v",
|
|
62
|
+
ibv6hh: [
|
|
63
|
+
"fsfsuhs",
|
|
64
|
+
"f1wpluaz"
|
|
65
|
+
],
|
|
66
|
+
icvyot: "fzkkow9",
|
|
67
|
+
vrafjx: [
|
|
68
|
+
"fcdblym",
|
|
69
|
+
"fjik90z"
|
|
70
|
+
],
|
|
71
|
+
oivjwe: "fg706s2",
|
|
72
|
+
wvpqe5: [
|
|
73
|
+
"fjik90z",
|
|
74
|
+
"fcdblym"
|
|
75
|
+
],
|
|
76
|
+
g2u3we: "f68mrw8",
|
|
77
|
+
h3c5rm: [
|
|
78
|
+
"f7pw515",
|
|
79
|
+
"fw35ms5"
|
|
80
|
+
],
|
|
81
|
+
B9xav0g: "frpde29",
|
|
82
|
+
zhjwy3: [
|
|
83
|
+
"fw35ms5",
|
|
84
|
+
"f7pw515"
|
|
85
|
+
],
|
|
86
|
+
Bsw6fvg: "f8pusc0",
|
|
87
|
+
Bbusuzp: "fqgauei"
|
|
88
|
+
},
|
|
89
|
+
bodyCell: {
|
|
90
|
+
Bahqtrf: "fk6fouc",
|
|
91
|
+
Be2twd7: "fy9rknc",
|
|
92
|
+
Bhrd7zp: "figsok6",
|
|
93
|
+
Bg96gwp: "fwrc4pm",
|
|
94
|
+
z8tnut: "f17mpqex",
|
|
95
|
+
z189sj: [
|
|
96
|
+
"f1vdfbxk",
|
|
97
|
+
"f1f5gg8d"
|
|
98
|
+
],
|
|
99
|
+
Byoj8tv: "fdvome7",
|
|
100
|
+
uwmqm3: [
|
|
101
|
+
"f1f5gg8d",
|
|
102
|
+
"f1vdfbxk"
|
|
103
|
+
],
|
|
104
|
+
B4j52fo: "f18zi460",
|
|
105
|
+
Bekrc4i: [
|
|
106
|
+
"f1wpluaz",
|
|
107
|
+
"fsfsuhs"
|
|
108
|
+
],
|
|
109
|
+
Bn0qgzm: "fmklw6v",
|
|
110
|
+
ibv6hh: [
|
|
111
|
+
"fsfsuhs",
|
|
112
|
+
"f1wpluaz"
|
|
113
|
+
],
|
|
114
|
+
icvyot: "fzkkow9",
|
|
115
|
+
vrafjx: [
|
|
116
|
+
"fcdblym",
|
|
117
|
+
"fjik90z"
|
|
118
|
+
],
|
|
119
|
+
oivjwe: "fg706s2",
|
|
120
|
+
wvpqe5: [
|
|
121
|
+
"fjik90z",
|
|
122
|
+
"fcdblym"
|
|
123
|
+
],
|
|
124
|
+
g2u3we: "f68mrw8",
|
|
125
|
+
h3c5rm: [
|
|
126
|
+
"f7pw515",
|
|
127
|
+
"fw35ms5"
|
|
128
|
+
],
|
|
129
|
+
B9xav0g: "frpde29",
|
|
130
|
+
zhjwy3: [
|
|
131
|
+
"fw35ms5",
|
|
132
|
+
"f7pw515"
|
|
133
|
+
],
|
|
134
|
+
sj55zd: "f19n0e5",
|
|
135
|
+
fsow6f: [
|
|
136
|
+
"f1o700av",
|
|
137
|
+
"fes3tcz"
|
|
138
|
+
],
|
|
139
|
+
Bbusuzp: "fqgauei"
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
d: [
|
|
143
|
+
".fly5x3f{width:100%;}",
|
|
144
|
+
".f1oy3dpc{overflow-x:auto;}",
|
|
145
|
+
".fgkb47j{border-collapse:collapse;}",
|
|
146
|
+
".fk6fouc{font-family:var(--fontFamilyBase);}",
|
|
147
|
+
".fy9rknc{font-size:var(--fontSizeBase200);}",
|
|
148
|
+
".fl43uef{font-weight:var(--fontWeightSemibold);}",
|
|
149
|
+
".fwrc4pm{line-height:var(--lineHeightBase200);}",
|
|
150
|
+
".f16xq7d1{background-color:var(--colorNeutralBackground3);}",
|
|
151
|
+
".f19n0e5{color:var(--colorNeutralForeground1);}",
|
|
152
|
+
".f17mpqex{padding-top:var(--spacingHorizontalS);}",
|
|
153
|
+
".f1vdfbxk{padding-right:var(--spacingHorizontalS);}",
|
|
154
|
+
".f1f5gg8d{padding-left:var(--spacingHorizontalS);}",
|
|
155
|
+
".fdvome7{padding-bottom:var(--spacingHorizontalS);}",
|
|
156
|
+
".f1o700av{text-align:left;}",
|
|
157
|
+
".fes3tcz{text-align:right;}",
|
|
158
|
+
".f18zi460{border-top-width:var(--strokeWidthThick);}",
|
|
159
|
+
".f1wpluaz{border-right-width:var(--strokeWidthThick);}",
|
|
160
|
+
".fsfsuhs{border-left-width:var(--strokeWidthThick);}",
|
|
161
|
+
".fmklw6v{border-bottom-width:var(--strokeWidthThick);}",
|
|
162
|
+
".fzkkow9{border-top-style:solid;}",
|
|
163
|
+
".fcdblym{border-right-style:solid;}",
|
|
164
|
+
".fjik90z{border-left-style:solid;}",
|
|
165
|
+
".fg706s2{border-bottom-style:solid;}",
|
|
166
|
+
".f68mrw8{border-top-color:var(--colorNeutralStroke2);}",
|
|
167
|
+
".f7pw515{border-right-color:var(--colorNeutralStroke2);}",
|
|
168
|
+
".fw35ms5{border-left-color:var(--colorNeutralStroke2);}",
|
|
169
|
+
".frpde29{border-bottom-color:var(--colorNeutralStroke2);}",
|
|
170
|
+
".figsok6{font-weight:var(--fontWeightRegular);}"
|
|
171
|
+
],
|
|
172
|
+
m: [
|
|
173
|
+
[
|
|
174
|
+
"@media (forced-colors: active){.f8pusc0{background-color:Window;}}",
|
|
175
|
+
{
|
|
176
|
+
m: "(forced-colors: active)"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"@media (forced-colors: active){.fqgauei{color:WindowText;}}",
|
|
181
|
+
{
|
|
182
|
+
m: "(forced-colors: active)"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
const useChartTableStyles = (props)=>{
|
|
188
|
+
const baseStyles = useStyles();
|
|
189
|
+
return {
|
|
190
|
+
root: (0, _react.mergeClasses)(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),
|
|
191
|
+
table: (0, _react.mergeClasses)(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
|
|
192
|
+
headerCell: (0, _react.mergeClasses)(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
|
|
193
|
+
bodyCell: (0, _react.mergeClasses)(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
|
|
194
|
+
chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ )
|
|
195
|
+
};
|
|
196
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useChartTableStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const chartTableClassNames = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart'\n};\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto'\n },\n table: {\n borderCollapse: 'collapse'\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n textAlign: 'left',\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText'\n }\n },\n bodyCell: {\n ...typographyStyles.caption1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText'\n }\n }\n});\n/**\n * Apply styling to the ChartTable slots based on the state\n */ export const useChartTableStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ )\n };\n};\n"],"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","a9b677","B68tc82","po53p8","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","De3pzq","sj55zd","z8tnut","z189sj","Byoj8tv","uwmqm3","fsow6f","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bsw6fvg","Bbusuzp","d","m","useChartTableStyles","props","baseStyles"],"mappings":"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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
chartTableClassNames: function() {
|
|
13
|
+
return chartTableClassNames;
|
|
14
|
+
},
|
|
15
|
+
useChartTableStyles: function() {
|
|
16
|
+
return useChartTableStyles;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const _reacttheme = require("@fluentui/react-theme");
|
|
21
|
+
const chartTableClassNames = {
|
|
22
|
+
root: 'fui-ChartTable__root',
|
|
23
|
+
table: 'fui-ChartTable__table',
|
|
24
|
+
headerCell: 'fui-ChartTable__headerCell',
|
|
25
|
+
bodyCell: 'fui-ChartTable__bodyCell',
|
|
26
|
+
chart: 'fui-ChartTable__chart'
|
|
27
|
+
};
|
|
28
|
+
const useStyles = (0, _react.makeStyles)({
|
|
29
|
+
root: {
|
|
30
|
+
width: '100%',
|
|
31
|
+
overflowX: 'auto'
|
|
32
|
+
},
|
|
33
|
+
table: {
|
|
34
|
+
borderCollapse: 'collapse'
|
|
35
|
+
},
|
|
36
|
+
headerCell: {
|
|
37
|
+
..._reacttheme.typographyStyles.caption1,
|
|
38
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold,
|
|
39
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground3,
|
|
40
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
41
|
+
..._react.shorthands.padding(_reacttheme.tokens.spacingHorizontalS),
|
|
42
|
+
textAlign: 'left',
|
|
43
|
+
..._react.shorthands.border(_reacttheme.tokens.strokeWidthThick, 'solid', _reacttheme.tokens.colorNeutralStroke2),
|
|
44
|
+
'@media (forced-colors: active)': {
|
|
45
|
+
backgroundColor: 'Window',
|
|
46
|
+
color: 'WindowText'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
bodyCell: {
|
|
50
|
+
..._reacttheme.typographyStyles.caption1,
|
|
51
|
+
..._react.shorthands.padding(_reacttheme.tokens.spacingHorizontalS),
|
|
52
|
+
..._react.shorthands.border(_reacttheme.tokens.strokeWidthThick, 'solid', _reacttheme.tokens.colorNeutralStroke2),
|
|
53
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
54
|
+
textAlign: 'left',
|
|
55
|
+
'@media (forced-colors: active)': {
|
|
56
|
+
color: 'WindowText'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const useChartTableStyles = (props)=>{
|
|
61
|
+
const baseStyles = useStyles();
|
|
62
|
+
return {
|
|
63
|
+
root: (0, _react.mergeClasses)(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),
|
|
64
|
+
table: (0, _react.mergeClasses)(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
|
|
65
|
+
headerCell: (0, _react.mergeClasses)(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
|
|
66
|
+
bodyCell: (0, _react.mergeClasses)(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
|
|
67
|
+
chart: (0, _react.mergeClasses)(chartTableClassNames.chart /*props.styles?.chart*/ )
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ChartTable/useChartTableStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { ChartTableProps, ChartTableStyles } from './ChartTable.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\n/**\n * @internal\n */\nexport const chartTableClassNames: SlotClassNames<ChartTableStyles> = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart',\n};\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto',\n },\n table: {\n borderCollapse: 'collapse',\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n textAlign: 'left',\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText',\n },\n },\n bodyCell: {\n ...typographyStyles.caption1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText',\n },\n },\n});\n\n/**\n * Apply styling to the ChartTable slots based on the state\n */\nexport const useChartTableStyles = (props: ChartTableProps): ChartTableStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/),\n };\n};\n"],"names":["makeStyles","mergeClasses","shorthands","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","width","overflowX","borderCollapse","caption1","fontWeight","fontWeightSemibold","backgroundColor","colorNeutralBackground3","color","colorNeutralForeground1","padding","spacingHorizontalS","textAlign","border","strokeWidthThick","colorNeutralStroke2","useChartTableStyles","props","baseStyles"],"mappings":";;;;;;;;;;;IAQaK,oBAAAA;;;IA4CAuB,mBAAAA;;;;uBApDwC,iBAAiB;4BAG7B,wBAAwB;AAK1D,6BAA+D;IACpEtB,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,UAAU;IACVC,OAAO;AACT,EAAE;AAEF,MAAMC,gBAAYX,iBAAAA,EAAW;IAC3BM,MAAM;QACJM,OAAO;QACPC,WAAW;IACb;IACAN,OAAO;QACLO,gBAAgB;IAClB;IACAN,YAAY;QACV,GAAGJ,4BAAAA,CAAiBW,QAAQ;QAC5BC,YAAYb,kBAAAA,CAAOc,kBAAkB;QACrCC,iBAAiBf,kBAAAA,CAAOgB,uBAAuB;QAC/CC,OAAOjB,kBAAAA,CAAOkB,uBAAuB;QACrC,GAAGnB,iBAAAA,CAAWoB,OAAO,CAACnB,kBAAAA,CAAOoB,kBAAkB,CAAC;QAChDC,WAAW;QACX,GAAGtB,iBAAAA,CAAWuB,MAAM,CAACtB,kBAAAA,CAAOuB,gBAAgB,EAAE,SAASvB,kBAAAA,CAAOwB,mBAAmB,CAAC;QAClF,kCAAkC;YAChCT,iBAAiB;YACjBE,OAAO;QACT;IACF;IACAX,UAAU;QACR,GAAGL,4BAAAA,CAAiBW,QAAQ;QAC5B,GAAGb,iBAAAA,CAAWoB,OAAO,CAACnB,kBAAAA,CAAOoB,kBAAkB,CAAC;QAChD,GAAGrB,iBAAAA,CAAWuB,MAAM,CAACtB,kBAAAA,CAAOuB,gBAAgB,EAAE,SAASvB,kBAAAA,CAAOwB,mBAAmB,CAAC;QAClFP,OAAOjB,kBAAAA,CAAOkB,uBAAuB;QACrCG,WAAW;QACX,kCAAkC;YAChCJ,OAAO;QACT;IACF;AACF;AAKO,4BAA4B,CAACS;IAClC,MAAMC,aAAanB;IAEnB,OAAO;QACLL,UAAML,mBAAAA,EAAaI,qBAAqBC,IAAI,EAAEwB,WAAWxB,IAAI,CAAC,oBAAoB;QAClFC,OAAON,uBAAAA,EAAaI,qBAAqBE,KAAK,EAAEuB,WAAWvB,KAAK,CAAC,qBAAqB;QACtFC,gBAAYP,mBAAAA,EAAaI,qBAAqBG,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;QAC1GC,cAAUR,mBAAAA,EAAaI,qBAAqBI,QAAQ,EAAEqB,WAAWrB,QAAQ,CAAC,wBAAwB;QAClGC,WAAOT,mBAAAA,EAAaI,qBAAqBK,KAAK,CAAC,qBAAqB;IACtE;AACF,EAAE"}
|
|
@@ -36,10 +36,14 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
36
36
|
let _xScale;
|
|
37
37
|
let isIntegralDataset = true;
|
|
38
38
|
let _tooltipId = (0, _reactutilities.useId)('tooltip_');
|
|
39
|
+
/* Used for when WrapXAxisLabels props appeared.
|
|
40
|
+
* To display the total word (space separated words), Need to have more space than usual.
|
|
41
|
+
* This height will get total height need to disaply total word.
|
|
42
|
+
* These value need to be removed from actual svg height/graph height.
|
|
43
|
+
* Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.
|
|
44
|
+
*/ let _removalValueForTextTuncate = 0;
|
|
39
45
|
const [containerWidth, setContainerWidth] = _react.useState(0);
|
|
40
46
|
const [containerHeight, setContainerHeight] = _react.useState(0);
|
|
41
|
-
const [isRemoveValCalculated, setIsRemoveValCalculated] = _react.useState(true);
|
|
42
|
-
const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = _react.useState(0);
|
|
43
47
|
const [startFromX, setStartFromX] = _react.useState(0);
|
|
44
48
|
const [prevProps, setPrevProps] = _react.useState(null);
|
|
45
49
|
const chartTypesToCheck = [
|
|
@@ -122,19 +126,6 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
122
126
|
props,
|
|
123
127
|
prevProps
|
|
124
128
|
]);
|
|
125
|
-
_react.useEffect(()=>{
|
|
126
|
-
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
127
|
-
const rotateLabelProps = {
|
|
128
|
-
node: xAxisElement.current,
|
|
129
|
-
xAxis: _xScale
|
|
130
|
-
};
|
|
131
|
-
const rotatedHeight = (0, _index.rotateXAxisLabels)(rotateLabelProps);
|
|
132
|
-
if (isRemoveValCalculated && removalValueForTextTuncate !== rotatedHeight + margins.bottom && rotatedHeight > 0) {
|
|
133
|
-
setRemovalValueForTextTuncate(rotatedHeight + margins.bottom);
|
|
134
|
-
setIsRemoveValCalculated(false);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
129
|
_react.useImperativeHandle(props.componentRef, ()=>{
|
|
139
130
|
var _chartContainer_current;
|
|
140
131
|
return {
|
|
@@ -188,7 +179,13 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
188
179
|
var _props_showRoundOffXTickValues;
|
|
189
180
|
const XAxisParams = {
|
|
190
181
|
domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues, startFromX),
|
|
191
|
-
|
|
182
|
+
// FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
|
|
183
|
+
// Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
|
|
184
|
+
// However, if transformation props are enabled, the updated _removalValueForTextTuncate
|
|
185
|
+
// will only be available in the next render, as it's set after the axis is created.
|
|
186
|
+
// Solution: Delay the creation of gridlines until after the transformation has been applied,
|
|
187
|
+
// or precompute the required height for transformed labels (_removalValueForTextTuncate).
|
|
188
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
192
189
|
margins: margins,
|
|
193
190
|
xAxisElement: xAxisElement.current,
|
|
194
191
|
showRoundOffXTickValues: (_props_showRoundOffXTickValues = props.showRoundOffXTickValues) !== null && _props_showRoundOffXTickValues !== void 0 ? _props_showRoundOffXTickValues : true,
|
|
@@ -199,24 +196,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
199
196
|
xAxisInnerPadding: props.xAxisInnerPadding,
|
|
200
197
|
xAxisOuterPadding: props.xAxisOuterPadding,
|
|
201
198
|
containerWidth: containerWidth,
|
|
202
|
-
hideTickOverlap: props.
|
|
203
|
-
|
|
204
|
-
const YAxisParams = {
|
|
205
|
-
margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
|
|
206
|
-
containerWidth: containerWidth,
|
|
207
|
-
containerHeight: containerHeight - removalValueForTextTuncate,
|
|
208
|
-
yAxisElement: yAxisElement.current,
|
|
209
|
-
yAxisTickFormat: props.yAxisTickFormat,
|
|
210
|
-
yAxisTickCount: props.yAxisTickCount,
|
|
211
|
-
yMinValue: props.yMinValue || 0,
|
|
212
|
-
yMaxValue: props.yMaxValue || 0,
|
|
213
|
-
tickPadding: props.showYAxisLablesTooltip ? 15 : 10,
|
|
214
|
-
maxOfYVal: props.maxOfYVal,
|
|
215
|
-
yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
|
|
216
|
-
// please note these padding default values must be consistent in here
|
|
217
|
-
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
218
|
-
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
219
|
-
yAxisPadding: props.yAxisPadding || 0
|
|
199
|
+
hideTickOverlap: props.rotateXAxisLables ? false : props.hideTickOverlap,
|
|
200
|
+
calcMaxLabelWidth: _calcMaxLabelWidthWithTransform
|
|
220
201
|
};
|
|
221
202
|
/**
|
|
222
203
|
* These scales used for 2 purposes.
|
|
@@ -241,25 +222,24 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
241
222
|
}
|
|
242
223
|
_xScale = xScale;
|
|
243
224
|
_tickValues = tickValues;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
225
|
+
_transformXAxisLabels();
|
|
226
|
+
const YAxisParams = {
|
|
227
|
+
margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
|
|
228
|
+
containerWidth: containerWidth,
|
|
229
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
230
|
+
yAxisElement: yAxisElement.current,
|
|
231
|
+
yAxisTickFormat: props.yAxisTickFormat,
|
|
232
|
+
yAxisTickCount: props.yAxisTickCount,
|
|
233
|
+
yMinValue: props.yMinValue || 0,
|
|
234
|
+
yMaxValue: props.yMaxValue || 0,
|
|
235
|
+
tickPadding: 10,
|
|
236
|
+
maxOfYVal: props.maxOfYVal,
|
|
237
|
+
yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
|
|
238
|
+
// please note these padding default values must be consistent in here
|
|
239
|
+
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
240
|
+
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
241
|
+
yAxisPadding: props.yAxisPadding || 0
|
|
242
|
+
};
|
|
263
243
|
/**
|
|
264
244
|
* These scales used for 2 purposes.
|
|
265
245
|
* 1. To create x and y axis
|
|
@@ -286,7 +266,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
286
266
|
const YAxisParamsSecondary = {
|
|
287
267
|
margins: margins,
|
|
288
268
|
containerWidth: containerWidth,
|
|
289
|
-
containerHeight: containerHeight -
|
|
269
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
290
270
|
yAxisElement: yAxisElementSecondary.current,
|
|
291
271
|
yAxisTickFormat: props.yAxisTickFormat,
|
|
292
272
|
yAxisTickCount: props.yAxisTickCount,
|
|
@@ -333,7 +313,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
333
313
|
// Call back to the chart.
|
|
334
314
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
315
|
const _getData = (xScale, yScalePrimary, yScaleSecondary)=>{
|
|
336
|
-
props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight -
|
|
316
|
+
props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - _removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
|
|
337
317
|
};
|
|
338
318
|
props.getAxisData && props.getAxisData(axisData);
|
|
339
319
|
// Callback function for chart, returns axis
|
|
@@ -354,7 +334,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
354
334
|
height: containerHeight
|
|
355
335
|
};
|
|
356
336
|
const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
|
|
357
|
-
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top -
|
|
337
|
+
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - titleMargin;
|
|
358
338
|
/**
|
|
359
339
|
* When screen resizes, along with screen, chart also auto adjusted.
|
|
360
340
|
* This method used to adjust height and width of the charts.
|
|
@@ -385,39 +365,88 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
385
365
|
props.onChartMouseLeave && props.onChartMouseLeave();
|
|
386
366
|
}
|
|
387
367
|
function _calculateChartMinWidth() {
|
|
388
|
-
|
|
368
|
+
// Adding 10px for padding on both sides
|
|
369
|
+
const labelWidth = _calcMaxLabelWidthWithTransform(_tickValues) + 10;
|
|
370
|
+
let minChartWidth = margins.left + margins.right + labelWidth * (_tickValues.length - 1);
|
|
371
|
+
if ([
|
|
372
|
+
_index.ChartTypes.GroupedVerticalBarChart,
|
|
373
|
+
_index.ChartTypes.VerticalBarChart,
|
|
374
|
+
_index.ChartTypes.VerticalStackedBarChart
|
|
375
|
+
].includes(props.chartType)) {
|
|
376
|
+
const minDomainMargin = 8;
|
|
377
|
+
minChartWidth += minDomainMargin * 2;
|
|
378
|
+
}
|
|
379
|
+
return minChartWidth;
|
|
380
|
+
}
|
|
381
|
+
function _calcMaxLabelWidthWithTransform(x) {
|
|
389
382
|
// Case: rotated labels
|
|
390
383
|
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
391
|
-
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
|
|
384
|
+
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(x, `.${classes.xAxis} text`);
|
|
385
|
+
return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));
|
|
386
|
+
}
|
|
387
|
+
// Case: truncated labels
|
|
388
|
+
if (props.showXAxisLablesTooltip) {
|
|
389
|
+
const tickValues = x.map((val)=>{
|
|
395
390
|
const numChars = props.noOfCharsToTruncate || 4;
|
|
396
391
|
return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;
|
|
397
392
|
});
|
|
398
393
|
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(tickValues, `.${classes.xAxis} text`);
|
|
399
|
-
|
|
400
|
-
}
|
|
394
|
+
return Math.ceil(longestLabelWidth);
|
|
395
|
+
}
|
|
396
|
+
// Case: wrapped labels
|
|
397
|
+
if (props.wrapXAxisLables) {
|
|
398
|
+
// FIXME: Calculate the max width of lines instead of words. This requires applying
|
|
399
|
+
// the wrapping transformation earlier to obtain the actual rendered lines.
|
|
401
400
|
const words = [];
|
|
402
|
-
|
|
401
|
+
x.forEach((val)=>{
|
|
403
402
|
words.push(...val.toString().split(/\s+/));
|
|
404
403
|
});
|
|
404
|
+
// This approach works well in most cases, since overflow typically occurs only when
|
|
405
|
+
// a single word exceeds the specified width — otherwise, the text will wrap as expected.
|
|
405
406
|
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(words, `.${classes.xAxis} text`);
|
|
406
|
-
|
|
407
|
-
} else {
|
|
408
|
-
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(_tickValues, `.${classes.xAxis} text`);
|
|
409
|
-
labelWidth += Math.ceil(longestLabelWidth);
|
|
407
|
+
return Math.max(Math.ceil(longestLabelWidth), _index.DEFAULT_WRAP_WIDTH);
|
|
410
408
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
409
|
+
// Default case
|
|
410
|
+
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(x, `.${classes.xAxis} text`);
|
|
411
|
+
return Math.ceil(longestLabelWidth);
|
|
412
|
+
}
|
|
413
|
+
function _transformXAxisLabels() {
|
|
414
|
+
_removalValueForTextTuncate = 0;
|
|
415
|
+
/*
|
|
416
|
+
* To enable wrapping of x axis tick values or to display complete x axis tick values,
|
|
417
|
+
* we need to calculate how much space it needed to render the text.
|
|
418
|
+
* No need to re-calculate every time the chart renders and same time need to get an update. So using setState.
|
|
419
|
+
* Required space will be calculated first time chart rendering and if any width/height of chart updated.
|
|
420
|
+
* */ if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {
|
|
421
|
+
let maxXAxisLabelWidth;
|
|
422
|
+
if (props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
423
|
+
var _props_datasetForXAxisDomain;
|
|
424
|
+
if ((((_props_datasetForXAxisDomain = props.datasetForXAxisDomain) === null || _props_datasetForXAxisDomain === void 0 ? void 0 : _props_datasetForXAxisDomain.length) || 0) > 1) {
|
|
425
|
+
maxXAxisLabelWidth = _xScale.step();
|
|
426
|
+
} else {
|
|
427
|
+
maxXAxisLabelWidth = containerWidth;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const wrapLabelProps = {
|
|
431
|
+
node: xAxisElement.current,
|
|
432
|
+
xAxis: _xScale,
|
|
433
|
+
showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,
|
|
434
|
+
noOfCharsToTruncate: props.noOfCharsToTruncate || 4,
|
|
435
|
+
width: maxXAxisLabelWidth
|
|
436
|
+
};
|
|
437
|
+
var _createWrapOfXLabels;
|
|
438
|
+
_removalValueForTextTuncate = (_createWrapOfXLabels = (0, _index.createWrapOfXLabels)(wrapLabelProps)) !== null && _createWrapOfXLabels !== void 0 ? _createWrapOfXLabels : 0;
|
|
439
|
+
}
|
|
440
|
+
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
441
|
+
const rotateLabelProps = {
|
|
442
|
+
node: xAxisElement.current,
|
|
443
|
+
xAxis: _xScale
|
|
444
|
+
};
|
|
445
|
+
var _rotateXAxisLabels;
|
|
446
|
+
const rotatedHeight = (_rotateXAxisLabels = (0, _index.rotateXAxisLabels)(rotateLabelProps)) !== null && _rotateXAxisLabels !== void 0 ? _rotateXAxisLabels : 0;
|
|
447
|
+
// margins.bottom is used as padding here
|
|
448
|
+
_removalValueForTextTuncate = rotatedHeight + margins.bottom;
|
|
419
449
|
}
|
|
420
|
-
return minChartWidth;
|
|
421
450
|
}
|
|
422
451
|
/**
|
|
423
452
|
* We have use the {@link defaultTabbableElement } to fix
|
|
@@ -462,7 +491,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
462
491
|
},
|
|
463
492
|
id: `xAxisGElement${idForGraph}`,
|
|
464
493
|
// To add wrap of x axis lables feature, need to remove word height from svg height.
|
|
465
|
-
transform: `translate(0, ${svgDimensions.height - margins.bottom -
|
|
494
|
+
transform: `translate(0, ${svgDimensions.height - margins.bottom - _removalValueForTextTuncate})`,
|
|
466
495
|
className: classes.xAxis
|
|
467
496
|
}), props.xAxisTitle !== undefined && props.xAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
468
497
|
content: props.xAxisTitle,
|
|
@@ -493,7 +522,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
493
522
|
}), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
494
523
|
content: props.secondaryYAxistitle,
|
|
495
524
|
textProps: {
|
|
496
|
-
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 +
|
|
525
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
497
526
|
y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
|
|
498
527
|
textAnchor: 'middle',
|
|
499
528
|
transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
|
|
@@ -507,7 +536,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
507
536
|
})), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
508
537
|
content: props.yAxisTitle,
|
|
509
538
|
textProps: {
|
|
510
|
-
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 +
|
|
539
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
511
540
|
y: _useRtl ? svgDimensions.width - margins.right / 2 + titleMargin : margins.left / 2 - titleMargin,
|
|
512
541
|
textAnchor: 'middle',
|
|
513
542
|
transform: `translate(0,
|