@fluentui/react-charts 9.0.2 → 9.0.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 +64 -7
- package/dist/index.d.ts +829 -94
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +55 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +30 -14
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +2 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +7 -123
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +11 -22
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +1 -1
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +2 -6
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +4 -1
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +13 -9
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -9
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +37 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +2 -9
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +67 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +38 -37
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.js +2 -3
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +43 -35
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1023 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +46 -59
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -10
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -11
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +65 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -3
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +49 -4
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/colors.js +20 -0
- package/lib/utilities/colors.js.map +1 -1
- package/lib/utilities/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +53 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.js +90 -18
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +95 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +8 -198
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +12 -37
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +3 -10
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +4 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +14 -8
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -9
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +59 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +2 -16
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +107 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +37 -37
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +2 -2
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +41 -33
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +1 -10
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1039 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +45 -58
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +1 -10
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +4 -11
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +113 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +5 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -3
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/colors.js +23 -0
- package/lib-commonjs/utilities/colors.js.map +1 -1
- package/lib-commonjs/utilities/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +59 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +94 -17
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -8
- package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
|
@@ -3,13 +3,13 @@ import { useLineChartStyles } from './useLineChartStyles.styles';
|
|
|
3
3
|
import { select as d3Select, pointer } from 'd3-selection';
|
|
4
4
|
import { bisector } from 'd3-array';
|
|
5
5
|
import { Legends } from '../Legends/index';
|
|
6
|
-
import { line as d3Line
|
|
6
|
+
import { line as d3Line } from 'd3-shape';
|
|
7
7
|
import { useId } from '@fluentui/react-utilities';
|
|
8
8
|
import { find } from '../../utilities/index';
|
|
9
9
|
import { CartesianChart } from '../../index';
|
|
10
10
|
import { EventsAnnotation } from './eventAnnotation/EventAnnotation';
|
|
11
11
|
import { tokens } from '@fluentui/react-theme';
|
|
12
|
-
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfXAxislabels, Points, pointTypes, getMinMaxOfYAxis, getTypeOfAxis, getNextColor, getColorFromToken, useRtl, formatDate } from '../../utilities/index';
|
|
12
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfXAxislabels, Points, pointTypes, getMinMaxOfYAxis, getTypeOfAxis, getNextColor, getColorFromToken, useRtl, formatDate, getCurveFactory } from '../../utilities/index';
|
|
13
13
|
var PointSize;
|
|
14
14
|
(function(PointSize) {
|
|
15
15
|
PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
|
|
@@ -87,6 +87,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
87
87
|
* Linechart component
|
|
88
88
|
* {@docCategory LineChart}
|
|
89
89
|
*/ export const LineChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
90
|
+
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
90
91
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
91
92
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
93
|
let _calloutPoints = calloutData(_points) || [];
|
|
@@ -120,9 +121,10 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
120
121
|
const [activeLegend, setActiveLegend] = React.useState('');
|
|
121
122
|
const [YValueHover, setYValueHover] = React.useState([]);
|
|
122
123
|
const [selectedLegend, setSelectedLegend] = React.useState('');
|
|
123
|
-
const [selectedLegendPoints, setSelectedLegendPoints] = React.useState(
|
|
124
|
+
const [selectedLegendPoints, setSelectedLegendPoints] = React.useState(_injectIndexPropertyInLineChartData(props.data.lineChartData, true));
|
|
124
125
|
const [selectedColorBarLegend, setSelectedColorBarLegend] = React.useState([]);
|
|
125
|
-
|
|
126
|
+
var _props_legendProps_selectedLegends_length;
|
|
127
|
+
const [isSelectedLegend, setIsSelectedLegend] = React.useState(((_props_legendProps_selectedLegends_length = (_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.length) !== null && _props_legendProps_selectedLegends_length !== void 0 ? _props_legendProps_selectedLegends_length : 0) > 0);
|
|
126
128
|
const [activePoint, setActivePoint] = React.useState('');
|
|
127
129
|
const [nearestCircleToHighlight, setNearestCircleToHighlight] = React.useState(null);
|
|
128
130
|
const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState();
|
|
@@ -153,9 +155,14 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
153
155
|
chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null
|
|
154
156
|
};
|
|
155
157
|
}, []);
|
|
156
|
-
function _injectIndexPropertyInLineChartData(lineChartData) {
|
|
158
|
+
function _injectIndexPropertyInLineChartData(lineChartData, isFilterSelectedLegends = false) {
|
|
157
159
|
const { allowMultipleShapesForPoints = false } = props;
|
|
158
|
-
|
|
160
|
+
// Apply filter only if isPropChange is true
|
|
161
|
+
const filteredData = isFilterSelectedLegends ? lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.filter((item)=>{
|
|
162
|
+
var _props_legendProps_selectedLegends, _props_legendProps, _props_legendProps1;
|
|
163
|
+
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;
|
|
164
|
+
}) : lineChartData;
|
|
165
|
+
return filteredData ? filteredData.map((item, index)=>{
|
|
159
166
|
let color;
|
|
160
167
|
if (typeof item.color === 'undefined') {
|
|
161
168
|
color = getNextColor(index, 0);
|
|
@@ -342,7 +349,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
342
349
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
343
350
|
}
|
|
344
351
|
for(let i = _points.length - 1; i >= 0; i--){
|
|
345
|
-
var _points_i_gaps;
|
|
352
|
+
var _points_i_gaps, _points_i_lineOptions;
|
|
346
353
|
const linesForLine = [];
|
|
347
354
|
const bordersForLine = [];
|
|
348
355
|
const pointsForLine = [];
|
|
@@ -382,15 +389,16 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
382
389
|
let gapIndex = 0;
|
|
383
390
|
var _points_i_gaps_sort;
|
|
384
391
|
const gaps = (_points_i_gaps_sort = (_points_i_gaps = _points[i].gaps) === null || _points_i_gaps === void 0 ? void 0 : _points_i_gaps.sort((a, b)=>a.startIndex - b.startIndex)) !== null && _points_i_gaps_sort !== void 0 ? _points_i_gaps_sort : [];
|
|
392
|
+
const lineCurve = (_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.curve;
|
|
385
393
|
// Use path rendering technique for larger datasets to optimize performance.
|
|
386
|
-
if (props.optimizeLargeData && _points[i].data.length > 1) {
|
|
387
|
-
var
|
|
394
|
+
if ((props.optimizeLargeData || lineCurve) && _points[i].data.length > 1) {
|
|
395
|
+
var _points_i_lineOptions1;
|
|
388
396
|
const line = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
389
397
|
.x((d)=>_xAxisScale(d[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
390
|
-
.y((d)=>_yAxisScale(d[1])).curve(
|
|
398
|
+
.y((d)=>_yAxisScale(d[1])).curve(getCurveFactory(lineCurve));
|
|
391
399
|
const lineId = `${_lineId}_${i}`;
|
|
392
400
|
const borderId = `${_borderId}_${i}`;
|
|
393
|
-
const strokeWidth = ((
|
|
401
|
+
const strokeWidth = ((_points_i_lineOptions1 = _points[i].lineOptions) === null || _points_i_lineOptions1 === void 0 ? void 0 : _points_i_lineOptions1.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
394
402
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
395
403
|
const lineData = [];
|
|
396
404
|
for(let k = 0; k < _points[i].data.length; k++){
|
|
@@ -400,19 +408,19 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
400
408
|
]);
|
|
401
409
|
}
|
|
402
410
|
if (isLegendSelected) {
|
|
403
|
-
var
|
|
404
|
-
const lineBorderWidth = ((
|
|
411
|
+
var _points_i_lineOptions2, _points_i_lineOptions3;
|
|
412
|
+
const lineBorderWidth = ((_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
405
413
|
if (lineBorderWidth > 0) {
|
|
406
|
-
var
|
|
414
|
+
var _points_i_lineOptions4, _points_i_lineOptions5;
|
|
407
415
|
var _points_i_lineOptions_strokeLinecap;
|
|
408
416
|
bordersForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
409
417
|
id: borderId,
|
|
410
418
|
key: borderId,
|
|
411
419
|
d: line(lineData),
|
|
412
420
|
fill: "transparent",
|
|
413
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (
|
|
421
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
|
|
414
422
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
415
|
-
stroke: ((
|
|
423
|
+
stroke: ((_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
416
424
|
opacity: 1
|
|
417
425
|
}));
|
|
418
426
|
}
|
|
@@ -425,7 +433,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
425
433
|
"data-is-focusable": true,
|
|
426
434
|
stroke: lineColor,
|
|
427
435
|
strokeWidth: strokeWidth,
|
|
428
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (
|
|
436
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
429
437
|
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
430
438
|
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
431
439
|
onMouseOut: _handleMouseOut,
|
|
@@ -434,7 +442,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
434
442
|
tabIndex: _points[i].legend !== '' ? 0 : undefined
|
|
435
443
|
}));
|
|
436
444
|
} else {
|
|
437
|
-
var
|
|
445
|
+
var _points_i_lineOptions6;
|
|
438
446
|
var _points_i_lineOptions_strokeLinecap2;
|
|
439
447
|
linesForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
440
448
|
id: lineId,
|
|
@@ -444,7 +452,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
444
452
|
"data-is-focusable": false,
|
|
445
453
|
stroke: lineColor,
|
|
446
454
|
strokeWidth: strokeWidth,
|
|
447
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (
|
|
455
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
448
456
|
opacity: 0.1
|
|
449
457
|
}));
|
|
450
458
|
}
|
|
@@ -464,7 +472,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
464
472
|
}));
|
|
465
473
|
} else if (!props.optimizeLargeData) {
|
|
466
474
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
467
|
-
var
|
|
475
|
+
var _points_i_lineOptions7;
|
|
468
476
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
469
477
|
const isInGap = gapResult.isInGap;
|
|
470
478
|
gapIndex = gapResult.gapIndex;
|
|
@@ -474,7 +482,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
474
482
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
475
483
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
476
484
|
let path = _getPath(_xAxisScale(x1), _yAxisScale(y1), circleId, j, false, _points[i].index);
|
|
477
|
-
const strokeWidth = ((
|
|
485
|
+
const strokeWidth = ((_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
478
486
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
479
487
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
480
488
|
pointsForLine.push(/*#__PURE__*/ React.createElement("path", {
|
|
@@ -542,10 +550,10 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
542
550
|
if (isLegendSelected) {
|
|
543
551
|
// don't draw line if it is in a gap
|
|
544
552
|
if (!isInGap) {
|
|
545
|
-
var
|
|
546
|
-
const lineBorderWidth = ((
|
|
553
|
+
var _points_i_lineOptions8, _points_i_lineOptions9, _points_i_lineOptions10, _points_i_lineOptions11;
|
|
554
|
+
const lineBorderWidth = ((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
547
555
|
if (lineBorderWidth > 0) {
|
|
548
|
-
var
|
|
556
|
+
var _points_i_lineOptions12, _points_i_lineOptions13;
|
|
549
557
|
var _points_i_lineOptions_strokeLinecap3;
|
|
550
558
|
bordersForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
551
559
|
id: borderId,
|
|
@@ -554,9 +562,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
554
562
|
y1: _yAxisScale(y1),
|
|
555
563
|
x2: _xAxisScale(x2),
|
|
556
564
|
y2: _yAxisScale(y2),
|
|
557
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (
|
|
565
|
+
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',
|
|
558
566
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
559
|
-
stroke: ((
|
|
567
|
+
stroke: ((_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.lineBorderColor) || tokens.colorNeutralBackground1,
|
|
560
568
|
opacity: 1
|
|
561
569
|
}));
|
|
562
570
|
}
|
|
@@ -576,16 +584,16 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
576
584
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
577
585
|
onMouseOut: _handleMouseOut,
|
|
578
586
|
stroke: lineColor,
|
|
579
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (
|
|
580
|
-
strokeDasharray: (
|
|
581
|
-
strokeDashoffset: (
|
|
587
|
+
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',
|
|
588
|
+
strokeDasharray: (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeDasharray,
|
|
589
|
+
strokeDashoffset: (_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.strokeDashoffset,
|
|
582
590
|
opacity: 1,
|
|
583
591
|
..._getClickHandler(_points[i].onLineClick)
|
|
584
592
|
}));
|
|
585
593
|
}
|
|
586
594
|
} else {
|
|
587
595
|
if (!isInGap) {
|
|
588
|
-
var
|
|
596
|
+
var _points_i_lineOptions14, _points_i_lineOptions15, _points_i_lineOptions16;
|
|
589
597
|
var _points_i_lineOptions_strokeLinecap5;
|
|
590
598
|
linesForLine.push(/*#__PURE__*/ React.createElement("line", {
|
|
591
599
|
id: lineId,
|
|
@@ -596,9 +604,9 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
596
604
|
y2: _yAxisScale(y2),
|
|
597
605
|
strokeWidth: strokeWidth,
|
|
598
606
|
stroke: lineColor,
|
|
599
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (
|
|
600
|
-
strokeDasharray: (
|
|
601
|
-
strokeDashoffset: (
|
|
607
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
608
|
+
strokeDasharray: (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeDasharray,
|
|
609
|
+
strokeDashoffset: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDashoffset,
|
|
602
610
|
opacity: 0.1
|
|
603
611
|
}));
|
|
604
612
|
}
|
|
@@ -760,7 +768,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
760
768
|
if (found && pointToHighlightUpdated) {
|
|
761
769
|
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
762
770
|
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${_yAxisScale(pointToHighlight.y)}`).attr('visibility', 'visibility');
|
|
763
|
-
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${_yAxisScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - _yAxisScale(pointToHighlight.y)}`);
|
|
771
|
+
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${_yAxisScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - _yAxisScale(pointToHighlight.y)}`);
|
|
764
772
|
setNearestCircleToHighlight(pointToHighlight);
|
|
765
773
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
766
774
|
setStackCalloutProps(found);
|
|
@@ -804,7 +812,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
804
812
|
const found = find(_calloutPoints, (element)=>element.x === xVal);
|
|
805
813
|
// if no points need to be called out then don't show vertical line and callout card
|
|
806
814
|
if (found) {
|
|
807
|
-
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${_yAxisScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - _yAxisScale(y)}`);
|
|
815
|
+
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${_yAxisScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - _yAxisScale(y)}`);
|
|
808
816
|
if (_uniqueCallOutID !== circleId) {
|
|
809
817
|
_uniqueCallOutID = circleId;
|
|
810
818
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|