@fluentui/react-charts 9.2.3 → 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 +49 -10
- package/dist/index.d.ts +98 -5
- package/lib/components/AreaChart/AreaChart.js +3 -3
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -15
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +89 -6
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +38 -34
- 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 +17 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +55 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +19 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1058 -291
- 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 +6 -1
- 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/GaugeChart/GaugeChart.js +1 -2
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.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/LineChart/LineChart.js +271 -271
- 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 +23 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
- 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 +114 -75
- 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 +11 -7
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +4 -22
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
- 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 +309 -142
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -2
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -14
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +89 -6
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +38 -34
- 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 +15 -13
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +58 -19
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +22 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1070 -291
- 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 +6 -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/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/GaugeChart/GaugeChart.js +1 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.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/LineChart/LineChart.js +269 -269
- 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 +30 -9
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
- 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 +112 -73
- 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 +13 -7
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
- 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 +322 -133
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
CustomPoints: function() {
|
|
16
16
|
return CustomPoints;
|
|
17
17
|
},
|
|
18
|
+
DEFAULT_DATE_STRING: function() {
|
|
19
|
+
return DEFAULT_DATE_STRING;
|
|
20
|
+
},
|
|
18
21
|
DEFAULT_WRAP_WIDTH: function() {
|
|
19
22
|
return DEFAULT_WRAP_WIDTH;
|
|
20
23
|
},
|
|
@@ -48,6 +51,9 @@ _export(exports, {
|
|
|
48
51
|
calculateLongestLabelWidth: function() {
|
|
49
52
|
return calculateLongestLabelWidth;
|
|
50
53
|
},
|
|
54
|
+
calculatePrecision: function() {
|
|
55
|
+
return calculatePrecision;
|
|
56
|
+
},
|
|
51
57
|
calloutData: function() {
|
|
52
58
|
return calloutData;
|
|
53
59
|
},
|
|
@@ -90,21 +96,15 @@ _export(exports, {
|
|
|
90
96
|
defaultYAxisTickFormatter: function() {
|
|
91
97
|
return defaultYAxisTickFormatter;
|
|
92
98
|
},
|
|
93
|
-
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
domainRangeOfDateForScatterChart: function() {
|
|
97
|
-
return domainRangeOfDateForScatterChart;
|
|
99
|
+
domainRangeOfDateForAreaLineScatterVerticalBarCharts: function() {
|
|
100
|
+
return domainRangeOfDateForAreaLineScatterVerticalBarCharts;
|
|
98
101
|
},
|
|
99
|
-
|
|
100
|
-
return
|
|
102
|
+
domainRangeOfNumericForAreaLineScatterCharts: function() {
|
|
103
|
+
return domainRangeOfNumericForAreaLineScatterCharts;
|
|
101
104
|
},
|
|
102
105
|
domainRangeOfNumericForHorizontalBarChartWithAxis: function() {
|
|
103
106
|
return domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
104
107
|
},
|
|
105
|
-
domainRangeOfNumericForScatterChart: function() {
|
|
106
|
-
return domainRangeOfNumericForScatterChart;
|
|
107
|
-
},
|
|
108
108
|
domainRangeOfVSBCNumeric: function() {
|
|
109
109
|
return domainRangeOfVSBCNumeric;
|
|
110
110
|
},
|
|
@@ -138,6 +138,12 @@ _export(exports, {
|
|
|
138
138
|
formatScientificLimitWidth: function() {
|
|
139
139
|
return formatScientificLimitWidth;
|
|
140
140
|
},
|
|
141
|
+
generateLinearTicks: function() {
|
|
142
|
+
return generateLinearTicks;
|
|
143
|
+
},
|
|
144
|
+
generateMonthlyTicks: function() {
|
|
145
|
+
return generateMonthlyTicks;
|
|
146
|
+
},
|
|
141
147
|
getAccessibleDataObject: function() {
|
|
142
148
|
return getAccessibleDataObject;
|
|
143
149
|
},
|
|
@@ -150,9 +156,18 @@ _export(exports, {
|
|
|
150
156
|
getDateFormatLevel: function() {
|
|
151
157
|
return getDateFormatLevel;
|
|
152
158
|
},
|
|
159
|
+
getDomainPaddingForMarkers: function() {
|
|
160
|
+
return getDomainPaddingForMarkers;
|
|
161
|
+
},
|
|
162
|
+
getRangeForScatterMarkerSize: function() {
|
|
163
|
+
return getRangeForScatterMarkerSize;
|
|
164
|
+
},
|
|
153
165
|
getScalePadding: function() {
|
|
154
166
|
return getScalePadding;
|
|
155
167
|
},
|
|
168
|
+
getScatterXDomainExtent: function() {
|
|
169
|
+
return getScatterXDomainExtent;
|
|
170
|
+
},
|
|
156
171
|
getSecureProps: function() {
|
|
157
172
|
return getSecureProps;
|
|
158
173
|
},
|
|
@@ -168,12 +183,27 @@ _export(exports, {
|
|
|
168
183
|
groupChartDataByYValue: function() {
|
|
169
184
|
return groupChartDataByYValue;
|
|
170
185
|
},
|
|
186
|
+
isPlottable: function() {
|
|
187
|
+
return isPlottable;
|
|
188
|
+
},
|
|
171
189
|
isScalePaddingDefined: function() {
|
|
172
190
|
return isScalePaddingDefined;
|
|
173
191
|
},
|
|
192
|
+
isScatterPolarSeries: function() {
|
|
193
|
+
return isScatterPolarSeries;
|
|
194
|
+
},
|
|
195
|
+
isTextMode: function() {
|
|
196
|
+
return isTextMode;
|
|
197
|
+
},
|
|
198
|
+
isValidDomainValue: function() {
|
|
199
|
+
return isValidDomainValue;
|
|
200
|
+
},
|
|
174
201
|
pointTypes: function() {
|
|
175
202
|
return pointTypes;
|
|
176
203
|
},
|
|
204
|
+
precisionRound: function() {
|
|
205
|
+
return precisionRound;
|
|
206
|
+
},
|
|
177
207
|
prepareDatapoints: function() {
|
|
178
208
|
return prepareDatapoints;
|
|
179
209
|
},
|
|
@@ -217,6 +247,7 @@ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
|
217
247
|
const _chartutilities = require("@fluentui/chart-utilities");
|
|
218
248
|
const MIN_DOMAIN_MARGIN = 8;
|
|
219
249
|
const MIN_DONUT_RADIUS = 1;
|
|
250
|
+
const DEFAULT_DATE_STRING = '2000-01-01';
|
|
220
251
|
var ChartTypes = /*#__PURE__*/ function(ChartTypes) {
|
|
221
252
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
222
253
|
ChartTypes[ChartTypes["LineChart"] = 1] = "LineChart";
|
|
@@ -261,9 +292,9 @@ function yAxisTickFormatterInternal(value, limitWidth = false) {
|
|
|
261
292
|
function defaultYAxisTickFormatter(value) {
|
|
262
293
|
return yAxisTickFormatterInternal(value);
|
|
263
294
|
}
|
|
264
|
-
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
265
|
-
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
266
|
-
const xAxisScale = (
|
|
295
|
+
function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
|
|
296
|
+
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
297
|
+
const xAxisScale = createNumericScale(scaleType).domain([
|
|
267
298
|
domainNRangeValues.dStartValue,
|
|
268
299
|
domainNRangeValues.dEndValue
|
|
269
300
|
]).range([
|
|
@@ -272,33 +303,38 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
|
272
303
|
]);
|
|
273
304
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
274
305
|
let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
275
|
-
const tickFormat = (domainValue, _index)=>{
|
|
306
|
+
const tickFormat = (domainValue, _index, defaultFormat)=>{
|
|
276
307
|
if (tickParams.tickFormat) {
|
|
277
308
|
return (0, _d3format.format)(tickParams.tickFormat)(domainValue);
|
|
278
309
|
}
|
|
279
310
|
const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
280
|
-
return (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
|
|
311
|
+
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
|
|
281
312
|
};
|
|
282
313
|
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
283
|
-
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 20;
|
|
314
|
+
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map((v, i)=>tickFormat(v, i))) + 20;
|
|
284
315
|
const [start, end] = xAxisScale.range();
|
|
285
316
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
286
317
|
}
|
|
287
|
-
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
318
|
+
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat((v, i)=>tickFormat(v, i, xAxisScale.tickFormat(tickCount)));
|
|
288
319
|
if ([
|
|
289
320
|
6,
|
|
290
321
|
8
|
|
291
322
|
].includes(chartType)) {
|
|
292
323
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
293
324
|
}
|
|
325
|
+
let customTickValues;
|
|
294
326
|
if (tickParams.tickValues) {
|
|
295
|
-
|
|
327
|
+
customTickValues = tickParams.tickValues;
|
|
328
|
+
} else if (tickStep) {
|
|
329
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, xAxisScale.domain());
|
|
330
|
+
}
|
|
331
|
+
if (customTickValues) {
|
|
332
|
+
xAxis.tickValues(customTickValues);
|
|
296
333
|
}
|
|
297
334
|
if (xAxisElement) {
|
|
298
335
|
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
299
336
|
}
|
|
300
|
-
|
|
301
|
-
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
337
|
+
const tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
302
338
|
return {
|
|
303
339
|
xScale: xAxisScale,
|
|
304
340
|
tickValues
|
|
@@ -489,7 +525,7 @@ function getDateFormatLevel(date, useUTC) {
|
|
|
489
525
|
return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
|
|
490
526
|
}
|
|
491
527
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
492
|
-
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth } = xAxisParams;
|
|
528
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
493
529
|
const isUtcSet = useUTC === true || useUTC === 'utc';
|
|
494
530
|
const xAxisScale = isUtcSet ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
|
|
495
531
|
xAxisScale.domain([
|
|
@@ -540,12 +576,19 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
540
576
|
].includes(chartType)) {
|
|
541
577
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
542
578
|
}
|
|
543
|
-
|
|
579
|
+
let customTickValues;
|
|
580
|
+
if (tickParams.tickValues) {
|
|
581
|
+
customTickValues = tickParams.tickValues;
|
|
582
|
+
} else if (tickStep) {
|
|
583
|
+
customTickValues = generateDateTicks(tickStep, tick0, xAxisScale.domain(), useUTC);
|
|
584
|
+
}
|
|
585
|
+
if (customTickValues) {
|
|
586
|
+
xAxis.tickValues(customTickValues);
|
|
587
|
+
}
|
|
544
588
|
if (xAxisElement) {
|
|
545
589
|
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
546
590
|
}
|
|
547
|
-
|
|
548
|
-
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
591
|
+
const tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
549
592
|
return {
|
|
550
593
|
xScale: xAxisScale,
|
|
551
594
|
tickValues
|
|
@@ -661,7 +704,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
661
704
|
const { yMinMaxValues = {
|
|
662
705
|
startValue: 0,
|
|
663
706
|
endValue: 0
|
|
664
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4 } = yAxisParams;
|
|
707
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, tickValues, tickStep, tick0 } = yAxisParams;
|
|
665
708
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
666
709
|
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
667
710
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -676,14 +719,23 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
676
719
|
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
677
720
|
const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
678
721
|
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
|
|
722
|
+
let customTickValues;
|
|
723
|
+
if (tickValues) {
|
|
724
|
+
customTickValues = tickValues;
|
|
725
|
+
} else if (tickStep) {
|
|
726
|
+
customTickValues = generateNumericTicks(undefined, tickStep, tick0, yAxisScale.domain());
|
|
727
|
+
}
|
|
728
|
+
if (customTickValues) {
|
|
729
|
+
yAxis.tickValues(customTickValues);
|
|
730
|
+
}
|
|
679
731
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
680
732
|
return yAxisScale;
|
|
681
733
|
}
|
|
682
|
-
function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
|
|
734
|
+
function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false, scaleType) {
|
|
683
735
|
const { yMinMaxValues = {
|
|
684
736
|
startValue: 0,
|
|
685
737
|
endValue: 0
|
|
686
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight } = yAxisParams;
|
|
738
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight, tickValues, tickStep, tick0 } = yAxisParams;
|
|
687
739
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
688
740
|
const tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
689
741
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -696,18 +748,53 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, cha
|
|
|
696
748
|
yMin = yMin - yPadding;
|
|
697
749
|
yMax = yMax + yPadding;
|
|
698
750
|
}
|
|
699
|
-
|
|
751
|
+
let scaleDomain = [
|
|
700
752
|
domainValues[0],
|
|
701
|
-
|
|
702
|
-
]
|
|
753
|
+
domainValues[domainValues.length - 1]
|
|
754
|
+
];
|
|
755
|
+
if (scaleType === 'log') {
|
|
756
|
+
let domainStart = yMinMaxValues.startValue;
|
|
757
|
+
let domainEnd = yMinMaxValues.endValue;
|
|
758
|
+
if (yMinValue > 0) {
|
|
759
|
+
domainStart = Math.min(domainStart, yMinValue);
|
|
760
|
+
}
|
|
761
|
+
if (yMaxValue > 0) {
|
|
762
|
+
domainEnd = Math.max(domainEnd, yMaxValue);
|
|
763
|
+
}
|
|
764
|
+
scaleDomain = [
|
|
765
|
+
domainStart,
|
|
766
|
+
domainEnd
|
|
767
|
+
];
|
|
768
|
+
}
|
|
769
|
+
const yAxisScale = createNumericScale(scaleType).domain(scaleDomain).range([
|
|
703
770
|
containerHeight - margins.bottom,
|
|
704
771
|
margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
|
|
705
772
|
]);
|
|
706
773
|
const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
707
|
-
const yAxis = axis.tickPadding(tickPadding).
|
|
708
|
-
|
|
774
|
+
const yAxis = axis.tickPadding(tickPadding).tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
775
|
+
let customTickValues;
|
|
776
|
+
if (tickValues) {
|
|
777
|
+
customTickValues = tickValues;
|
|
778
|
+
} else if (tickStep) {
|
|
779
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, yAxisScale.domain());
|
|
780
|
+
}
|
|
781
|
+
if (customTickValues) {
|
|
782
|
+
yAxis.tickValues(customTickValues);
|
|
783
|
+
axisData.yAxisDomainValues = customTickValues;
|
|
784
|
+
} else {
|
|
785
|
+
if (scaleType === 'log') {
|
|
786
|
+
axisData.yAxisDomainValues = yAxisScale.ticks();
|
|
787
|
+
} else {
|
|
788
|
+
yAxis.tickValues(domainValues);
|
|
789
|
+
axisData.yAxisDomainValues = domainValues;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
const tickFormat = (domainValue, index, defaultFormat)=>{
|
|
793
|
+
const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
794
|
+
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
795
|
+
};
|
|
796
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((v, i)=>tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)));
|
|
709
797
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
710
|
-
axisData.yAxisDomainValues = domainValues;
|
|
711
798
|
return yAxisScale;
|
|
712
799
|
}
|
|
713
800
|
const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints, isRtl, barWidth)=>{
|
|
@@ -937,7 +1024,7 @@ function tooltipOfAxislabels(axistooltipProps) {
|
|
|
937
1024
|
return null;
|
|
938
1025
|
}
|
|
939
1026
|
const div = (0, _d3selection.select)('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
|
|
940
|
-
const aa = axis.selectAll('
|
|
1027
|
+
const aa = axis.selectAll('[id^="BaseSpan-"]')._groups[0];
|
|
941
1028
|
const baseSpanLength = aa && Object.keys(aa).length;
|
|
942
1029
|
const originalDataArray = [];
|
|
943
1030
|
for(let i = 0; i < baseSpanLength; i++){
|
|
@@ -969,51 +1056,24 @@ function getXAxisType(points) {
|
|
|
969
1056
|
}
|
|
970
1057
|
return isXAxisDateType;
|
|
971
1058
|
}
|
|
972
|
-
function
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
});
|
|
981
|
-
const rStartValue = margins.left;
|
|
982
|
-
const rEndValue = width - margins.right;
|
|
983
|
-
return isRTL ? {
|
|
984
|
-
dStartValue: xMax,
|
|
985
|
-
dEndValue: xMin,
|
|
986
|
-
rStartValue,
|
|
987
|
-
rEndValue
|
|
988
|
-
} : {
|
|
989
|
-
dStartValue: xMin,
|
|
990
|
-
dEndValue: xMax,
|
|
991
|
-
rStartValue,
|
|
992
|
-
rEndValue
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
996
|
-
let xMin = (0, _d3array.min)(points, (point)=>{
|
|
997
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
998
|
-
});
|
|
999
|
-
let xMax = (0, _d3array.max)(points, (point)=>{
|
|
1000
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1001
|
-
return item.x;
|
|
1002
|
-
});
|
|
1003
|
-
});
|
|
1004
|
-
const xPadding = (xMax - xMin) * 0.1;
|
|
1005
|
-
xMin = xMin - xPadding;
|
|
1006
|
-
xMax = xMax + xPadding;
|
|
1059
|
+
function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode) {
|
|
1060
|
+
const isScatterPolar = isScatterPolarSeries(points);
|
|
1061
|
+
let [xMin, xMax] = getScatterXDomainExtent(points, scaleType);
|
|
1062
|
+
if (hasMarkersMode) {
|
|
1063
|
+
const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType);
|
|
1064
|
+
xMin = xMin - xPadding.start;
|
|
1065
|
+
xMax = xMax + xPadding.end;
|
|
1066
|
+
}
|
|
1007
1067
|
const rStartValue = margins.left;
|
|
1008
1068
|
const rEndValue = width - margins.right;
|
|
1009
1069
|
return isRTL ? {
|
|
1010
|
-
dStartValue: xMax,
|
|
1011
|
-
dEndValue: xMin,
|
|
1070
|
+
dStartValue: isScatterPolar ? 1 : xMax,
|
|
1071
|
+
dEndValue: isScatterPolar ? -1 : xMin,
|
|
1012
1072
|
rStartValue,
|
|
1013
1073
|
rEndValue
|
|
1014
1074
|
} : {
|
|
1015
|
-
dStartValue: xMin,
|
|
1016
|
-
dEndValue: xMax,
|
|
1075
|
+
dStartValue: isScatterPolar ? -1 : xMin,
|
|
1076
|
+
dEndValue: isScatterPolar ? 1 : xMax,
|
|
1017
1077
|
rStartValue,
|
|
1018
1078
|
rEndValue
|
|
1019
1079
|
};
|
|
@@ -1093,22 +1153,15 @@ function domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth) {
|
|
|
1093
1153
|
rEndValue: rMin
|
|
1094
1154
|
};
|
|
1095
1155
|
}
|
|
1096
|
-
function
|
|
1156
|
+
function domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues = [], chartType, barWidth, hasMarkersMode) {
|
|
1097
1157
|
let sDate;
|
|
1098
1158
|
let lDate;
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
});
|
|
1106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1107
|
-
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1108
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1109
|
-
return item.x;
|
|
1110
|
-
});
|
|
1111
|
-
});
|
|
1159
|
+
if ([
|
|
1160
|
+
0,
|
|
1161
|
+
1,
|
|
1162
|
+
7
|
|
1163
|
+
].includes(chartType)) {
|
|
1164
|
+
[sDate, lDate] = getScatterXDomainExtent(points);
|
|
1112
1165
|
// Need to draw graph with given small and large date
|
|
1113
1166
|
// (Which Involves customization of date axis tick values)
|
|
1114
1167
|
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
@@ -1126,6 +1179,11 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
|
|
|
1126
1179
|
sDate = (0, _d3array.min)(points, (point)=>point.x);
|
|
1127
1180
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1128
1181
|
lDate = (0, _d3array.max)(points, (point)=>point.x);
|
|
1182
|
+
if (hasMarkersMode || chartType === 7) {
|
|
1183
|
+
const xPadding = getDomainPaddingForMarkers(sDate.getTime(), lDate.getTime());
|
|
1184
|
+
sDate = new Date(sDate.getTime() - xPadding.start);
|
|
1185
|
+
lDate = new Date(lDate.getTime() + xPadding.end);
|
|
1186
|
+
}
|
|
1129
1187
|
}
|
|
1130
1188
|
const rStartValue = margins.left;
|
|
1131
1189
|
const rEndValue = width - margins.right;
|
|
@@ -1141,50 +1199,6 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
|
|
|
1141
1199
|
rEndValue
|
|
1142
1200
|
};
|
|
1143
1201
|
}
|
|
1144
|
-
function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues = []) {
|
|
1145
|
-
let sDate;
|
|
1146
|
-
let lDate;
|
|
1147
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1148
|
-
sDate = (0, _d3array.min)(points, (point)=>{
|
|
1149
|
-
return (0, _d3array.min)(point.data, (item)=>{
|
|
1150
|
-
return item.x;
|
|
1151
|
-
});
|
|
1152
|
-
});
|
|
1153
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1154
|
-
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1155
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1156
|
-
return item.x;
|
|
1157
|
-
});
|
|
1158
|
-
});
|
|
1159
|
-
const xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
1160
|
-
sDate = new Date(sDate.getTime() - xPadding);
|
|
1161
|
-
lDate = new Date(lDate.getTime() + xPadding);
|
|
1162
|
-
// Need to draw graph with given small and large date
|
|
1163
|
-
// (Which Involves customization of date axis tick values)
|
|
1164
|
-
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
1165
|
-
// So, Finding smallest and largest dates
|
|
1166
|
-
sDate = (0, _d3array.min)([
|
|
1167
|
-
...tickValues,
|
|
1168
|
-
sDate
|
|
1169
|
-
]);
|
|
1170
|
-
lDate = (0, _d3array.max)([
|
|
1171
|
-
...tickValues,
|
|
1172
|
-
lDate
|
|
1173
|
-
]);
|
|
1174
|
-
const rStartValue = margins.left;
|
|
1175
|
-
const rEndValue = width - margins.right;
|
|
1176
|
-
return isRTL ? {
|
|
1177
|
-
dStartValue: lDate,
|
|
1178
|
-
dEndValue: sDate,
|
|
1179
|
-
rStartValue,
|
|
1180
|
-
rEndValue
|
|
1181
|
-
} : {
|
|
1182
|
-
dStartValue: sDate,
|
|
1183
|
-
dEndValue: lDate,
|
|
1184
|
-
rStartValue,
|
|
1185
|
-
rEndValue
|
|
1186
|
-
};
|
|
1187
|
-
}
|
|
1188
1202
|
function domainRangeOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
|
|
1189
1203
|
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
1190
1204
|
const xMin = (0, _d3array.min)(points, (point)=>point.x);
|
|
@@ -1202,12 +1216,14 @@ function domainRangeOfVerticalNumeric(points, margins, containerWidth, isRTL, ba
|
|
|
1202
1216
|
rEndValue: rMax
|
|
1203
1217
|
};
|
|
1204
1218
|
}
|
|
1205
|
-
function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
1219
|
+
function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, scaleType) {
|
|
1206
1220
|
const values = [];
|
|
1207
1221
|
points.forEach((point)=>{
|
|
1208
1222
|
if (!useSecondaryYScale === !point.useSecondaryYScale) {
|
|
1209
1223
|
point.data.forEach((data)=>{
|
|
1210
|
-
|
|
1224
|
+
if (isValidDomainValue(data.y, scaleType)) {
|
|
1225
|
+
values.push(data.y);
|
|
1226
|
+
}
|
|
1211
1227
|
});
|
|
1212
1228
|
}
|
|
1213
1229
|
});
|
|
@@ -1585,3 +1601,176 @@ const createMeasurementSpan = (text, className, parentElement)=>{
|
|
|
1585
1601
|
measurementSpan.textContent = `${text}`;
|
|
1586
1602
|
return measurementSpan;
|
|
1587
1603
|
};
|
|
1604
|
+
function isScatterPolarSeries(points) {
|
|
1605
|
+
return points.some((item)=>{
|
|
1606
|
+
var _item_lineOptions;
|
|
1607
|
+
return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'scatterpolar';
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
function isTextMode(points) {
|
|
1611
|
+
return points.some((item)=>{
|
|
1612
|
+
var _item_lineOptions;
|
|
1613
|
+
return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'text';
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
// TODO: Refactor to encapsulate the complete numeric scale creation logic here, including setting domain and range.
|
|
1617
|
+
const createNumericScale = (scaleType)=>{
|
|
1618
|
+
if (scaleType === 'log') {
|
|
1619
|
+
return (0, _d3scale.scaleLog)();
|
|
1620
|
+
} else {
|
|
1621
|
+
return (0, _d3scale.scaleLinear)();
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
const getDomainPaddingForMarkers = (minVal, maxVal, scaleType)=>{
|
|
1625
|
+
if (scaleType === 'log') {
|
|
1626
|
+
return {
|
|
1627
|
+
start: minVal * 0.5,
|
|
1628
|
+
end: maxVal
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
const defaultPadding = (maxVal - minVal) * 0.1;
|
|
1632
|
+
return {
|
|
1633
|
+
start: defaultPadding,
|
|
1634
|
+
end: defaultPadding
|
|
1635
|
+
};
|
|
1636
|
+
};
|
|
1637
|
+
const isValidDomainValue = (value, scaleType)=>{
|
|
1638
|
+
return typeof value !== 'number' || scaleType !== 'log' || value > 0;
|
|
1639
|
+
};
|
|
1640
|
+
const isPlottable = (x, y)=>{
|
|
1641
|
+
return !(0, _chartutilities.isInvalidValue)(x) && !(0, _chartutilities.isInvalidValue)(y);
|
|
1642
|
+
};
|
|
1643
|
+
const getScatterXDomainExtent = (points, scaleType)=>{
|
|
1644
|
+
const isValidDataPointForScale = (item)=>isValidDomainValue(item.x, scaleType);
|
|
1645
|
+
const xMin = (0, _d3array.min)(points, (point)=>{
|
|
1646
|
+
return (0, _d3array.min)(point.data.filter(isValidDataPointForScale), (item)=>item.x);
|
|
1647
|
+
});
|
|
1648
|
+
const xMax = (0, _d3array.max)(points, (point)=>{
|
|
1649
|
+
return (0, _d3array.max)(point.data.filter(isValidDataPointForScale), (item)=>{
|
|
1650
|
+
return item.x;
|
|
1651
|
+
});
|
|
1652
|
+
});
|
|
1653
|
+
return [
|
|
1654
|
+
xMin,
|
|
1655
|
+
xMax
|
|
1656
|
+
];
|
|
1657
|
+
};
|
|
1658
|
+
const getRangeForScatterMarkerSize = ({ data, xScale, yScalePrimary, yScaleSecondary, useSecondaryYScale, xScaleType, yScaleType: primaryYScaleType, secondaryYScaleType })=>{
|
|
1659
|
+
// Note: This function is executed after the scale is created, so the actual padding can be
|
|
1660
|
+
// obtained by calculating the difference between the respective minimums or maximums of the
|
|
1661
|
+
// scale domain and the data. However, doing so often causes the marker size to scale up
|
|
1662
|
+
// unnecessarily when the scale uses a wider domain than required (due to the use of D3's nice
|
|
1663
|
+
// function or our own tick value calculations).
|
|
1664
|
+
// A better approach could be to treat the marker size as a fixed pixel value and adjust the
|
|
1665
|
+
// scale domain with sufficient padding to accommodate the maximum marker size—instead of doing
|
|
1666
|
+
// it the other way around (i.e., adjusting the scale domain first with padding and then scaling
|
|
1667
|
+
// the markers to fit inside the plot area).
|
|
1668
|
+
const [xMin, xMax] = getScatterXDomainExtent(data, xScaleType);
|
|
1669
|
+
const xPadding = getDomainPaddingForMarkers(+xMin, +xMax, xScaleType);
|
|
1670
|
+
const scaleXMin = xMin instanceof Date ? new Date(+xMin - xPadding.start) : xMin - xPadding.start;
|
|
1671
|
+
const scaleXMax = xMax instanceof Date ? new Date(+xMax + xPadding.end) : xMax + xPadding.end;
|
|
1672
|
+
const extraXPixels = Math.min(Math.abs(xScale(xMin) - xScale(scaleXMin)), Math.abs(xScale(scaleXMax) - xScale(xMax)));
|
|
1673
|
+
const yScaleType = useSecondaryYScale ? secondaryYScaleType : primaryYScaleType;
|
|
1674
|
+
const { startValue: yMin, endValue: yMax } = findNumericMinMaxOfY(data, undefined, useSecondaryYScale, yScaleType);
|
|
1675
|
+
const yPadding = getDomainPaddingForMarkers(yMin, yMax, yScaleType);
|
|
1676
|
+
const scaleYMin = yMin - yPadding.start;
|
|
1677
|
+
const scaleYMax = yMax + yPadding.end;
|
|
1678
|
+
const yScale = useSecondaryYScale ? yScaleSecondary : yScalePrimary;
|
|
1679
|
+
const extraYPixels = Math.min(Math.abs(yScale(scaleYMin) - yScale(yMin)), Math.abs(yScale(yMax) - yScale(scaleYMax)));
|
|
1680
|
+
return Math.min(extraXPixels, extraYPixels);
|
|
1681
|
+
};
|
|
1682
|
+
const generateLinearTicks = (tick0, tickStep, scaleDomain)=>{
|
|
1683
|
+
const domainMin = (0, _d3array.min)(scaleDomain);
|
|
1684
|
+
const domainMax = (0, _d3array.max)(scaleDomain);
|
|
1685
|
+
const precision = Math.max(calculatePrecision(tick0), calculatePrecision(tickStep));
|
|
1686
|
+
const start = Math.ceil(precisionRound((domainMin - tick0) / tickStep, precision));
|
|
1687
|
+
const end = Math.floor(precisionRound((domainMax - tick0) / tickStep, precision));
|
|
1688
|
+
const ticks = [];
|
|
1689
|
+
for(let i = start; i <= end; i++){
|
|
1690
|
+
ticks.push(precisionRound(tick0 + i * tickStep, precision));
|
|
1691
|
+
}
|
|
1692
|
+
return ticks;
|
|
1693
|
+
};
|
|
1694
|
+
const generateMonthlyTicks = (tick0, tickStepInMonths, scaleDomain, useUTC)=>{
|
|
1695
|
+
const domainMin = +(0, _d3array.min)(scaleDomain);
|
|
1696
|
+
const domainMax = +(0, _d3array.max)(scaleDomain);
|
|
1697
|
+
const getMonth = (d)=>useUTC ? d.getUTCMonth() : d.getMonth();
|
|
1698
|
+
const setMonth = (d, month)=>useUTC ? new Date(d.setUTCMonth(month)) : new Date(d.setMonth(month));
|
|
1699
|
+
// Find the earliest tick <= domainMin
|
|
1700
|
+
let start = 0;
|
|
1701
|
+
for(let firstTick = new Date(+tick0); +firstTick > domainMin;){
|
|
1702
|
+
firstTick = setMonth(firstTick, getMonth(firstTick) - tickStepInMonths);
|
|
1703
|
+
start -= tickStepInMonths;
|
|
1704
|
+
}
|
|
1705
|
+
const baseMonth = getMonth(tick0);
|
|
1706
|
+
const ticks = [];
|
|
1707
|
+
// Generate ticks forward until domainMax
|
|
1708
|
+
for(let i = start;; i += tickStepInMonths){
|
|
1709
|
+
let tickDate = setMonth(new Date(+tick0), baseMonth + i);
|
|
1710
|
+
// Handle month rollover (e.g., Jan 31 + 1 month → Mar 3 instead of Feb)
|
|
1711
|
+
if (getMonth(tickDate) !== ((baseMonth + i) % 12 + 12) % 12) {
|
|
1712
|
+
tickDate = useUTC ? new Date(tickDate.setUTCDate(0)) : new Date(tickDate.setDate(0));
|
|
1713
|
+
}
|
|
1714
|
+
if (+tickDate > domainMax) {
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
if (+tickDate >= domainMin) {
|
|
1718
|
+
ticks.push(tickDate);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return ticks;
|
|
1722
|
+
};
|
|
1723
|
+
const generateNumericTicks = (scaleType, tickStep, tick0, scaleDomain)=>{
|
|
1724
|
+
const refTick = typeof tick0 === 'number' ? tick0 : 0;
|
|
1725
|
+
if (scaleType === 'log') {
|
|
1726
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1727
|
+
return generateLinearTicks(refTick, tickStep, scaleDomain.map((d)=>Math.log10(d))).map((t)=>Math.pow(10, t));
|
|
1728
|
+
}
|
|
1729
|
+
if (typeof tickStep === 'string') {
|
|
1730
|
+
const prefix = tickStep[0];
|
|
1731
|
+
const num = (0, _chartutilities.isNumber)(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1732
|
+
if (prefix === 'L' && num > 0) {
|
|
1733
|
+
return generateLinearTicks(refTick, num, scaleDomain);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1739
|
+
return generateLinearTicks(refTick, tickStep, scaleDomain);
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
const generateDateTicks = (tickStep, tick0, scaleDomain, useUTC)=>{
|
|
1743
|
+
const refTick = tick0 instanceof Date ? tick0 : new Date(DEFAULT_DATE_STRING);
|
|
1744
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1745
|
+
return generateLinearTicks(+refTick, tickStep, scaleDomain.map((d)=>+d)).map((t)=>new Date(t));
|
|
1746
|
+
}
|
|
1747
|
+
if (typeof tickStep === 'string') {
|
|
1748
|
+
const prefix = tickStep[0];
|
|
1749
|
+
const num = (0, _chartutilities.isNumber)(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1750
|
+
if (prefix === 'M' && num > 0 && num === Math.round(num)) {
|
|
1751
|
+
return generateMonthlyTicks(refTick, num, scaleDomain, useUTC);
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
function calculatePrecision(value) {
|
|
1756
|
+
/**
|
|
1757
|
+
* Group 1:
|
|
1758
|
+
* [1-9]([0]+$) matches trailing zeros
|
|
1759
|
+
* Group 2:
|
|
1760
|
+
* \.([0-9]*) matches all digits after a decimal point.
|
|
1761
|
+
*/ const groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
|
|
1762
|
+
if (!groups) {
|
|
1763
|
+
return 0;
|
|
1764
|
+
}
|
|
1765
|
+
if (groups[1]) {
|
|
1766
|
+
return -groups[1].length;
|
|
1767
|
+
}
|
|
1768
|
+
if (groups[2]) {
|
|
1769
|
+
return groups[2].length;
|
|
1770
|
+
}
|
|
1771
|
+
return 0;
|
|
1772
|
+
}
|
|
1773
|
+
function precisionRound(value, precision, base = 10) {
|
|
1774
|
+
const exp = Math.pow(base, precision);
|
|
1775
|
+
return Math.round(value * exp) / exp;
|
|
1776
|
+
}
|