@fluentui/react-charts 9.2.2 → 9.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -2
- package/dist/index.d.ts +187 -15
- package/lib/components/AreaChart/AreaChart.js +7 -4
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +4 -3
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +5 -16
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +90 -6
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +83 -38
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +19 -3
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -23
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +214 -107
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1618 -259
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +8 -3
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +8 -3
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +4 -2
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +1 -2
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +31 -10
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +6 -18
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +6 -22
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -3
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +349 -176
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +28 -8
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +9 -14
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +139 -81
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +29 -8
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +10 -15
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +28 -5
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +10 -7
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +7 -20
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +159 -47
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +9 -7
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +6 -20
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js +3 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.js +52 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/utilities.js +324 -147
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +6 -3
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +4 -15
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +90 -6
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +83 -37
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +17 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -22
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +212 -107
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +31 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1652 -260
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +12 -3
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -2
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +4 -2
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +1 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +30 -9
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +5 -21
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +10 -3
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +347 -175
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +35 -5
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +7 -13
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +137 -79
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +39 -6
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +9 -14
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +27 -4
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +7 -4
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -18
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +158 -46
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -4
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +5 -19
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +3 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +337 -137
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -4,13 +4,15 @@ 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 } from 'd3-array';
|
|
7
8
|
import { useId } from '@fluentui/react-utilities';
|
|
8
9
|
import { find } from '../../utilities/index';
|
|
9
10
|
import { CartesianChart } from '../../index';
|
|
10
11
|
import { EventsAnnotation } from './eventAnnotation/EventAnnotation';
|
|
11
12
|
import { tokens } from '@fluentui/react-theme';
|
|
12
|
-
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfAxislabels, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis,
|
|
13
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfAxislabels, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfNumericForAreaLineScatterCharts, createStringYAxis, useRtl, formatDate, getCurveFactory, isScatterPolarSeries, getDomainPaddingForMarkers, isPlottable, getRangeForScatterMarkerSize } from '../../utilities/index';
|
|
13
14
|
import { toImage } from '../../utilities/image-export-utils';
|
|
15
|
+
import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';
|
|
14
16
|
var PointSize = /*#__PURE__*/ function(PointSize) {
|
|
15
17
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
16
18
|
PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
|
|
@@ -89,6 +91,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
89
91
|
* {@docCategory LineChart}
|
|
90
92
|
*/ export const LineChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
91
93
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
94
|
+
let _hasMarkersMode = false;
|
|
95
|
+
let _isXAxisDateType = false;
|
|
96
|
+
let _isScatterPolar = false;
|
|
92
97
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
93
98
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
99
|
let _calloutPoints = calloutData(_points) || [];
|
|
@@ -137,6 +142,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
137
142
|
y: 0
|
|
138
143
|
});
|
|
139
144
|
const [isPopoverOpen, setPopoverOpen] = React.useState(false);
|
|
145
|
+
const [YValue, setYValue] = React.useState('');
|
|
146
|
+
const [legendVal, setLegendVal] = React.useState('');
|
|
147
|
+
const [lineColor, setLineColor] = React.useState('');
|
|
140
148
|
const pointsRef = React.useRef([]);
|
|
141
149
|
const calloutPointsRef = React.useRef([]);
|
|
142
150
|
const classes = useLineChartStyles(props);
|
|
@@ -166,9 +174,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
166
174
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
167
175
|
let domainNRangeValue;
|
|
168
176
|
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
169
|
-
domainNRangeValue =
|
|
177
|
+
domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
170
178
|
} else if (xAxisType === XAxisTypes.DateAxis) {
|
|
171
|
-
domainNRangeValue =
|
|
179
|
+
domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
172
180
|
} else {
|
|
173
181
|
domainNRangeValue = {
|
|
174
182
|
dStartValue: 0,
|
|
@@ -186,6 +194,12 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
186
194
|
var _props_legendProps_selectedLegends, _props_legendProps, _props_legendProps1;
|
|
187
195
|
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
196
|
}) : lineChartData;
|
|
197
|
+
var _filteredData_some;
|
|
198
|
+
_hasMarkersMode = (_filteredData_some = filteredData === null || filteredData === void 0 ? void 0 : filteredData.some((item)=>{
|
|
199
|
+
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
200
|
+
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');
|
|
201
|
+
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
202
|
+
_isScatterPolar = isScatterPolarSeries(filteredData);
|
|
189
203
|
return filteredData ? filteredData.map((item, index)=>{
|
|
190
204
|
let color;
|
|
191
205
|
if (typeof item.color === 'undefined') {
|
|
@@ -217,6 +231,21 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
217
231
|
function _getCustomizedCallout() {
|
|
218
232
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
219
233
|
}
|
|
234
|
+
function _getNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
236
|
+
const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
237
|
+
let yPadding = {
|
|
238
|
+
start: 0,
|
|
239
|
+
end: 0
|
|
240
|
+
};
|
|
241
|
+
if (_hasMarkersMode) {
|
|
242
|
+
yPadding = getDomainPaddingForMarkers(startValue, endValue, useSecondaryYScale ? props.secondaryYScaleType : props.yScaleType);
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
startValue: startValue - yPadding.start,
|
|
246
|
+
endValue: endValue + yPadding.end
|
|
247
|
+
};
|
|
248
|
+
}
|
|
220
249
|
function _getMargins(_margins) {
|
|
221
250
|
margins = _margins;
|
|
222
251
|
}
|
|
@@ -249,17 +278,26 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
249
278
|
function _createLegends(data) {
|
|
250
279
|
const { legendProps, allowMultipleShapesForPoints = false } = props;
|
|
251
280
|
const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
|
|
252
|
-
const
|
|
253
|
-
|
|
281
|
+
const mapLegendToPoints = {};
|
|
282
|
+
data.forEach((point)=>{
|
|
283
|
+
if (point.legend) {
|
|
284
|
+
if (!mapLegendToPoints[point.legend]) {
|
|
285
|
+
mapLegendToPoints[point.legend] = [];
|
|
286
|
+
}
|
|
287
|
+
mapLegendToPoints[point.legend].push(point);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
const legendDataItems = Object.entries(mapLegendToPoints).map(([legendTitle, points])=>{
|
|
291
|
+
const representativePoint = points[0];
|
|
254
292
|
// mapping data to the format Legends component needs
|
|
255
293
|
const legend = {
|
|
256
|
-
title:
|
|
257
|
-
color,
|
|
294
|
+
title: legendTitle,
|
|
295
|
+
color: representativePoint.color,
|
|
258
296
|
action: ()=>{
|
|
259
297
|
if (isLegendMultiSelectEnabled) {
|
|
260
|
-
_handleMultipleLineLegendSelectionAction(
|
|
298
|
+
points.forEach((p)=>_handleMultipleLineLegendSelectionAction(p));
|
|
261
299
|
} else {
|
|
262
|
-
_handleSingleLegendSelectionAction(
|
|
300
|
+
points.forEach((p)=>_handleSingleLegendSelectionAction(p));
|
|
263
301
|
}
|
|
264
302
|
},
|
|
265
303
|
onMouseOutAction: ()=>{
|
|
@@ -267,13 +305,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
267
305
|
},
|
|
268
306
|
hoverAction: ()=>{
|
|
269
307
|
_handleChartMouseLeave();
|
|
270
|
-
setActiveLegend(
|
|
308
|
+
setActiveLegend(legendTitle);
|
|
271
309
|
},
|
|
272
|
-
...
|
|
273
|
-
shape:
|
|
310
|
+
...representativePoint.legendShape && {
|
|
311
|
+
shape: representativePoint.legendShape
|
|
274
312
|
},
|
|
275
313
|
...allowMultipleShapesForPoints && {
|
|
276
|
-
shape: Points[
|
|
314
|
+
shape: Points[representativePoint.index % Object.keys(pointTypes).length]
|
|
277
315
|
}
|
|
278
316
|
};
|
|
279
317
|
return legend;
|
|
@@ -374,6 +412,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
374
412
|
} else {
|
|
375
413
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
376
414
|
}
|
|
415
|
+
const maxMarkerSize = d3Max(_points, (point)=>{
|
|
416
|
+
return d3Max(point.data, (item)=>{
|
|
417
|
+
return item.markerSize;
|
|
418
|
+
});
|
|
419
|
+
});
|
|
377
420
|
for(let i = _points.length - 1; i >= 0; i--){
|
|
378
421
|
var _points_i_gaps, _points_i_lineOptions;
|
|
379
422
|
const linesForLine = [];
|
|
@@ -382,36 +425,64 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
382
425
|
const legendVal = _points[i].legend;
|
|
383
426
|
const lineColor = _points[i].color;
|
|
384
427
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
385
|
-
const
|
|
428
|
+
const useSecondaryYScale = !!(_points[i].useSecondaryYScale && _yScaleSecondary);
|
|
429
|
+
const yScale = useSecondaryYScale ? _yScaleSecondary : _yScalePrimary;
|
|
430
|
+
const extraMaxPixels = _hasMarkersMode ? getRangeForScatterMarkerSize({
|
|
431
|
+
data: _points,
|
|
432
|
+
xScale: _xAxisScale,
|
|
433
|
+
yScalePrimary: _yScalePrimary,
|
|
434
|
+
yScaleSecondary: _yScaleSecondary,
|
|
435
|
+
useSecondaryYScale,
|
|
436
|
+
xScaleType: props.xScaleType,
|
|
437
|
+
yScaleType: props.yScaleType,
|
|
438
|
+
secondaryYScaleType: props.secondaryYScaleType
|
|
439
|
+
}) : 0;
|
|
386
440
|
if (_points[i].data.length === 1) {
|
|
387
441
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
388
442
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
389
|
-
const
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
443
|
+
const xPoint = _xAxisScale(x1);
|
|
444
|
+
const yPoint = yScale(y1);
|
|
445
|
+
if (isPlottable(xPoint, yPoint)) {
|
|
446
|
+
var _points_i_lineOptions_mode, _points_i_lineOptions1;
|
|
447
|
+
const circleId = `${_circleId}_${i}`;
|
|
448
|
+
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
449
|
+
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
450
|
+
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');
|
|
451
|
+
const text = _points[i].data[0].text;
|
|
452
|
+
var _points_i_data__text;
|
|
453
|
+
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
454
|
+
key: `${circleId}_fragment`
|
|
455
|
+
}, /*#__PURE__*/ React.createElement("circle", {
|
|
456
|
+
id: circleId,
|
|
457
|
+
key: circleId,
|
|
458
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
459
|
+
cx: xPoint,
|
|
460
|
+
cy: yPoint,
|
|
461
|
+
fill: activePoint === circleId ? tokens.colorNeutralBackground1 : lineColor,
|
|
462
|
+
opacity: isLegendSelected ? 1 : 0.1,
|
|
463
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
464
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
465
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
466
|
+
onMouseOut: _handleMouseOut,
|
|
467
|
+
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
468
|
+
stroke: activePoint === circleId ? lineColor : '',
|
|
469
|
+
role: "img",
|
|
470
|
+
"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),
|
|
471
|
+
"data-is-focusable": isLegendSelected,
|
|
472
|
+
ref: (e)=>{
|
|
473
|
+
_refCallback(e, circleId);
|
|
474
|
+
},
|
|
475
|
+
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
476
|
+
onBlur: _handleMouseOut,
|
|
477
|
+
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
478
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
479
|
+
key: `${circleId}-label`,
|
|
480
|
+
x: xPoint,
|
|
481
|
+
y: yPoint + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
482
|
+
className: classes.markerLabel,
|
|
483
|
+
opacity: isLegendSelected ? 1 : 0.1
|
|
484
|
+
}, text))));
|
|
485
|
+
}
|
|
415
486
|
}
|
|
416
487
|
let gapIndex = 0;
|
|
417
488
|
var _points_i_gaps_sort;
|
|
@@ -419,13 +490,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
419
490
|
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
420
491
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
421
492
|
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
422
|
-
var
|
|
493
|
+
var _points_i_lineOptions2;
|
|
423
494
|
const line = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
424
495
|
.x((d)=>_xAxisScale(d[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
425
|
-
.y((d)=>yScale(d[1])).curve(getCurveFactory(lineCurve));
|
|
496
|
+
.y((d)=>yScale(d[1])).curve(getCurveFactory(lineCurve)).defined((d)=>isPlottable(_xAxisScale(d[0]), yScale(d[1])));
|
|
426
497
|
const lineId = `${_lineId}_${i}`;
|
|
427
498
|
const borderId = `${_borderId}_${i}`;
|
|
428
|
-
const strokeWidth = ((
|
|
499
|
+
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;
|
|
429
500
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
430
501
|
const lineData = [];
|
|
431
502
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -435,19 +506,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
435
506
|
]);
|
|
436
507
|
}
|
|
437
508
|
if (isLegendSelected) {
|
|
438
|
-
var
|
|
439
|
-
const lineBorderWidth = ((
|
|
509
|
+
var _points_i_lineOptions3, _points_i_lineOptions4;
|
|
510
|
+
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;
|
|
440
511
|
if (lineBorderWidth > 0) {
|
|
441
|
-
var
|
|
512
|
+
var _points_i_lineOptions5, _points_i_lineOptions6;
|
|
442
513
|
var _points_i_lineOptions_strokeLinecap;
|
|
443
514
|
bordersForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
444
515
|
id: borderId,
|
|
445
516
|
key: borderId,
|
|
446
517
|
d: line(lineData),
|
|
447
518
|
fill: "transparent",
|
|
448
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
519
|
+
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',
|
|
449
520
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
450
|
-
stroke: ((
|
|
521
|
+
stroke: ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
451
522
|
opacity: 1
|
|
452
523
|
}));
|
|
453
524
|
}
|
|
@@ -460,7 +531,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
460
531
|
"data-is-focusable": true,
|
|
461
532
|
stroke: lineColor,
|
|
462
533
|
strokeWidth: strokeWidth,
|
|
463
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
534
|
+
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',
|
|
464
535
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
465
536
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
466
537
|
onMouseOut: _handleMouseOut,
|
|
@@ -469,7 +540,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
469
540
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
470
541
|
}));
|
|
471
542
|
} else {
|
|
472
|
-
var
|
|
543
|
+
var _points_i_lineOptions7;
|
|
473
544
|
var _points_i_lineOptions_strokeLinecap2;
|
|
474
545
|
linesForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
475
546
|
id: lineId,
|
|
@@ -479,7 +550,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
479
550
|
"data-is-focusable": false,
|
|
480
551
|
stroke: lineColor,
|
|
481
552
|
strokeWidth: strokeWidth,
|
|
482
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
553
|
+
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',
|
|
483
554
|
opacity: 0.1
|
|
484
555
|
}));
|
|
485
556
|
}
|
|
@@ -499,7 +570,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
499
570
|
}));
|
|
500
571
|
} else if (!props.optimizeLargeData) {
|
|
501
572
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
502
|
-
var
|
|
573
|
+
var _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9, _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
503
574
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
504
575
|
const isInGap = gapResult.isInGap;
|
|
505
576
|
gapIndex = gapResult.gapIndex;
|
|
@@ -508,142 +579,217 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
508
579
|
const circleId = `${_circleId}_${i}_${j}`;
|
|
509
580
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
510
581
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
511
|
-
|
|
512
|
-
const
|
|
582
|
+
const xPoint1 = _xAxisScale(x1);
|
|
583
|
+
const yPoint1 = yScale(y1);
|
|
584
|
+
const xPoint2 = _xAxisScale(x2);
|
|
585
|
+
const yPoint2 = yScale(y2);
|
|
586
|
+
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;
|
|
513
587
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
514
588
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
key: `${
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
589
|
+
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');
|
|
590
|
+
const text = _points[i].data[j - 1].text;
|
|
591
|
+
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
592
|
+
if (isPlottable(xPoint1, yPoint1)) {
|
|
593
|
+
var _points_i_lineOptions_mode3, _points_i_lineOptions11;
|
|
594
|
+
const path = _getPath(xPoint1, yPoint1, circleId, j, false, _points[i].index);
|
|
595
|
+
var _points_i_data__text1;
|
|
596
|
+
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", {
|
|
597
|
+
id: circleId,
|
|
598
|
+
key: circleId,
|
|
599
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
600
|
+
cx: xPoint1,
|
|
601
|
+
cy: yPoint1,
|
|
602
|
+
"data-is-focusable": isLegendSelected,
|
|
603
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
604
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
605
|
+
onMouseOut: _handleMouseOut,
|
|
606
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
607
|
+
onBlur: _handleMouseOut,
|
|
608
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
609
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
610
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
611
|
+
stroke: lineColor,
|
|
612
|
+
strokeWidth: strokeWidth,
|
|
613
|
+
role: "img",
|
|
614
|
+
"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)
|
|
615
|
+
}), !_isScatterPolar && supportsTextMode && text && /*#__PURE__*/ React.createElement("text", {
|
|
616
|
+
key: `${circleId}-label`,
|
|
617
|
+
x: xPoint1,
|
|
618
|
+
y: yPoint1 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
619
|
+
className: classes.markerLabel,
|
|
620
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01
|
|
621
|
+
}, text)) : /*#__PURE__*/ React.createElement("path", {
|
|
622
|
+
id: circleId,
|
|
623
|
+
key: circleId,
|
|
546
624
|
d: path,
|
|
547
625
|
"data-is-focusable": isLegendSelected,
|
|
548
|
-
onMouseOver: (event)=>_handleHover(
|
|
549
|
-
onMouseMove: (event)=>_handleHover(
|
|
626
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
627
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
550
628
|
onMouseOut: _handleMouseOut,
|
|
551
|
-
onFocus: (event)=>_handleFocus(event, lineId,
|
|
629
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
552
630
|
onBlur: _handleMouseOut,
|
|
553
|
-
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
554
|
-
opacity: isLegendSelected && !
|
|
555
|
-
fill: _getPointFill(lineColor,
|
|
631
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
632
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
633
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
556
634
|
stroke: lineColor,
|
|
557
635
|
strokeWidth: strokeWidth,
|
|
558
636
|
role: "img",
|
|
559
|
-
"aria-label": _getAriaLabel(i, j),
|
|
637
|
+
"aria-label": _getAriaLabel(i, j - 1),
|
|
560
638
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
561
|
-
})
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
key: borderId,
|
|
589
|
-
x1: _xAxisScale(x1),
|
|
590
|
-
y1: yScale(y1),
|
|
591
|
-
x2: _xAxisScale(x2),
|
|
592
|
-
y2: yScale(y2),
|
|
593
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : _points_i_lineOptions12.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
594
|
-
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
595
|
-
...((_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.lineBorderColor) && {
|
|
596
|
-
stroke: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderColor
|
|
597
|
-
},
|
|
598
|
-
className: classes.lineBorder,
|
|
599
|
-
opacity: 1
|
|
600
|
-
}));
|
|
601
|
-
}
|
|
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),
|
|
639
|
+
}));
|
|
640
|
+
}
|
|
641
|
+
if (j + 1 === _points[i].data.length) {
|
|
642
|
+
var _points_i_lineOptions_mode4, _points_i_lineOptions12;
|
|
643
|
+
// If this is last point of the line segment.
|
|
644
|
+
const lastCircleId = `${circleId}${j}L`;
|
|
645
|
+
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
646
|
+
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
647
|
+
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
648
|
+
currentMarkerSize = _points[i].data[j].markerSize;
|
|
649
|
+
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');
|
|
650
|
+
const lastText = _points[i].data[j].text;
|
|
651
|
+
if (isPlottable(xPoint2, yPoint2)) {
|
|
652
|
+
var _points_i_lineOptions_mode5, _points_i_lineOptions13;
|
|
653
|
+
const path = _getPath(xPoint2, yPoint2, lastCircleId, j, true, _points[i].index);
|
|
654
|
+
var _points_i_data_j_text;
|
|
655
|
+
pointsForLine.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
656
|
+
key: `${lastCircleId}_container`
|
|
657
|
+
}, ((_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", {
|
|
658
|
+
id: lastCircleId,
|
|
659
|
+
key: lastCircleId,
|
|
660
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
661
|
+
cx: xPoint2,
|
|
662
|
+
cy: yPoint2,
|
|
663
|
+
"data-is-focusable": isLegendSelected,
|
|
664
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
665
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
616
666
|
onMouseOut: _handleMouseOut,
|
|
667
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
668
|
+
onBlur: _handleMouseOut,
|
|
669
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
670
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
671
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
617
672
|
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
673
|
strokeWidth: strokeWidth,
|
|
674
|
+
role: "img",
|
|
675
|
+
"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)
|
|
676
|
+
}), !_isScatterPolar && lastSupportsTextMode && lastText && /*#__PURE__*/ React.createElement("text", {
|
|
677
|
+
key: `${lastCircleId}-label`,
|
|
678
|
+
x: xPoint2,
|
|
679
|
+
y: yPoint2 + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4, 4) + 12,
|
|
680
|
+
className: classes.markerLabel
|
|
681
|
+
}, text)) : /*#__PURE__*/ React.createElement("path", {
|
|
682
|
+
id: lastCircleId,
|
|
683
|
+
key: lastCircleId,
|
|
684
|
+
d: path,
|
|
685
|
+
"data-is-focusable": isLegendSelected,
|
|
686
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
687
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
688
|
+
onMouseOut: _handleMouseOut,
|
|
689
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
690
|
+
onBlur: _handleMouseOut,
|
|
691
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
692
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
693
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
637
694
|
stroke: lineColor,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
})
|
|
695
|
+
strokeWidth: strokeWidth,
|
|
696
|
+
role: "img",
|
|
697
|
+
"aria-label": _getAriaLabel(i, j),
|
|
698
|
+
tabIndex: isLegendSelected ? 0 : undefined
|
|
699
|
+
}), /*#__PURE__*/ React.createElement("circle", {
|
|
700
|
+
id: hiddenHoverCircleId,
|
|
701
|
+
key: hiddenHoverCircleId,
|
|
702
|
+
r: 8,
|
|
703
|
+
cx: xPoint2,
|
|
704
|
+
cy: yPoint2,
|
|
705
|
+
opacity: 0,
|
|
706
|
+
width: 0,
|
|
707
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
708
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
709
|
+
onMouseOut: _handleMouseOut,
|
|
710
|
+
strokeWidth: 0,
|
|
711
|
+
focusable: false,
|
|
712
|
+
onBlur: _handleMouseOut
|
|
713
|
+
})));
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
if (isPlottable(xPoint1, yPoint1) && 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')))) {
|
|
717
|
+
if (isLegendSelected) {
|
|
718
|
+
// don't draw line if it is in a gap
|
|
719
|
+
if (!isInGap) {
|
|
720
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
721
|
+
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;
|
|
722
|
+
if (lineBorderWidth > 0) {
|
|
723
|
+
var _points_i_lineOptions18, _points_i_lineOptions19;
|
|
724
|
+
var _points_i_lineOptions_strokeLinecap3;
|
|
725
|
+
bordersForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
726
|
+
id: borderId,
|
|
727
|
+
key: borderId,
|
|
728
|
+
x1: xPoint1,
|
|
729
|
+
y1: yPoint1,
|
|
730
|
+
x2: xPoint2,
|
|
731
|
+
y2: yPoint2,
|
|
732
|
+
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',
|
|
733
|
+
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
734
|
+
stroke: ((_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
735
|
+
opacity: 1
|
|
736
|
+
}));
|
|
737
|
+
}
|
|
738
|
+
var _points_i_lineOptions_strokeLinecap4;
|
|
739
|
+
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
740
|
+
id: lineId,
|
|
741
|
+
key: lineId,
|
|
742
|
+
x1: xPoint1,
|
|
743
|
+
y1: yPoint1,
|
|
744
|
+
x2: xPoint2,
|
|
745
|
+
y2: yPoint2,
|
|
746
|
+
strokeWidth: strokeWidth,
|
|
747
|
+
ref: (e)=>{
|
|
748
|
+
_refCallback(e, lineId);
|
|
749
|
+
},
|
|
750
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
751
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor),
|
|
752
|
+
onMouseOut: _handleMouseOut,
|
|
753
|
+
stroke: lineColor,
|
|
754
|
+
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',
|
|
755
|
+
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
756
|
+
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
757
|
+
opacity: 1,
|
|
758
|
+
..._getClickHandler(_points[i].onLineClick)
|
|
759
|
+
}));
|
|
760
|
+
}
|
|
761
|
+
} else {
|
|
762
|
+
if (!isInGap) {
|
|
763
|
+
var _points_i_lineOptions20, _points_i_lineOptions21, _points_i_lineOptions22;
|
|
764
|
+
var _points_i_lineOptions_strokeLinecap5;
|
|
765
|
+
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
766
|
+
id: lineId,
|
|
767
|
+
key: lineId,
|
|
768
|
+
x1: xPoint1,
|
|
769
|
+
y1: yPoint1,
|
|
770
|
+
x2: xPoint2,
|
|
771
|
+
y2: yPoint2,
|
|
772
|
+
strokeWidth: strokeWidth,
|
|
773
|
+
stroke: lineColor,
|
|
774
|
+
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',
|
|
775
|
+
strokeDasharray: (_points_i_lineOptions21 = _points[i].lineOptions) === null || _points_i_lineOptions21 === void 0 ? void 0 : _points_i_lineOptions21.strokeDasharray,
|
|
776
|
+
strokeDashoffset: (_points_i_lineOptions22 = _points[i].lineOptions) === null || _points_i_lineOptions22 === void 0 ? void 0 : _points_i_lineOptions22.strokeDashoffset,
|
|
777
|
+
opacity: 0.1
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
643
780
|
}
|
|
644
781
|
}
|
|
645
782
|
}
|
|
646
783
|
}
|
|
784
|
+
if (_isScatterPolar) {
|
|
785
|
+
var _points_i;
|
|
786
|
+
pointsForLine.push(...renderScatterPolarCategoryLabels({
|
|
787
|
+
xAxisScale: _xAxisScale,
|
|
788
|
+
yAxisScale: yScale,
|
|
789
|
+
className: classes.markerLabel || '',
|
|
790
|
+
lineOptions: (_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.lineOptions
|
|
791
|
+
}));
|
|
792
|
+
}
|
|
647
793
|
lines.push(/*#__PURE__*/ React.createElement("g", {
|
|
648
794
|
key: `line_${i}`,
|
|
649
795
|
role: "region",
|
|
@@ -841,11 +987,24 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
841
987
|
setActivePoint(circleId);
|
|
842
988
|
}
|
|
843
989
|
}
|
|
844
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
990
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale, legendVal, lineColor) {
|
|
845
991
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
846
992
|
const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
|
|
847
993
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
994
|
+
const yVal = y instanceof Date ? y.getTime() : y;
|
|
848
995
|
const found = find(_calloutPoints, (element)=>element.x === xVal);
|
|
996
|
+
let hoverDp = undefined;
|
|
997
|
+
if (props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
998
|
+
const dp = find(found.values, (val)=>(val === null || val === void 0 ? void 0 : val.y) === yVal);
|
|
999
|
+
if (dp) {
|
|
1000
|
+
hoverDp = {
|
|
1001
|
+
x: xVal,
|
|
1002
|
+
values: [
|
|
1003
|
+
dp
|
|
1004
|
+
]
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
849
1008
|
// if no points need to be called out then don't show vertical line and callout card
|
|
850
1009
|
if (found) {
|
|
851
1010
|
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
@@ -854,8 +1013,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
854
1013
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
855
1014
|
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
|
|
856
1015
|
setYValueHover(found.values);
|
|
1016
|
+
setYValue(yVal);
|
|
1017
|
+
setLegendVal(legendVal);
|
|
1018
|
+
setLineColor(lineColor);
|
|
857
1019
|
setStackCalloutProps(found);
|
|
858
|
-
setDataPointCalloutProps(
|
|
1020
|
+
setDataPointCalloutProps(hoverDp);
|
|
859
1021
|
setActivePoint(circleId);
|
|
860
1022
|
setNearestCircleToHighlight(null);
|
|
861
1023
|
}
|
|
@@ -984,7 +1146,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
984
1146
|
}
|
|
985
1147
|
const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
|
|
986
1148
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
987
|
-
|
|
1149
|
+
_isXAxisDateType = getXAxisType(_points);
|
|
988
1150
|
let points = _points;
|
|
989
1151
|
if (legendProps && !!legendProps.canSelectMultipleLegends) {
|
|
990
1152
|
points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
|
|
@@ -1001,13 +1163,17 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1001
1163
|
const calloutProps = {
|
|
1002
1164
|
YValueHover: YValueHover,
|
|
1003
1165
|
hoverXValue: hoverXValue,
|
|
1166
|
+
YValue: YValue,
|
|
1167
|
+
legend: legendVal,
|
|
1168
|
+
color: lineColor,
|
|
1169
|
+
XValue: hoverXValue,
|
|
1004
1170
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1005
1171
|
'data-is-focusable': true,
|
|
1006
1172
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1007
1173
|
...props.calloutProps,
|
|
1008
1174
|
clickPosition: clickPosition,
|
|
1009
1175
|
isPopoverOpen: isPopoverOpen,
|
|
1010
|
-
isCalloutForStack:
|
|
1176
|
+
isCalloutForStack: props.isCalloutForStack,
|
|
1011
1177
|
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
1012
1178
|
isCartesian: true,
|
|
1013
1179
|
customCallout: {
|
|
@@ -1029,9 +1195,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1029
1195
|
legendBars: legendBars,
|
|
1030
1196
|
createYAxis: createNumericYAxis,
|
|
1031
1197
|
getmargins: _getMargins,
|
|
1032
|
-
getMinMaxOfYAxis:
|
|
1198
|
+
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1033
1199
|
getGraphData: _initializeLineChartData,
|
|
1034
|
-
xAxisType:
|
|
1200
|
+
xAxisType: _isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis,
|
|
1201
|
+
..._isScatterPolar ? {
|
|
1202
|
+
yMaxValue: 1,
|
|
1203
|
+
yMinValue: -1
|
|
1204
|
+
} : {},
|
|
1035
1205
|
getDomainNRangeValues: _getDomainNRangeValues,
|
|
1036
1206
|
createStringYAxis: createStringYAxis,
|
|
1037
1207
|
onChartMouseLeave: _handleChartMouseLeave,
|
|
@@ -1073,3 +1243,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1073
1243
|
});
|
|
1074
1244
|
});
|
|
1075
1245
|
LineChart.displayName = 'LineChart';
|
|
1246
|
+
LineChart.defaultProps = {
|
|
1247
|
+
isCalloutForStack: true
|
|
1248
|
+
};
|