@fluentui/react-charts 9.2.2 → 9.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -2
- package/dist/index.d.ts +89 -10
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +3 -2
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +60 -19
- 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 +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +175 -107
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +6 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +791 -199
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +2 -2
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +29 -8
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/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 +251 -78
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +56 -37
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +158 -46
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +15 -5
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +3 -2
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +60 -18
- 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 +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +171 -105
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +810 -197
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +28 -7
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/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 +250 -78
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +157 -45
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +15 -4
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -10
|
@@ -4,6 +4,7 @@ import { select as d3Select, pointer } from 'd3-selection';
|
|
|
4
4
|
import { bisector } from 'd3-array';
|
|
5
5
|
import { Legends } from '../Legends/index';
|
|
6
6
|
import { line as d3Line } from 'd3-shape';
|
|
7
|
+
import { max as d3Max, min as d3Min } from 'd3-array';
|
|
7
8
|
import { useId } from '@fluentui/react-utilities';
|
|
8
9
|
import { find } from '../../utilities/index';
|
|
9
10
|
import { CartesianChart } from '../../index';
|
|
@@ -89,6 +90,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
89
90
|
* {@docCategory LineChart}
|
|
90
91
|
*/ export const LineChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
91
92
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
93
|
+
let _hasMarkersMode = false;
|
|
92
94
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
93
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
96
|
let _calloutPoints = calloutData(_points) || [];
|
|
@@ -117,6 +119,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
117
119
|
const _isRTL = useRtl();
|
|
118
120
|
let xAxisCalloutAccessibilityData = {};
|
|
119
121
|
const cartesianChartRef = React.useRef(null);
|
|
122
|
+
let _xMin = Number.NEGATIVE_INFINITY;
|
|
123
|
+
let _yMin = Number.NEGATIVE_INFINITY;
|
|
124
|
+
let _xMax = Number.POSITIVE_INFINITY;
|
|
125
|
+
let _xPadding = 0;
|
|
126
|
+
let _yPadding = 0;
|
|
120
127
|
let _yScaleSecondary;
|
|
121
128
|
const _legendsRef = React.useRef(null);
|
|
122
129
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
@@ -165,7 +172,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
165
172
|
}, []);
|
|
166
173
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
167
174
|
let domainNRangeValue;
|
|
168
|
-
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
175
|
+
if (_hasMarkersMode && xAxisType === XAxisTypes.NumericAxis) {
|
|
176
|
+
domainNRangeValue = _getDomainNRangeValuesWithPadding(points, margins, width, isRTL);
|
|
177
|
+
} else if (_hasMarkersMode && xAxisType === XAxisTypes.DateAxis) {
|
|
178
|
+
domainNRangeValue = _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
179
|
+
} else if (xAxisType === XAxisTypes.NumericAxis) {
|
|
169
180
|
domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);
|
|
170
181
|
} else if (xAxisType === XAxisTypes.DateAxis) {
|
|
171
182
|
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
@@ -186,6 +197,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
186
197
|
var _props_legendProps_selectedLegends, _props_legendProps, _props_legendProps1;
|
|
187
198
|
return ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : (_props_legendProps_selectedLegends = _props_legendProps.selectedLegends) === null || _props_legendProps_selectedLegends === void 0 ? void 0 : _props_legendProps_selectedLegends.includes(item.legend)) || ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegend) === item.legend;
|
|
188
199
|
}) : lineChartData;
|
|
200
|
+
var _filteredData_some;
|
|
201
|
+
_hasMarkersMode = (_filteredData_some = filteredData === null || filteredData === void 0 ? void 0 : filteredData.some((item)=>{
|
|
202
|
+
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
203
|
+
return (_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : (_item_lineOptions_mode = _item_lineOptions.mode) === null || _item_lineOptions_mode === void 0 ? void 0 : (_item_lineOptions_mode_includes = _item_lineOptions_mode.includes) === null || _item_lineOptions_mode_includes === void 0 ? void 0 : _item_lineOptions_mode_includes.call(_item_lineOptions_mode, 'markers');
|
|
204
|
+
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
189
205
|
return filteredData ? filteredData.map((item, index)=>{
|
|
190
206
|
let color;
|
|
191
207
|
if (typeof item.color === 'undefined') {
|
|
@@ -217,6 +233,18 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
217
233
|
function _getCustomizedCallout() {
|
|
218
234
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
219
235
|
}
|
|
236
|
+
function _getNumericMinMaxOfY(points) {
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
238
|
+
const { startValue, endValue } = findNumericMinMaxOfY(points);
|
|
239
|
+
_yMin = startValue;
|
|
240
|
+
if (_hasMarkersMode) {
|
|
241
|
+
_yPadding = (endValue - startValue) * 0.1;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
startValue: startValue - _yPadding,
|
|
245
|
+
endValue: endValue + _yPadding
|
|
246
|
+
};
|
|
247
|
+
}
|
|
220
248
|
function _getMargins(_margins) {
|
|
221
249
|
margins = _margins;
|
|
222
250
|
}
|
|
@@ -249,17 +277,26 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
249
277
|
function _createLegends(data) {
|
|
250
278
|
const { legendProps, allowMultipleShapesForPoints = false } = props;
|
|
251
279
|
const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
|
|
252
|
-
const
|
|
253
|
-
|
|
280
|
+
const mapLegendToPoints = {};
|
|
281
|
+
data.forEach((point)=>{
|
|
282
|
+
if (point.legend) {
|
|
283
|
+
if (!mapLegendToPoints[point.legend]) {
|
|
284
|
+
mapLegendToPoints[point.legend] = [];
|
|
285
|
+
}
|
|
286
|
+
mapLegendToPoints[point.legend].push(point);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const legendDataItems = Object.entries(mapLegendToPoints).map(([legendTitle, points])=>{
|
|
290
|
+
const representativePoint = points[0];
|
|
254
291
|
// mapping data to the format Legends component needs
|
|
255
292
|
const legend = {
|
|
256
|
-
title:
|
|
257
|
-
color,
|
|
293
|
+
title: legendTitle,
|
|
294
|
+
color: representativePoint.color,
|
|
258
295
|
action: ()=>{
|
|
259
296
|
if (isLegendMultiSelectEnabled) {
|
|
260
|
-
_handleMultipleLineLegendSelectionAction(
|
|
297
|
+
points.forEach((p)=>_handleMultipleLineLegendSelectionAction(p));
|
|
261
298
|
} else {
|
|
262
|
-
_handleSingleLegendSelectionAction(
|
|
299
|
+
points.forEach((p)=>_handleSingleLegendSelectionAction(p));
|
|
263
300
|
}
|
|
264
301
|
},
|
|
265
302
|
onMouseOutAction: ()=>{
|
|
@@ -267,13 +304,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
267
304
|
},
|
|
268
305
|
hoverAction: ()=>{
|
|
269
306
|
_handleChartMouseLeave();
|
|
270
|
-
setActiveLegend(
|
|
307
|
+
setActiveLegend(legendTitle);
|
|
271
308
|
},
|
|
272
|
-
...
|
|
273
|
-
shape:
|
|
309
|
+
...representativePoint.legendShape && {
|
|
310
|
+
shape: representativePoint.legendShape
|
|
274
311
|
},
|
|
275
312
|
...allowMultipleShapesForPoints && {
|
|
276
|
-
shape: Points[
|
|
313
|
+
shape: Points[representativePoint.index % Object.keys(pointTypes).length]
|
|
277
314
|
}
|
|
278
315
|
};
|
|
279
316
|
return legend;
|
|
@@ -367,6 +404,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
367
404
|
}
|
|
368
405
|
}
|
|
369
406
|
}
|
|
407
|
+
function _getRangeForScatterMarkerSize(yScale, yPadding) {
|
|
408
|
+
const extraXPixels = _isRTL ? _xAxisScale(_xMax - _xPadding) - _xAxisScale(_xMax) : _xAxisScale(_xMin + _xPadding) - _xAxisScale(_xMin);
|
|
409
|
+
const extraYPixels = yScale(_yMin) - yScale(_yMin + _yPadding);
|
|
410
|
+
return Math.min(extraXPixels, extraYPixels);
|
|
411
|
+
}
|
|
370
412
|
function _createLines(xElement, containerHeight) {
|
|
371
413
|
const lines = [];
|
|
372
414
|
if (isSelectedLegend) {
|
|
@@ -374,6 +416,12 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
374
416
|
} else {
|
|
375
417
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
376
418
|
}
|
|
419
|
+
const extraMaxPixels = _hasMarkersMode ? _getRangeForScatterMarkerSize(_yScalePrimary, _yPadding) : 0;
|
|
420
|
+
const maxMarkerSize = d3Max(_points, (point)=>{
|
|
421
|
+
return d3Max(point.data, (item)=>{
|
|
422
|
+
return item.markerSize;
|
|
423
|
+
});
|
|
424
|
+
});
|
|
377
425
|
for(let i = _points.length - 1; i >= 0; i--){
|
|
378
426
|
var _points_i_gaps, _points_i_lineOptions;
|
|
379
427
|
const linesForLine = [];
|
|
@@ -388,10 +436,12 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
388
436
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
389
437
|
const circleId = `${_circleId}_${i}`;
|
|
390
438
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
391
|
-
|
|
439
|
+
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
440
|
+
var _points_i_data__text;
|
|
441
|
+
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
392
442
|
id: circleId,
|
|
393
443
|
key: circleId,
|
|
394
|
-
r: activePoint === circleId ? 5.5 : 3.5,
|
|
444
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
395
445
|
cx: _xAxisScale(x1),
|
|
396
446
|
cy: yScale(y1),
|
|
397
447
|
fill: activePoint === circleId ? tokens.colorNeutralBackground1 : lineColor,
|
|
@@ -403,7 +453,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
403
453
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
404
454
|
stroke: activePoint === circleId ? lineColor : '',
|
|
405
455
|
role: "img",
|
|
406
|
-
"aria-label": _getAriaLabel(i, 0),
|
|
456
|
+
"aria-label": (_points_i_data__text = _points[i].data[0].text) !== null && _points_i_data__text !== void 0 ? _points_i_data__text : _getAriaLabel(i, 0),
|
|
407
457
|
"data-is-focusable": isLegendSelected,
|
|
408
458
|
ref: (e)=>{
|
|
409
459
|
_refCallback(e, circleId);
|
|
@@ -411,7 +461,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
411
461
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
412
462
|
onBlur: _handleMouseOut,
|
|
413
463
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
414
|
-
})
|
|
464
|
+
}), _points[i].data[0].text && /*#__PURE__*/ React.createElement("text", {
|
|
465
|
+
key: `${circleId}-label`,
|
|
466
|
+
x: _xAxisScale(x1),
|
|
467
|
+
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
468
|
+
className: classes.markerLabel,
|
|
469
|
+
opacity: isLegendSelected ? 1 : 0.1
|
|
470
|
+
}, _points[i].data[0].text)));
|
|
415
471
|
}
|
|
416
472
|
let gapIndex = 0;
|
|
417
473
|
var _points_i_gaps_sort;
|
|
@@ -499,7 +555,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
499
555
|
}));
|
|
500
556
|
} else if (!props.optimizeLargeData) {
|
|
501
557
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
502
|
-
var _points_i_lineOptions7;
|
|
558
|
+
var _points_i_lineOptions7, _points_i_lineOptions_mode, _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9;
|
|
503
559
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
504
560
|
const isInGap = gapResult.isInGap;
|
|
505
561
|
gapIndex = gapResult.gapIndex;
|
|
@@ -512,7 +568,34 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
512
568
|
const strokeWidth = ((_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
513
569
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
514
570
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
515
|
-
|
|
571
|
+
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
572
|
+
var _points_i_data__text1;
|
|
573
|
+
pointsForLine.push(((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : (_points_i_lineOptions_mode = _points_i_lineOptions8.mode) === null || _points_i_lineOptions_mode === void 0 ? void 0 : _points_i_lineOptions_mode.includes('markers')) ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
574
|
+
id: circleId,
|
|
575
|
+
key: circleId,
|
|
576
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
577
|
+
cx: _xAxisScale(x1),
|
|
578
|
+
cy: yScale(y1),
|
|
579
|
+
"data-is-focusable": isLegendSelected,
|
|
580
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
581
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
582
|
+
onMouseOut: _handleMouseOut,
|
|
583
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
584
|
+
onBlur: _handleMouseOut,
|
|
585
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
586
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
587
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
588
|
+
stroke: lineColor,
|
|
589
|
+
strokeWidth: strokeWidth,
|
|
590
|
+
role: "img",
|
|
591
|
+
"aria-label": (_points_i_data__text1 = _points[i].data[j - 1].text) !== null && _points_i_data__text1 !== void 0 ? _points_i_data__text1 : _getAriaLabel(i, j - 1)
|
|
592
|
+
}), _points[i].data[j - 1].text && /*#__PURE__*/ React.createElement("text", {
|
|
593
|
+
key: `${circleId}-label`,
|
|
594
|
+
x: _xAxisScale(x1),
|
|
595
|
+
y: yScale(y1) + 12,
|
|
596
|
+
fontSize: 12,
|
|
597
|
+
className: classes.markerLabel
|
|
598
|
+
}, _points[i].data[j - 1].text)) : /*#__PURE__*/ React.createElement("path", {
|
|
516
599
|
id: circleId,
|
|
517
600
|
key: circleId,
|
|
518
601
|
d: path,
|
|
@@ -532,15 +615,43 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
532
615
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
533
616
|
}));
|
|
534
617
|
if (j + 1 === _points[i].data.length) {
|
|
618
|
+
var _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
535
619
|
// If this is last point of the line segment.
|
|
536
620
|
const lastCircleId = `${circleId}${j}L`;
|
|
537
621
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
538
622
|
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
539
623
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
540
624
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
625
|
+
currentMarkerSize = _points[i].data[j].markerSize;
|
|
626
|
+
var _points_i_data_j_text;
|
|
541
627
|
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
542
628
|
key: `${lastCircleId}_container`
|
|
543
|
-
}, /*#__PURE__*/ React.createElement("
|
|
629
|
+
}, ((_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : (_points_i_lineOptions_mode2 = _points_i_lineOptions10.mode) === null || _points_i_lineOptions_mode2 === void 0 ? void 0 : _points_i_lineOptions_mode2.includes('markers')) ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("circle", {
|
|
630
|
+
id: lastCircleId,
|
|
631
|
+
key: lastCircleId,
|
|
632
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
633
|
+
cx: _xAxisScale(x2),
|
|
634
|
+
cy: yScale(y2),
|
|
635
|
+
"data-is-focusable": isLegendSelected,
|
|
636
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
637
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
638
|
+
onMouseOut: _handleMouseOut,
|
|
639
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
640
|
+
onBlur: _handleMouseOut,
|
|
641
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
642
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
643
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
644
|
+
stroke: lineColor,
|
|
645
|
+
strokeWidth: strokeWidth,
|
|
646
|
+
role: "img",
|
|
647
|
+
"aria-label": (_points_i_data_j_text = _points[i].data[j].text) !== null && _points_i_data_j_text !== void 0 ? _points_i_data_j_text : _getAriaLabel(i, j)
|
|
648
|
+
}), _points[i].data[j].text && /*#__PURE__*/ React.createElement("text", {
|
|
649
|
+
key: `${lastCircleId}-label`,
|
|
650
|
+
x: _xAxisScale(x2),
|
|
651
|
+
y: yScale(y2) + 12,
|
|
652
|
+
fontSize: 12,
|
|
653
|
+
className: classes.markerLabel
|
|
654
|
+
}, _points[i].data[j].text)) : /*#__PURE__*/ React.createElement("path", {
|
|
544
655
|
id: lastCircleId,
|
|
545
656
|
key: lastCircleId,
|
|
546
657
|
d: path,
|
|
@@ -574,72 +685,71 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
574
685
|
focusable: false,
|
|
575
686
|
onBlur: _handleMouseOut
|
|
576
687
|
})));
|
|
577
|
-
|
|
578
|
-
if (
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
688
|
+
}
|
|
689
|
+
if (!_hasMarkersMode || ((_points_i_lineOptions9 = _points[i].lineOptions) === null || _points_i_lineOptions9 === void 0 ? void 0 : (_points_i_lineOptions_mode1 = _points_i_lineOptions9.mode) === null || _points_i_lineOptions_mode1 === void 0 ? void 0 : _points_i_lineOptions_mode1.includes('lines'))) {
|
|
690
|
+
if (isLegendSelected) {
|
|
691
|
+
// don't draw line if it is in a gap
|
|
692
|
+
if (!isInGap) {
|
|
693
|
+
var _points_i_lineOptions11, _points_i_lineOptions12, _points_i_lineOptions13, _points_i_lineOptions14;
|
|
694
|
+
const lineBorderWidth = ((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
695
|
+
if (lineBorderWidth > 0) {
|
|
696
|
+
var _points_i_lineOptions15, _points_i_lineOptions16;
|
|
697
|
+
var _points_i_lineOptions_strokeLinecap3;
|
|
698
|
+
bordersForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
699
|
+
id: borderId,
|
|
700
|
+
key: borderId,
|
|
701
|
+
x1: _xAxisScale(x1),
|
|
702
|
+
y1: yScale(y1),
|
|
703
|
+
x2: _xAxisScale(x2),
|
|
704
|
+
y2: yScale(y2),
|
|
705
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
706
|
+
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
707
|
+
stroke: ((_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
708
|
+
opacity: 1
|
|
709
|
+
}));
|
|
710
|
+
}
|
|
711
|
+
var _points_i_lineOptions_strokeLinecap4;
|
|
712
|
+
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
713
|
+
id: lineId,
|
|
714
|
+
key: lineId,
|
|
589
715
|
x1: _xAxisScale(x1),
|
|
590
716
|
y1: yScale(y1),
|
|
591
717
|
x2: _xAxisScale(x2),
|
|
592
718
|
y2: yScale(y2),
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
stroke: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderColor
|
|
719
|
+
strokeWidth: strokeWidth,
|
|
720
|
+
ref: (e)=>{
|
|
721
|
+
_refCallback(e, lineId);
|
|
597
722
|
},
|
|
598
|
-
|
|
599
|
-
|
|
723
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
724
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
725
|
+
onMouseOut: _handleMouseOut,
|
|
726
|
+
stroke: lineColor,
|
|
727
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : _points_i_lineOptions12.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
728
|
+
strokeDasharray: (_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.strokeDasharray,
|
|
729
|
+
strokeDashoffset: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.strokeDashoffset,
|
|
730
|
+
opacity: 1,
|
|
731
|
+
..._getClickHandler(_points[i].onLineClick)
|
|
732
|
+
}));
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
if (!isInGap) {
|
|
736
|
+
var _points_i_lineOptions17, _points_i_lineOptions18, _points_i_lineOptions19;
|
|
737
|
+
var _points_i_lineOptions_strokeLinecap5;
|
|
738
|
+
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
739
|
+
id: lineId,
|
|
740
|
+
key: lineId,
|
|
741
|
+
x1: _xAxisScale(x1),
|
|
742
|
+
y1: yScale(y1),
|
|
743
|
+
x2: _xAxisScale(x2),
|
|
744
|
+
y2: yScale(y2),
|
|
745
|
+
strokeWidth: strokeWidth,
|
|
746
|
+
stroke: lineColor,
|
|
747
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
748
|
+
strokeDasharray: (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeDasharray,
|
|
749
|
+
strokeDashoffset: (_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.strokeDashoffset,
|
|
750
|
+
opacity: 0.1
|
|
600
751
|
}));
|
|
601
752
|
}
|
|
602
|
-
var _points_i_lineOptions_strokeLinecap4;
|
|
603
|
-
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
604
|
-
id: lineId,
|
|
605
|
-
key: lineId,
|
|
606
|
-
x1: _xAxisScale(x1),
|
|
607
|
-
y1: yScale(y1),
|
|
608
|
-
x2: _xAxisScale(x2),
|
|
609
|
-
y2: yScale(y2),
|
|
610
|
-
strokeWidth: strokeWidth,
|
|
611
|
-
ref: (e)=>{
|
|
612
|
-
_refCallback(e, lineId);
|
|
613
|
-
},
|
|
614
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
615
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
616
|
-
onMouseOut: _handleMouseOut,
|
|
617
|
-
stroke: lineColor,
|
|
618
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions9 = _points[i].lineOptions) === null || _points_i_lineOptions9 === void 0 ? void 0 : _points_i_lineOptions9.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
619
|
-
strokeDasharray: (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeDasharray,
|
|
620
|
-
strokeDashoffset: (_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.strokeDashoffset,
|
|
621
|
-
opacity: 1,
|
|
622
|
-
..._getClickHandler(_points[i].onLineClick)
|
|
623
|
-
}));
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
if (!isInGap) {
|
|
627
|
-
var _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
628
|
-
var _points_i_lineOptions_strokeLinecap5;
|
|
629
|
-
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
630
|
-
id: lineId,
|
|
631
|
-
key: lineId,
|
|
632
|
-
x1: _xAxisScale(x1),
|
|
633
|
-
y1: yScale(y1),
|
|
634
|
-
x2: _xAxisScale(x2),
|
|
635
|
-
y2: yScale(y2),
|
|
636
|
-
strokeWidth: strokeWidth,
|
|
637
|
-
stroke: lineColor,
|
|
638
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
639
|
-
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
640
|
-
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
641
|
-
opacity: 0.1
|
|
642
|
-
}));
|
|
643
753
|
}
|
|
644
754
|
}
|
|
645
755
|
}
|
|
@@ -979,6 +1089,69 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
979
1089
|
const yValue = point.yAxisCalloutData || point.y;
|
|
980
1090
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
981
1091
|
}
|
|
1092
|
+
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1093
|
+
let sDate;
|
|
1094
|
+
let lDate;
|
|
1095
|
+
sDate = d3Min(points, (point)=>{
|
|
1096
|
+
return d3Min(point.data, (item)=>item.x);
|
|
1097
|
+
});
|
|
1098
|
+
lDate = d3Max(points, (point)=>{
|
|
1099
|
+
return d3Max(point.data, (item)=>item.x);
|
|
1100
|
+
});
|
|
1101
|
+
// Include tickValues if present
|
|
1102
|
+
sDate = d3Min([
|
|
1103
|
+
...tickValues,
|
|
1104
|
+
sDate
|
|
1105
|
+
]);
|
|
1106
|
+
lDate = d3Max([
|
|
1107
|
+
...tickValues,
|
|
1108
|
+
lDate
|
|
1109
|
+
]);
|
|
1110
|
+
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1111
|
+
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1112
|
+
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
1113
|
+
const paddedSDate = new Date(sDate.getTime() - datePadding);
|
|
1114
|
+
const paddedLDate = new Date(lDate.getTime() + datePadding);
|
|
1115
|
+
const rStartValue = margins.left;
|
|
1116
|
+
const rEndValue = width - margins.right;
|
|
1117
|
+
return isRTL ? {
|
|
1118
|
+
dStartValue: paddedLDate,
|
|
1119
|
+
dEndValue: paddedSDate,
|
|
1120
|
+
rStartValue,
|
|
1121
|
+
rEndValue
|
|
1122
|
+
} : {
|
|
1123
|
+
dStartValue: paddedSDate,
|
|
1124
|
+
dEndValue: paddedLDate,
|
|
1125
|
+
rStartValue,
|
|
1126
|
+
rEndValue
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1130
|
+
_xMin = d3Min(points, (point)=>{
|
|
1131
|
+
return d3Min(point.data, (item)=>item.x);
|
|
1132
|
+
});
|
|
1133
|
+
_xMax = d3Max(points, (point)=>{
|
|
1134
|
+
return d3Max(point.data, (item)=>{
|
|
1135
|
+
return item.x;
|
|
1136
|
+
});
|
|
1137
|
+
});
|
|
1138
|
+
if (_hasMarkersMode) {
|
|
1139
|
+
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1140
|
+
}
|
|
1141
|
+
const rStartValue = margins.left;
|
|
1142
|
+
const rEndValue = width - margins.right;
|
|
1143
|
+
return isRTL ? {
|
|
1144
|
+
dStartValue: _xMax + _xPadding,
|
|
1145
|
+
dEndValue: _xMin - _xPadding,
|
|
1146
|
+
rStartValue,
|
|
1147
|
+
rEndValue
|
|
1148
|
+
} : {
|
|
1149
|
+
dStartValue: _xMin - _xPadding,
|
|
1150
|
+
dEndValue: _xMax + _xPadding,
|
|
1151
|
+
rStartValue,
|
|
1152
|
+
rEndValue
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
982
1155
|
function _isChartEmpty() {
|
|
983
1156
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
984
1157
|
}
|
|
@@ -1029,7 +1202,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1029
1202
|
legendBars: legendBars,
|
|
1030
1203
|
createYAxis: createNumericYAxis,
|
|
1031
1204
|
getmargins: _getMargins,
|
|
1032
|
-
getMinMaxOfYAxis:
|
|
1205
|
+
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1033
1206
|
getGraphData: _initializeLineChartData,
|
|
1034
1207
|
xAxisType: isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis,
|
|
1035
1208
|
getDomainNRangeValues: _getDomainNRangeValues,
|