@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
|
@@ -21,6 +21,7 @@ const _index2 = require("../../index");
|
|
|
21
21
|
const _EventAnnotation = require("./eventAnnotation/EventAnnotation");
|
|
22
22
|
const _reacttheme = require("@fluentui/react-theme");
|
|
23
23
|
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
24
|
+
const _scatterpolarutils = require("../../utilities/scatterpolar-utils");
|
|
24
25
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
25
26
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
26
27
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -96,6 +97,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
96
97
|
const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
97
98
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
98
99
|
let _hasMarkersMode = false;
|
|
100
|
+
let _isXAxisDateType = false;
|
|
101
|
+
let _isScatterPolar = false;
|
|
99
102
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
100
103
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
104
|
let _calloutPoints = (0, _index1.calloutData)(_points) || [];
|
|
@@ -124,11 +127,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
124
127
|
const _isRTL = (0, _index1.useRtl)();
|
|
125
128
|
let xAxisCalloutAccessibilityData = {};
|
|
126
129
|
const cartesianChartRef = _react.useRef(null);
|
|
127
|
-
let _xMin = Number.NEGATIVE_INFINITY;
|
|
128
|
-
let _yMin = Number.NEGATIVE_INFINITY;
|
|
129
|
-
let _xMax = Number.POSITIVE_INFINITY;
|
|
130
|
-
let _xPadding = 0;
|
|
131
|
-
let _yPadding = 0;
|
|
132
130
|
let _yScaleSecondary;
|
|
133
131
|
const _legendsRef = _react.useRef(null);
|
|
134
132
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
@@ -149,6 +147,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
149
147
|
y: 0
|
|
150
148
|
});
|
|
151
149
|
const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
|
|
150
|
+
const [YValue, setYValue] = _react.useState('');
|
|
151
|
+
const [legendVal, setLegendVal] = _react.useState('');
|
|
152
|
+
const [lineColor, setLineColor] = _react.useState('');
|
|
152
153
|
const pointsRef = _react.useRef([]);
|
|
153
154
|
const calloutPointsRef = _react.useRef([]);
|
|
154
155
|
const classes = (0, _useLineChartStylesstyles.useLineChartStyles)(props);
|
|
@@ -177,14 +178,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
177
178
|
}, []);
|
|
178
179
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
179
180
|
let domainNRangeValue;
|
|
180
|
-
if (
|
|
181
|
-
domainNRangeValue =
|
|
182
|
-
} else if (_hasMarkersMode && xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
183
|
-
domainNRangeValue = _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
184
|
-
} else if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
185
|
-
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaChart)(points, margins, width, isRTL);
|
|
181
|
+
if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
182
|
+
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
186
183
|
} else if (xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
187
|
-
domainNRangeValue = (0, _index1.
|
|
184
|
+
domainNRangeValue = (0, _index1.domainRangeOfDateForAreaLineScatterVerticalBarCharts)(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
188
185
|
} else {
|
|
189
186
|
domainNRangeValue = {
|
|
190
187
|
dStartValue: 0,
|
|
@@ -207,6 +204,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
207
204
|
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
208
205
|
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');
|
|
209
206
|
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
207
|
+
_isScatterPolar = (0, _index1.isScatterPolarSeries)(filteredData);
|
|
210
208
|
return filteredData ? filteredData.map((item, index)=>{
|
|
211
209
|
let color;
|
|
212
210
|
if (typeof item.color === 'undefined') {
|
|
@@ -238,16 +236,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
238
236
|
function _getCustomizedCallout() {
|
|
239
237
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
240
238
|
}
|
|
241
|
-
function _getNumericMinMaxOfY(points) {
|
|
239
|
+
function _getNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
242
240
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
243
|
-
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points);
|
|
244
|
-
|
|
241
|
+
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
242
|
+
let yPadding = {
|
|
243
|
+
start: 0,
|
|
244
|
+
end: 0
|
|
245
|
+
};
|
|
245
246
|
if (_hasMarkersMode) {
|
|
246
|
-
|
|
247
|
+
yPadding = (0, _index1.getDomainPaddingForMarkers)(startValue, endValue, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
247
248
|
}
|
|
248
249
|
return {
|
|
249
|
-
startValue: startValue -
|
|
250
|
-
endValue: endValue +
|
|
250
|
+
startValue: startValue - yPadding.start,
|
|
251
|
+
endValue: endValue + yPadding.end
|
|
251
252
|
};
|
|
252
253
|
}
|
|
253
254
|
function _getMargins(_margins) {
|
|
@@ -409,11 +410,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
|
-
function _getRangeForScatterMarkerSize(yScale, yPadding) {
|
|
413
|
-
const extraXPixels = _isRTL ? _xAxisScale(_xMax - _xPadding) - _xAxisScale(_xMax) : _xAxisScale(_xMin + _xPadding) - _xAxisScale(_xMin);
|
|
414
|
-
const extraYPixels = yScale(_yMin) - yScale(_yMin + _yPadding);
|
|
415
|
-
return Math.min(extraXPixels, extraYPixels);
|
|
416
|
-
}
|
|
417
413
|
function _createLines(xElement, containerHeight) {
|
|
418
414
|
const lines = [];
|
|
419
415
|
if (isSelectedLegend) {
|
|
@@ -421,7 +417,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
421
417
|
} else {
|
|
422
418
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
423
419
|
}
|
|
424
|
-
const extraMaxPixels = _hasMarkersMode ? _getRangeForScatterMarkerSize(_yScalePrimary, _yPadding) : 0;
|
|
425
420
|
const maxMarkerSize = (0, _d3array.max)(_points, (point)=>{
|
|
426
421
|
return (0, _d3array.max)(point.data, (item)=>{
|
|
427
422
|
return item.markerSize;
|
|
@@ -435,44 +430,64 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
435
430
|
const legendVal = _points[i].legend;
|
|
436
431
|
const lineColor = _points[i].color;
|
|
437
432
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
438
|
-
const
|
|
433
|
+
const useSecondaryYScale = !!(_points[i].useSecondaryYScale && _yScaleSecondary);
|
|
434
|
+
const yScale = useSecondaryYScale ? _yScaleSecondary : _yScalePrimary;
|
|
435
|
+
const extraMaxPixels = _hasMarkersMode ? (0, _index1.getRangeForScatterMarkerSize)({
|
|
436
|
+
data: _points,
|
|
437
|
+
xScale: _xAxisScale,
|
|
438
|
+
yScalePrimary: _yScalePrimary,
|
|
439
|
+
yScaleSecondary: _yScaleSecondary,
|
|
440
|
+
useSecondaryYScale,
|
|
441
|
+
xScaleType: props.xScaleType,
|
|
442
|
+
yScaleType: props.yScaleType,
|
|
443
|
+
secondaryYScaleType: props.secondaryYScaleType
|
|
444
|
+
}) : 0;
|
|
439
445
|
if (_points[i].data.length === 1) {
|
|
440
446
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
441
447
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
442
|
-
const
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
448
|
+
const xPoint = _xAxisScale(x1);
|
|
449
|
+
const yPoint = yScale(y1);
|
|
450
|
+
if ((0, _index1.isPlottable)(xPoint, yPoint)) {
|
|
451
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
452
|
+
const circleId = `${_circleId}_${i}`;
|
|
453
|
+
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
454
|
+
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
455
|
+
const supportsTextMode = (_points_i_lineOptions1 = _points[i].lineOptions) === null || _points_i_lineOptions1 === void 0 ? void 0 : (_points_i_lineOptions_mode = _points_i_lineOptions1.mode) === null || _points_i_lineOptions_mode === void 0 ? void 0 : _points_i_lineOptions_mode.includes('text');
|
|
456
|
+
const text = _points[i].data[0].text;
|
|
457
|
+
var _points_i_data__text;
|
|
458
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
459
|
+
key: `${circleId}_fragment`
|
|
460
|
+
}, /*#__PURE__*/ _react.createElement("circle", {
|
|
461
|
+
id: circleId,
|
|
462
|
+
key: circleId,
|
|
463
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
464
|
+
cx: xPoint,
|
|
465
|
+
cy: yPoint,
|
|
466
|
+
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
467
|
+
opacity: isLegendSelected ? 1 : 0.1,
|
|
468
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
469
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
470
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
471
|
+
onMouseOut: _handleMouseOut,
|
|
472
|
+
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
473
|
+
stroke: activePoint === circleId ? lineColor : '',
|
|
474
|
+
role: "img",
|
|
475
|
+
"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),
|
|
476
|
+
"data-is-focusable": isLegendSelected,
|
|
477
|
+
ref: (e)=>{
|
|
478
|
+
_refCallback(e, circleId);
|
|
479
|
+
},
|
|
480
|
+
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
481
|
+
onBlur: _handleMouseOut,
|
|
482
|
+
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
483
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
484
|
+
key: `${circleId}-label`,
|
|
485
|
+
x: xPoint,
|
|
486
|
+
y: yPoint + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
487
|
+
className: classes.markerLabel,
|
|
488
|
+
opacity: isLegendSelected ? 1 : 0.1
|
|
489
|
+
}, text))));
|
|
490
|
+
}
|
|
476
491
|
}
|
|
477
492
|
let gapIndex = 0;
|
|
478
493
|
var _points_i_gaps_sort;
|
|
@@ -480,13 +495,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
480
495
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
481
496
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
482
497
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
483
|
-
var
|
|
498
|
+
var _points_i_lineOptions2;
|
|
484
499
|
const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
485
500
|
.x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
486
|
-
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve));
|
|
501
|
+
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve)).defined((d)=>(0, _index1.isPlottable)(_xAxisScale(d[0]), yScale(d[1])));
|
|
487
502
|
const lineId = `${_lineId}_${i}`;
|
|
488
503
|
const borderId = `${_borderId}_${i}`;
|
|
489
|
-
const strokeWidth = ((
|
|
504
|
+
const strokeWidth = ((_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
490
505
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
491
506
|
const lineData = [];
|
|
492
507
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -496,19 +511,19 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
496
511
|
]);
|
|
497
512
|
}
|
|
498
513
|
if (isLegendSelected) {
|
|
499
|
-
var
|
|
500
|
-
const lineBorderWidth = ((
|
|
514
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
515
|
+
const lineBorderWidth = ((_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
501
516
|
if (lineBorderWidth > 0) {
|
|
502
|
-
var
|
|
517
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
503
518
|
var _points_i_lineOptions_strokeLinecap;
|
|
504
519
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
505
520
|
id: borderId,
|
|
506
521
|
key: borderId,
|
|
507
522
|
d: line(lineData),
|
|
508
523
|
fill: "transparent",
|
|
509
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
524
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
|
|
510
525
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
511
|
-
stroke: ((
|
|
526
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
512
527
|
opacity: 1
|
|
513
528
|
}));
|
|
514
529
|
}
|
|
@@ -521,7 +536,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
521
536
|
"data-is-focusable": true,
|
|
522
537
|
stroke: lineColor,
|
|
523
538
|
strokeWidth: strokeWidth,
|
|
524
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
539
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
525
540
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
526
541
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
527
542
|
onMouseOut: _handleMouseOut,
|
|
@@ -530,7 +545,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
530
545
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
531
546
|
}));
|
|
532
547
|
} else {
|
|
533
|
-
var
|
|
548
|
+
var _points_i_lineOptions7;
|
|
534
549
|
var _points_i_lineOptions_strokeLinecap2;
|
|
535
550
|
linesForLine.push(/*#__PURE__*/ _react.createElement("path", {
|
|
536
551
|
id: lineId,
|
|
@@ -540,7 +555,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
540
555
|
"data-is-focusable": false,
|
|
541
556
|
stroke: lineColor,
|
|
542
557
|
strokeWidth: strokeWidth,
|
|
543
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
558
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
544
559
|
opacity: 0.1
|
|
545
560
|
}));
|
|
546
561
|
}
|
|
@@ -560,7 +575,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
560
575
|
}));
|
|
561
576
|
} else if (!props.optimizeLargeData) {
|
|
562
577
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
563
|
-
var
|
|
578
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
564
579
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
565
580
|
const isInGap = gapResult.isInGap;
|
|
566
581
|
gapIndex = gapResult.gapIndex;
|
|
@@ -569,147 +584,159 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
569
584
|
const circleId = `${_circleId}_${i}_${j}`;
|
|
570
585
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
571
586
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
572
|
-
|
|
573
|
-
const
|
|
587
|
+
const xPoint1 = _xAxisScale(x1);
|
|
588
|
+
const yPoint1 = yScale(y1);
|
|
589
|
+
const xPoint2 = _xAxisScale(x2);
|
|
590
|
+
const yPoint2 = yScale(y2);
|
|
591
|
+
const strokeWidth = ((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
574
592
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
575
593
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
594
|
+
const supportsTextMode = (_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('text');
|
|
595
|
+
const text = _points[i].data[j - 1].text;
|
|
576
596
|
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
"data-is-focusable": isLegendSelected,
|
|
585
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
586
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
587
|
-
onMouseOut: _handleMouseOut,
|
|
588
|
-
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
589
|
-
onBlur: _handleMouseOut,
|
|
590
|
-
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
591
|
-
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
592
|
-
fill: _getPointFill(lineColor, circleId, j, false),
|
|
593
|
-
stroke: lineColor,
|
|
594
|
-
strokeWidth: strokeWidth,
|
|
595
|
-
role: "img",
|
|
596
|
-
"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)
|
|
597
|
-
}), _points[i].data[j - 1].text && /*#__PURE__*/ _react.createElement("text", {
|
|
598
|
-
key: `${circleId}-label`,
|
|
599
|
-
x: _xAxisScale(x1),
|
|
600
|
-
y: yScale(y1) + 12,
|
|
601
|
-
fontSize: 12,
|
|
602
|
-
className: classes.markerLabel
|
|
603
|
-
}, _points[i].data[j - 1].text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
604
|
-
id: circleId,
|
|
605
|
-
key: circleId,
|
|
606
|
-
d: path,
|
|
607
|
-
"data-is-focusable": isLegendSelected,
|
|
608
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
609
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
610
|
-
onMouseOut: _handleMouseOut,
|
|
611
|
-
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
612
|
-
onBlur: _handleMouseOut,
|
|
613
|
-
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
614
|
-
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
615
|
-
fill: _getPointFill(lineColor, circleId, j, false),
|
|
616
|
-
stroke: lineColor,
|
|
617
|
-
strokeWidth: strokeWidth,
|
|
618
|
-
role: "img",
|
|
619
|
-
"aria-label": _getAriaLabel(i, j - 1),
|
|
620
|
-
tabIndex: isLegendSelected ? 0 : undefined
|
|
621
|
-
}));
|
|
622
|
-
if (j + 1 === _points[i].data.length) {
|
|
623
|
-
var _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
624
|
-
// If this is last point of the line segment.
|
|
625
|
-
const lastCircleId = `${circleId}${j}L`;
|
|
626
|
-
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
627
|
-
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
628
|
-
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
629
|
-
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
630
|
-
currentMarkerSize = _points[i].data[j].markerSize;
|
|
631
|
-
var _points_i_data_j_text;
|
|
632
|
-
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
633
|
-
key: `${lastCircleId}_container`
|
|
634
|
-
}, ((_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", {
|
|
635
|
-
id: lastCircleId,
|
|
636
|
-
key: lastCircleId,
|
|
597
|
+
if ((0, _index1.isPlottable)(xPoint1, yPoint1)) {
|
|
598
|
+
var _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
599
|
+
const path = _getPath(xPoint1, yPoint1, circleId, j, false, _points[i].index);
|
|
600
|
+
var _points_i_data__text1;
|
|
601
|
+
pointsForLine.push(((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : (_points_i_lineOptions_mode3 = _points_i_lineOptions11.mode) === null || _points_i_lineOptions_mode3 === void 0 ? void 0 : _points_i_lineOptions_mode3.includes('markers')) || supportsTextMode ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
602
|
+
id: circleId,
|
|
603
|
+
key: circleId,
|
|
637
604
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
638
|
-
cx:
|
|
639
|
-
cy:
|
|
605
|
+
cx: xPoint1,
|
|
606
|
+
cy: yPoint1,
|
|
640
607
|
"data-is-focusable": isLegendSelected,
|
|
641
|
-
onMouseOver: (event)=>_handleHover(
|
|
642
|
-
onMouseMove: (event)=>_handleHover(
|
|
608
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
609
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
643
610
|
onMouseOut: _handleMouseOut,
|
|
644
|
-
onFocus: (event)=>_handleFocus(event, lineId,
|
|
611
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
645
612
|
onBlur: _handleMouseOut,
|
|
646
|
-
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
647
|
-
opacity: isLegendSelected && !
|
|
648
|
-
fill: _getPointFill(lineColor,
|
|
613
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
614
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
615
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
649
616
|
stroke: lineColor,
|
|
650
617
|
strokeWidth: strokeWidth,
|
|
651
618
|
role: "img",
|
|
652
|
-
"aria-label": (
|
|
653
|
-
}),
|
|
654
|
-
key: `${
|
|
655
|
-
x:
|
|
656
|
-
y:
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
},
|
|
660
|
-
id:
|
|
661
|
-
key:
|
|
619
|
+
"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)
|
|
620
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ _react.createElement("text", {
|
|
621
|
+
key: `${circleId}-label`,
|
|
622
|
+
x: xPoint1,
|
|
623
|
+
y: yPoint1 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
624
|
+
className: classes.markerLabel,
|
|
625
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
626
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
627
|
+
id: circleId,
|
|
628
|
+
key: circleId,
|
|
662
629
|
d: path,
|
|
663
630
|
"data-is-focusable": isLegendSelected,
|
|
664
|
-
onMouseOver: (event)=>_handleHover(
|
|
665
|
-
onMouseMove: (event)=>_handleHover(
|
|
631
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
632
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
666
633
|
onMouseOut: _handleMouseOut,
|
|
667
|
-
onFocus: (event)=>_handleFocus(event, lineId,
|
|
634
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
668
635
|
onBlur: _handleMouseOut,
|
|
669
|
-
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
670
|
-
opacity: isLegendSelected && !
|
|
671
|
-
fill: _getPointFill(lineColor,
|
|
636
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
637
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
638
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
672
639
|
stroke: lineColor,
|
|
673
640
|
strokeWidth: strokeWidth,
|
|
674
641
|
role: "img",
|
|
675
|
-
"aria-label": _getAriaLabel(i, j),
|
|
642
|
+
"aria-label": _getAriaLabel(i, j - 1),
|
|
676
643
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
677
|
-
})
|
|
678
|
-
id: hiddenHoverCircleId,
|
|
679
|
-
key: hiddenHoverCircleId,
|
|
680
|
-
r: 8,
|
|
681
|
-
cx: _xAxisScale(x2),
|
|
682
|
-
cy: yScale(y2),
|
|
683
|
-
opacity: 0,
|
|
684
|
-
width: 0,
|
|
685
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
686
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
687
|
-
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
688
|
-
onMouseOut: _handleMouseOut,
|
|
689
|
-
strokeWidth: 0,
|
|
690
|
-
focusable: false,
|
|
691
|
-
onBlur: _handleMouseOut
|
|
692
|
-
})));
|
|
644
|
+
}));
|
|
693
645
|
}
|
|
694
|
-
if (
|
|
646
|
+
if (j + 1 === _points[i].data.length) {
|
|
647
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12;
|
|
648
|
+
// If this is last point of the line segment.
|
|
649
|
+
const lastCircleId = `${circleId}${j}L`;
|
|
650
|
+
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
651
|
+
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
652
|
+
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
653
|
+
currentMarkerSize = _points[i].data[j].markerSize;
|
|
654
|
+
const lastSupportsTextMode = (_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : (_points_i_lineOptions_mode4 = _points_i_lineOptions12.mode) === null || _points_i_lineOptions_mode4 === void 0 ? void 0 : _points_i_lineOptions_mode4.includes('text');
|
|
655
|
+
const lastText = _points[i].data[j].text;
|
|
656
|
+
if ((0, _index1.isPlottable)(xPoint2, yPoint2)) {
|
|
657
|
+
var _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
658
|
+
const path = _getPath(xPoint2, yPoint2, lastCircleId, j, true, _points[i].index);
|
|
659
|
+
var _points_i_data_j_text;
|
|
660
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
661
|
+
key: `${lastCircleId}_container`
|
|
662
|
+
}, ((_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : (_points_i_lineOptions_mode5 = _points_i_lineOptions13.mode) === null || _points_i_lineOptions_mode5 === void 0 ? void 0 : _points_i_lineOptions_mode5.includes('markers')) || lastSupportsTextMode ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
663
|
+
id: lastCircleId,
|
|
664
|
+
key: lastCircleId,
|
|
665
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
666
|
+
cx: xPoint2,
|
|
667
|
+
cy: yPoint2,
|
|
668
|
+
"data-is-focusable": isLegendSelected,
|
|
669
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
670
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
671
|
+
onMouseOut: _handleMouseOut,
|
|
672
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
673
|
+
onBlur: _handleMouseOut,
|
|
674
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
675
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
676
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
677
|
+
stroke: lineColor,
|
|
678
|
+
strokeWidth: strokeWidth,
|
|
679
|
+
role: "img",
|
|
680
|
+
"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)
|
|
681
|
+
}), !_isScatterPolar && lastSupportsTextMode && lastText && /*#__PURE__*/ _react.createElement("text", {
|
|
682
|
+
key: `${lastCircleId}-label`,
|
|
683
|
+
x: xPoint2,
|
|
684
|
+
y: yPoint2 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
685
|
+
className: classes.markerLabel
|
|
686
|
+
}, text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
687
|
+
id: lastCircleId,
|
|
688
|
+
key: lastCircleId,
|
|
689
|
+
d: path,
|
|
690
|
+
"data-is-focusable": isLegendSelected,
|
|
691
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
692
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
693
|
+
onMouseOut: _handleMouseOut,
|
|
694
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
695
|
+
onBlur: _handleMouseOut,
|
|
696
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
697
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
698
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
699
|
+
stroke: lineColor,
|
|
700
|
+
strokeWidth: strokeWidth,
|
|
701
|
+
role: "img",
|
|
702
|
+
"aria-label": _getAriaLabel(i, j),
|
|
703
|
+
tabIndex: isLegendSelected ? 0 : undefined
|
|
704
|
+
}), /*#__PURE__*/ _react.createElement("circle", {
|
|
705
|
+
id: hiddenHoverCircleId,
|
|
706
|
+
key: hiddenHoverCircleId,
|
|
707
|
+
r: 8,
|
|
708
|
+
cx: xPoint2,
|
|
709
|
+
cy: yPoint2,
|
|
710
|
+
opacity: 0,
|
|
711
|
+
width: 0,
|
|
712
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
713
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
714
|
+
onMouseOut: _handleMouseOut,
|
|
715
|
+
strokeWidth: 0,
|
|
716
|
+
focusable: false,
|
|
717
|
+
onBlur: _handleMouseOut
|
|
718
|
+
})));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if ((0, _index1.isPlottable)(xPoint1, yPoint1) && (0, _index1.isPlottable)(xPoint2, yPoint2) && (!_hasMarkersMode || ((_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('lines')))) {
|
|
695
722
|
if (isLegendSelected) {
|
|
696
723
|
// don't draw line if it is in a gap
|
|
697
724
|
if (!isInGap) {
|
|
698
|
-
var
|
|
699
|
-
const lineBorderWidth = ((
|
|
725
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
726
|
+
const lineBorderWidth = ((_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
700
727
|
if (lineBorderWidth > 0) {
|
|
701
|
-
var
|
|
728
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
702
729
|
var _points_i_lineOptions_strokeLinecap3;
|
|
703
730
|
bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
704
731
|
id: borderId,
|
|
705
732
|
key: borderId,
|
|
706
|
-
x1:
|
|
707
|
-
y1:
|
|
708
|
-
x2:
|
|
709
|
-
y2:
|
|
710
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
733
|
+
x1: xPoint1,
|
|
734
|
+
y1: yPoint1,
|
|
735
|
+
x2: xPoint2,
|
|
736
|
+
y2: yPoint2,
|
|
737
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
711
738
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
712
|
-
stroke: ((
|
|
739
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
713
740
|
opacity: 1
|
|
714
741
|
}));
|
|
715
742
|
}
|
|
@@ -717,41 +744,41 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
717
744
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
718
745
|
id: lineId,
|
|
719
746
|
key: lineId,
|
|
720
|
-
x1:
|
|
721
|
-
y1:
|
|
722
|
-
x2:
|
|
723
|
-
y2:
|
|
747
|
+
x1: xPoint1,
|
|
748
|
+
y1: yPoint1,
|
|
749
|
+
x2: xPoint2,
|
|
750
|
+
y2: yPoint2,
|
|
724
751
|
strokeWidth: strokeWidth,
|
|
725
752
|
ref: (e)=>{
|
|
726
753
|
_refCallback(e, lineId);
|
|
727
754
|
},
|
|
728
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
729
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
755
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
756
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
730
757
|
onMouseOut: _handleMouseOut,
|
|
731
758
|
stroke: lineColor,
|
|
732
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
733
|
-
strokeDasharray: (
|
|
734
|
-
strokeDashoffset: (
|
|
759
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
760
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
761
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
735
762
|
opacity: 1,
|
|
736
763
|
..._getClickHandler(_points[i].onLineClick)
|
|
737
764
|
}));
|
|
738
765
|
}
|
|
739
766
|
} else {
|
|
740
767
|
if (!isInGap) {
|
|
741
|
-
var
|
|
768
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
742
769
|
var _points_i_lineOptions_strokeLinecap5;
|
|
743
770
|
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
744
771
|
id: lineId,
|
|
745
772
|
key: lineId,
|
|
746
|
-
x1:
|
|
747
|
-
y1:
|
|
748
|
-
x2:
|
|
749
|
-
y2:
|
|
773
|
+
x1: xPoint1,
|
|
774
|
+
y1: yPoint1,
|
|
775
|
+
x2: xPoint2,
|
|
776
|
+
y2: yPoint2,
|
|
750
777
|
strokeWidth: strokeWidth,
|
|
751
778
|
stroke: lineColor,
|
|
752
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
753
|
-
strokeDasharray: (
|
|
754
|
-
strokeDashoffset: (
|
|
779
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions20 = _points[i].lineOptions) === null || _points_i_lineOptions20 === void 0 ? void 0 : _points_i_lineOptions20.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
780
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
781
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
755
782
|
opacity: 0.1
|
|
756
783
|
}));
|
|
757
784
|
}
|
|
@@ -759,6 +786,15 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
759
786
|
}
|
|
760
787
|
}
|
|
761
788
|
}
|
|
789
|
+
if (_isScatterPolar) {
|
|
790
|
+
var _points_i;
|
|
791
|
+
pointsForLine.push(...(0, _scatterpolarutils.renderScatterPolarCategoryLabels)({
|
|
792
|
+
xAxisScale: _xAxisScale,
|
|
793
|
+
yAxisScale: yScale,
|
|
794
|
+
className: classes.markerLabel || '',
|
|
795
|
+
lineOptions: (_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.lineOptions
|
|
796
|
+
}));
|
|
797
|
+
}
|
|
762
798
|
lines.push(/*#__PURE__*/ _react.createElement("g", {
|
|
763
799
|
key: `line_${i}`,
|
|
764
800
|
role: "region",
|
|
@@ -956,11 +992,24 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
956
992
|
setActivePoint(circleId);
|
|
957
993
|
}
|
|
958
994
|
}
|
|
959
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
995
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
960
996
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
961
997
|
const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
|
|
962
998
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
999
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
963
1000
|
const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
|
|
1001
|
+
let hoverDp = undefined;
|
|
1002
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
1003
|
+
const dp = (0, _index1.find)(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
1004
|
+
if (dp) {
|
|
1005
|
+
hoverDp = {
|
|
1006
|
+
x: xVal,
|
|
1007
|
+
values: [
|
|
1008
|
+
dp
|
|
1009
|
+
]
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
964
1013
|
// if no points need to be called out then don't show vertical line and callout card
|
|
965
1014
|
if (found) {
|
|
966
1015
|
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -969,8 +1018,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
969
1018
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
970
1019
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
971
1020
|
setYValueHover(found.values);
|
|
1021
|
+
setYValue(yVal);
|
|
1022
|
+
setLegendVal(legendVal);
|
|
1023
|
+
setLineColor(lineColor);
|
|
972
1024
|
setStackCalloutProps(found);
|
|
973
|
-
setDataPointCalloutProps(
|
|
1025
|
+
setDataPointCalloutProps(hoverDp);
|
|
974
1026
|
setActivePoint(circleId);
|
|
975
1027
|
setNearestCircleToHighlight(null);
|
|
976
1028
|
}
|
|
@@ -1094,75 +1146,12 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1094
1146
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1095
1147
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1096
1148
|
}
|
|
1097
|
-
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1098
|
-
let sDate;
|
|
1099
|
-
let lDate;
|
|
1100
|
-
sDate = (0, _d3array.min)(points, (point)=>{
|
|
1101
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1102
|
-
});
|
|
1103
|
-
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1104
|
-
return (0, _d3array.max)(point.data, (item)=>item.x);
|
|
1105
|
-
});
|
|
1106
|
-
// Include tickValues if present
|
|
1107
|
-
sDate = (0, _d3array.min)([
|
|
1108
|
-
...tickValues,
|
|
1109
|
-
sDate
|
|
1110
|
-
]);
|
|
1111
|
-
lDate = (0, _d3array.max)([
|
|
1112
|
-
...tickValues,
|
|
1113
|
-
lDate
|
|
1114
|
-
]);
|
|
1115
|
-
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1116
|
-
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1117
|
-
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
1118
|
-
const paddedSDate = new Date(sDate.getTime() - datePadding);
|
|
1119
|
-
const paddedLDate = new Date(lDate.getTime() + datePadding);
|
|
1120
|
-
const rStartValue = margins.left;
|
|
1121
|
-
const rEndValue = width - margins.right;
|
|
1122
|
-
return isRTL ? {
|
|
1123
|
-
dStartValue: paddedLDate,
|
|
1124
|
-
dEndValue: paddedSDate,
|
|
1125
|
-
rStartValue,
|
|
1126
|
-
rEndValue
|
|
1127
|
-
} : {
|
|
1128
|
-
dStartValue: paddedSDate,
|
|
1129
|
-
dEndValue: paddedLDate,
|
|
1130
|
-
rStartValue,
|
|
1131
|
-
rEndValue
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1135
|
-
_xMin = (0, _d3array.min)(points, (point)=>{
|
|
1136
|
-
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1137
|
-
});
|
|
1138
|
-
_xMax = (0, _d3array.max)(points, (point)=>{
|
|
1139
|
-
return (0, _d3array.max)(point.data, (item)=>{
|
|
1140
|
-
return item.x;
|
|
1141
|
-
});
|
|
1142
|
-
});
|
|
1143
|
-
if (_hasMarkersMode) {
|
|
1144
|
-
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1145
|
-
}
|
|
1146
|
-
const rStartValue = margins.left;
|
|
1147
|
-
const rEndValue = width - margins.right;
|
|
1148
|
-
return isRTL ? {
|
|
1149
|
-
dStartValue: _xMax + _xPadding,
|
|
1150
|
-
dEndValue: _xMin - _xPadding,
|
|
1151
|
-
rStartValue,
|
|
1152
|
-
rEndValue
|
|
1153
|
-
} : {
|
|
1154
|
-
dStartValue: _xMin - _xPadding,
|
|
1155
|
-
dEndValue: _xMax + _xPadding,
|
|
1156
|
-
rStartValue,
|
|
1157
|
-
rEndValue
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
1149
|
function _isChartEmpty() {
|
|
1161
1150
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1162
1151
|
}
|
|
1163
1152
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
1164
1153
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
1165
|
-
|
|
1154
|
+
_isXAxisDateType = (0, _index1.getXAxisType)(_points);
|
|
1166
1155
|
let points = _points;
|
|
1167
1156
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
1168
1157
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1179,13 +1168,17 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1179
1168
|
const calloutProps = {
|
|
1180
1169
|
YValueHover: YValueHover,
|
|
1181
1170
|
hoverXValue: hoverXValue,
|
|
1171
|
+
YValue: YValue,
|
|
1172
|
+
legend: legendVal,
|
|
1173
|
+
color: lineColor,
|
|
1174
|
+
XValue: hoverXValue,
|
|
1182
1175
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1183
1176
|
'data-is-focusable': true,
|
|
1184
1177
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1185
1178
|
...props.calloutProps,
|
|
1186
1179
|
clickPosition: clickPosition,
|
|
1187
1180
|
isPopoverOpen: isPopoverOpen,
|
|
1188
|
-
isCalloutForStack:
|
|
1181
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1189
1182
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1190
1183
|
isCartesian: true,
|
|
1191
1184
|
customCallout: {
|
|
@@ -1209,7 +1202,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1209
1202
|
getmargins: _getMargins,
|
|
1210
1203
|
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1211
1204
|
getGraphData: _initializeLineChartData,
|
|
1212
|
-
xAxisType:
|
|
1205
|
+
xAxisType: _isXAxisDateType ? _index1.XAxisTypes.DateAxis : _index1.XAxisTypes.NumericAxis,
|
|
1206
|
+
..._isScatterPolar ? {
|
|
1207
|
+
yMaxValue: 1,
|
|
1208
|
+
yMinValue: -1
|
|
1209
|
+
} : {},
|
|
1213
1210
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1214
1211
|
createStringYAxis: _index1.createStringYAxis,
|
|
1215
1212
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1251,3 +1248,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1251
1248
|
});
|
|
1252
1249
|
});
|
|
1253
1250
|
LineChart.displayName = 'LineChart';
|
|
1251
|
+
LineChart.defaultProps = {
|
|
1252
|
+
isCalloutForStack: true
|
|
1253
|
+
};
|