@fluentui/react-charts 9.2.1 → 9.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -2
- package/dist/index.d.ts +168 -15
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +58 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +170 -100
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +2 -2
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.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/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +251 -78
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +56 -37
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +41 -42
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +69 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +169 -98
- 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.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.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/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +250 -78
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +44 -41
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -95,6 +95,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
95
95
|
};
|
|
96
96
|
const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
97
97
|
var _props_legendProps_selectedLegends, _props_legendProps;
|
|
98
|
+
let _hasMarkersMode = false;
|
|
98
99
|
let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
99
100
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
101
|
let _calloutPoints = (0, _index1.calloutData)(_points) || [];
|
|
@@ -123,6 +124,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
123
124
|
const _isRTL = (0, _index1.useRtl)();
|
|
124
125
|
let xAxisCalloutAccessibilityData = {};
|
|
125
126
|
const cartesianChartRef = _react.useRef(null);
|
|
127
|
+
let _xMin = Number.NEGATIVE_INFINITY;
|
|
128
|
+
let _yMin = Number.NEGATIVE_INFINITY;
|
|
129
|
+
let _xMax = Number.POSITIVE_INFINITY;
|
|
130
|
+
let _xPadding = 0;
|
|
131
|
+
let _yPadding = 0;
|
|
126
132
|
let _yScaleSecondary;
|
|
127
133
|
const _legendsRef = _react.useRef(null);
|
|
128
134
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
@@ -171,7 +177,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
171
177
|
}, []);
|
|
172
178
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
173
179
|
let domainNRangeValue;
|
|
174
|
-
if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
180
|
+
if (_hasMarkersMode && xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
181
|
+
domainNRangeValue = _getDomainNRangeValuesWithPadding(points, margins, width, isRTL);
|
|
182
|
+
} else if (_hasMarkersMode && xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
183
|
+
domainNRangeValue = _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
184
|
+
} else if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
175
185
|
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaChart)(points, margins, width, isRTL);
|
|
176
186
|
} else if (xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
177
187
|
domainNRangeValue = (0, _index1.domainRangeOfDateForAreaLineVerticalBarChart)(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
@@ -192,6 +202,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
192
202
|
var _props_legendProps_selectedLegends, _props_legendProps, _props_legendProps1;
|
|
193
203
|
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;
|
|
194
204
|
}) : lineChartData;
|
|
205
|
+
var _filteredData_some;
|
|
206
|
+
_hasMarkersMode = (_filteredData_some = filteredData === null || filteredData === void 0 ? void 0 : filteredData.some((item)=>{
|
|
207
|
+
var _item_lineOptions_mode_includes, _item_lineOptions_mode, _item_lineOptions;
|
|
208
|
+
return (_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : (_item_lineOptions_mode = _item_lineOptions.mode) === null || _item_lineOptions_mode === void 0 ? void 0 : (_item_lineOptions_mode_includes = _item_lineOptions_mode.includes) === null || _item_lineOptions_mode_includes === void 0 ? void 0 : _item_lineOptions_mode_includes.call(_item_lineOptions_mode, 'markers');
|
|
209
|
+
})) !== null && _filteredData_some !== void 0 ? _filteredData_some : false;
|
|
195
210
|
return filteredData ? filteredData.map((item, index)=>{
|
|
196
211
|
let color;
|
|
197
212
|
if (typeof item.color === 'undefined') {
|
|
@@ -223,6 +238,18 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
223
238
|
function _getCustomizedCallout() {
|
|
224
239
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
225
240
|
}
|
|
241
|
+
function _getNumericMinMaxOfY(points) {
|
|
242
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
243
|
+
const { startValue, endValue } = (0, _index1.findNumericMinMaxOfY)(points);
|
|
244
|
+
_yMin = startValue;
|
|
245
|
+
if (_hasMarkersMode) {
|
|
246
|
+
_yPadding = (endValue - startValue) * 0.1;
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
startValue: startValue - _yPadding,
|
|
250
|
+
endValue: endValue + _yPadding
|
|
251
|
+
};
|
|
252
|
+
}
|
|
226
253
|
function _getMargins(_margins) {
|
|
227
254
|
margins = _margins;
|
|
228
255
|
}
|
|
@@ -255,17 +282,26 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
255
282
|
function _createLegends(data) {
|
|
256
283
|
const { legendProps, allowMultipleShapesForPoints = false } = props;
|
|
257
284
|
const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
|
|
258
|
-
const
|
|
259
|
-
|
|
285
|
+
const mapLegendToPoints = {};
|
|
286
|
+
data.forEach((point)=>{
|
|
287
|
+
if (point.legend) {
|
|
288
|
+
if (!mapLegendToPoints[point.legend]) {
|
|
289
|
+
mapLegendToPoints[point.legend] = [];
|
|
290
|
+
}
|
|
291
|
+
mapLegendToPoints[point.legend].push(point);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
const legendDataItems = Object.entries(mapLegendToPoints).map(([legendTitle, points])=>{
|
|
295
|
+
const representativePoint = points[0];
|
|
260
296
|
// mapping data to the format Legends component needs
|
|
261
297
|
const legend = {
|
|
262
|
-
title:
|
|
263
|
-
color,
|
|
298
|
+
title: legendTitle,
|
|
299
|
+
color: representativePoint.color,
|
|
264
300
|
action: ()=>{
|
|
265
301
|
if (isLegendMultiSelectEnabled) {
|
|
266
|
-
_handleMultipleLineLegendSelectionAction(
|
|
302
|
+
points.forEach((p)=>_handleMultipleLineLegendSelectionAction(p));
|
|
267
303
|
} else {
|
|
268
|
-
_handleSingleLegendSelectionAction(
|
|
304
|
+
points.forEach((p)=>_handleSingleLegendSelectionAction(p));
|
|
269
305
|
}
|
|
270
306
|
},
|
|
271
307
|
onMouseOutAction: ()=>{
|
|
@@ -273,13 +309,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
273
309
|
},
|
|
274
310
|
hoverAction: ()=>{
|
|
275
311
|
_handleChartMouseLeave();
|
|
276
|
-
setActiveLegend(
|
|
312
|
+
setActiveLegend(legendTitle);
|
|
277
313
|
},
|
|
278
|
-
...
|
|
279
|
-
shape:
|
|
314
|
+
...representativePoint.legendShape && {
|
|
315
|
+
shape: representativePoint.legendShape
|
|
280
316
|
},
|
|
281
317
|
...allowMultipleShapesForPoints && {
|
|
282
|
-
shape: _index1.Points[
|
|
318
|
+
shape: _index1.Points[representativePoint.index % Object.keys(_index1.pointTypes).length]
|
|
283
319
|
}
|
|
284
320
|
};
|
|
285
321
|
return legend;
|
|
@@ -373,6 +409,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
373
409
|
}
|
|
374
410
|
}
|
|
375
411
|
}
|
|
412
|
+
function _getRangeForScatterMarkerSize(yScale, yPadding) {
|
|
413
|
+
const extraXPixels = _isRTL ? _xAxisScale(_xMax - _xPadding) - _xAxisScale(_xMax) : _xAxisScale(_xMin + _xPadding) - _xAxisScale(_xMin);
|
|
414
|
+
const extraYPixels = yScale(_yMin) - yScale(_yMin + _yPadding);
|
|
415
|
+
return Math.min(extraXPixels, extraYPixels);
|
|
416
|
+
}
|
|
376
417
|
function _createLines(xElement, containerHeight) {
|
|
377
418
|
const lines = [];
|
|
378
419
|
if (isSelectedLegend) {
|
|
@@ -380,6 +421,12 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
380
421
|
} else {
|
|
381
422
|
_points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
|
|
382
423
|
}
|
|
424
|
+
const extraMaxPixels = _hasMarkersMode ? _getRangeForScatterMarkerSize(_yScalePrimary, _yPadding) : 0;
|
|
425
|
+
const maxMarkerSize = (0, _d3array.max)(_points, (point)=>{
|
|
426
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
427
|
+
return item.markerSize;
|
|
428
|
+
});
|
|
429
|
+
});
|
|
383
430
|
for(let i = _points.length - 1; i >= 0; i--){
|
|
384
431
|
var _points_i_gaps, _points_i_lineOptions;
|
|
385
432
|
const linesForLine = [];
|
|
@@ -394,10 +441,12 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
394
441
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
395
442
|
const circleId = `${_circleId}_${i}`;
|
|
396
443
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
397
|
-
|
|
444
|
+
const currentMarkerSize = _points[i].data[0].markerSize;
|
|
445
|
+
var _points_i_data__text;
|
|
446
|
+
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
398
447
|
id: circleId,
|
|
399
448
|
key: circleId,
|
|
400
|
-
r: activePoint === circleId ? 5.5 : 3.5,
|
|
449
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : activePoint === circleId ? 5.5 : 3.5,
|
|
401
450
|
cx: _xAxisScale(x1),
|
|
402
451
|
cy: yScale(y1),
|
|
403
452
|
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
@@ -409,7 +458,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
409
458
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
410
459
|
stroke: activePoint === circleId ? lineColor : '',
|
|
411
460
|
role: "img",
|
|
412
|
-
"aria-label": _getAriaLabel(i, 0),
|
|
461
|
+
"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),
|
|
413
462
|
"data-is-focusable": isLegendSelected,
|
|
414
463
|
ref: (e)=>{
|
|
415
464
|
_refCallback(e, circleId);
|
|
@@ -417,7 +466,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
417
466
|
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
418
467
|
onBlur: _handleMouseOut,
|
|
419
468
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
420
|
-
})
|
|
469
|
+
}), _points[i].data[0].text && /*#__PURE__*/ _react.createElement("text", {
|
|
470
|
+
key: `${circleId}-label`,
|
|
471
|
+
x: _xAxisScale(x1),
|
|
472
|
+
y: yScale(y1) + Math.max(currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 3.5, 4) + 12,
|
|
473
|
+
className: classes.markerLabel,
|
|
474
|
+
opacity: isLegendSelected ? 1 : 0.1
|
|
475
|
+
}, _points[i].data[0].text)));
|
|
421
476
|
}
|
|
422
477
|
let gapIndex = 0;
|
|
423
478
|
var _points_i_gaps_sort;
|
|
@@ -505,7 +560,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
505
560
|
}));
|
|
506
561
|
} else if (!props.optimizeLargeData) {
|
|
507
562
|
for(let j = 1; j < _points[i].data.length; j++){
|
|
508
|
-
var _points_i_lineOptions7;
|
|
563
|
+
var _points_i_lineOptions7, _points_i_lineOptions_mode, _points_i_lineOptions8, _points_i_lineOptions_mode1, _points_i_lineOptions9;
|
|
509
564
|
const gapResult = _checkInGap(j, gaps, gapIndex);
|
|
510
565
|
const isInGap = gapResult.isInGap;
|
|
511
566
|
gapIndex = gapResult.gapIndex;
|
|
@@ -518,7 +573,34 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
518
573
|
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;
|
|
519
574
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
520
575
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
521
|
-
|
|
576
|
+
let currentMarkerSize = _points[i].data[j - 1].markerSize;
|
|
577
|
+
var _points_i_data__text1;
|
|
578
|
+
pointsForLine.push(((_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : (_points_i_lineOptions_mode = _points_i_lineOptions8.mode) === null || _points_i_lineOptions_mode === void 0 ? void 0 : _points_i_lineOptions_mode.includes('markers')) ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
579
|
+
id: circleId,
|
|
580
|
+
key: circleId,
|
|
581
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
582
|
+
cx: _xAxisScale(x1),
|
|
583
|
+
cy: yScale(y1),
|
|
584
|
+
"data-is-focusable": isLegendSelected,
|
|
585
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
586
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
587
|
+
onMouseOut: _handleMouseOut,
|
|
588
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
589
|
+
onBlur: _handleMouseOut,
|
|
590
|
+
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
591
|
+
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
592
|
+
fill: _getPointFill(lineColor, circleId, j, false),
|
|
593
|
+
stroke: lineColor,
|
|
594
|
+
strokeWidth: strokeWidth,
|
|
595
|
+
role: "img",
|
|
596
|
+
"aria-label": (_points_i_data__text1 = _points[i].data[j - 1].text) !== null && _points_i_data__text1 !== void 0 ? _points_i_data__text1 : _getAriaLabel(i, j - 1)
|
|
597
|
+
}), _points[i].data[j - 1].text && /*#__PURE__*/ _react.createElement("text", {
|
|
598
|
+
key: `${circleId}-label`,
|
|
599
|
+
x: _xAxisScale(x1),
|
|
600
|
+
y: yScale(y1) + 12,
|
|
601
|
+
fontSize: 12,
|
|
602
|
+
className: classes.markerLabel
|
|
603
|
+
}, _points[i].data[j - 1].text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
522
604
|
id: circleId,
|
|
523
605
|
key: circleId,
|
|
524
606
|
d: path,
|
|
@@ -538,15 +620,43 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
538
620
|
tabIndex: isLegendSelected ? 0 : undefined
|
|
539
621
|
}));
|
|
540
622
|
if (j + 1 === _points[i].data.length) {
|
|
623
|
+
var _points_i_lineOptions_mode2, _points_i_lineOptions10;
|
|
541
624
|
// If this is last point of the line segment.
|
|
542
625
|
const lastCircleId = `${circleId}${j}L`;
|
|
543
626
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
544
627
|
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
545
628
|
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
546
629
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
630
|
+
currentMarkerSize = _points[i].data[j].markerSize;
|
|
631
|
+
var _points_i_data_j_text;
|
|
547
632
|
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
548
633
|
key: `${lastCircleId}_container`
|
|
549
|
-
}, /*#__PURE__*/ _react.createElement("
|
|
634
|
+
}, ((_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : (_points_i_lineOptions_mode2 = _points_i_lineOptions10.mode) === null || _points_i_lineOptions_mode2 === void 0 ? void 0 : _points_i_lineOptions_mode2.includes('markers')) ? /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
|
|
635
|
+
id: lastCircleId,
|
|
636
|
+
key: lastCircleId,
|
|
637
|
+
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
638
|
+
cx: _xAxisScale(x2),
|
|
639
|
+
cy: yScale(y2),
|
|
640
|
+
"data-is-focusable": isLegendSelected,
|
|
641
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
642
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
643
|
+
onMouseOut: _handleMouseOut,
|
|
644
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
645
|
+
onBlur: _handleMouseOut,
|
|
646
|
+
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
647
|
+
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
648
|
+
fill: _getPointFill(lineColor, lastCircleId, j, true),
|
|
649
|
+
stroke: lineColor,
|
|
650
|
+
strokeWidth: strokeWidth,
|
|
651
|
+
role: "img",
|
|
652
|
+
"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)
|
|
653
|
+
}), _points[i].data[j].text && /*#__PURE__*/ _react.createElement("text", {
|
|
654
|
+
key: `${lastCircleId}-label`,
|
|
655
|
+
x: _xAxisScale(x2),
|
|
656
|
+
y: yScale(y2) + 12,
|
|
657
|
+
fontSize: 12,
|
|
658
|
+
className: classes.markerLabel
|
|
659
|
+
}, _points[i].data[j].text)) : /*#__PURE__*/ _react.createElement("path", {
|
|
550
660
|
id: lastCircleId,
|
|
551
661
|
key: lastCircleId,
|
|
552
662
|
d: path,
|
|
@@ -580,72 +690,71 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
580
690
|
focusable: false,
|
|
581
691
|
onBlur: _handleMouseOut
|
|
582
692
|
})));
|
|
583
|
-
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
693
|
+
}
|
|
694
|
+
if (!_hasMarkersMode || ((_points_i_lineOptions9 = _points[i].lineOptions) === null || _points_i_lineOptions9 === void 0 ? void 0 : (_points_i_lineOptions_mode1 = _points_i_lineOptions9.mode) === null || _points_i_lineOptions_mode1 === void 0 ? void 0 : _points_i_lineOptions_mode1.includes('lines'))) {
|
|
695
|
+
if (isLegendSelected) {
|
|
696
|
+
// don't draw line if it is in a gap
|
|
697
|
+
if (!isInGap) {
|
|
698
|
+
var _points_i_lineOptions11, _points_i_lineOptions12, _points_i_lineOptions13, _points_i_lineOptions14;
|
|
699
|
+
const lineBorderWidth = ((_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
|
|
700
|
+
if (lineBorderWidth > 0) {
|
|
701
|
+
var _points_i_lineOptions15, _points_i_lineOptions16;
|
|
702
|
+
var _points_i_lineOptions_strokeLinecap3;
|
|
703
|
+
bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
704
|
+
id: borderId,
|
|
705
|
+
key: borderId,
|
|
706
|
+
x1: _xAxisScale(x1),
|
|
707
|
+
y1: yScale(y1),
|
|
708
|
+
x2: _xAxisScale(x2),
|
|
709
|
+
y2: yScale(y2),
|
|
710
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
|
|
711
|
+
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
712
|
+
stroke: ((_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
|
|
713
|
+
opacity: 1
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
716
|
+
var _points_i_lineOptions_strokeLinecap4;
|
|
717
|
+
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
718
|
+
id: lineId,
|
|
719
|
+
key: lineId,
|
|
595
720
|
x1: _xAxisScale(x1),
|
|
596
721
|
y1: yScale(y1),
|
|
597
722
|
x2: _xAxisScale(x2),
|
|
598
723
|
y2: yScale(y2),
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
stroke: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.lineBorderColor
|
|
724
|
+
strokeWidth: strokeWidth,
|
|
725
|
+
ref: (e)=>{
|
|
726
|
+
_refCallback(e, lineId);
|
|
603
727
|
},
|
|
604
|
-
|
|
605
|
-
|
|
728
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
729
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
730
|
+
onMouseOut: _handleMouseOut,
|
|
731
|
+
stroke: lineColor,
|
|
732
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : _points_i_lineOptions12.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
|
|
733
|
+
strokeDasharray: (_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.strokeDasharray,
|
|
734
|
+
strokeDashoffset: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.strokeDashoffset,
|
|
735
|
+
opacity: 1,
|
|
736
|
+
..._getClickHandler(_points[i].onLineClick)
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
739
|
+
} else {
|
|
740
|
+
if (!isInGap) {
|
|
741
|
+
var _points_i_lineOptions17, _points_i_lineOptions18, _points_i_lineOptions19;
|
|
742
|
+
var _points_i_lineOptions_strokeLinecap5;
|
|
743
|
+
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
744
|
+
id: lineId,
|
|
745
|
+
key: lineId,
|
|
746
|
+
x1: _xAxisScale(x1),
|
|
747
|
+
y1: yScale(y1),
|
|
748
|
+
x2: _xAxisScale(x2),
|
|
749
|
+
y2: yScale(y2),
|
|
750
|
+
strokeWidth: strokeWidth,
|
|
751
|
+
stroke: lineColor,
|
|
752
|
+
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
753
|
+
strokeDasharray: (_points_i_lineOptions18 = _points[i].lineOptions) === null || _points_i_lineOptions18 === void 0 ? void 0 : _points_i_lineOptions18.strokeDasharray,
|
|
754
|
+
strokeDashoffset: (_points_i_lineOptions19 = _points[i].lineOptions) === null || _points_i_lineOptions19 === void 0 ? void 0 : _points_i_lineOptions19.strokeDashoffset,
|
|
755
|
+
opacity: 0.1
|
|
606
756
|
}));
|
|
607
757
|
}
|
|
608
|
-
var _points_i_lineOptions_strokeLinecap4;
|
|
609
|
-
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
610
|
-
id: lineId,
|
|
611
|
-
key: lineId,
|
|
612
|
-
x1: _xAxisScale(x1),
|
|
613
|
-
y1: yScale(y1),
|
|
614
|
-
x2: _xAxisScale(x2),
|
|
615
|
-
y2: yScale(y2),
|
|
616
|
-
strokeWidth: strokeWidth,
|
|
617
|
-
ref: (e)=>{
|
|
618
|
-
_refCallback(e, lineId);
|
|
619
|
-
},
|
|
620
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
621
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
622
|
-
onMouseOut: _handleMouseOut,
|
|
623
|
-
stroke: lineColor,
|
|
624
|
-
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',
|
|
625
|
-
strokeDasharray: (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeDasharray,
|
|
626
|
-
strokeDashoffset: (_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.strokeDashoffset,
|
|
627
|
-
opacity: 1,
|
|
628
|
-
..._getClickHandler(_points[i].onLineClick)
|
|
629
|
-
}));
|
|
630
|
-
}
|
|
631
|
-
} else {
|
|
632
|
-
if (!isInGap) {
|
|
633
|
-
var _points_i_lineOptions15, _points_i_lineOptions16, _points_i_lineOptions17;
|
|
634
|
-
var _points_i_lineOptions_strokeLinecap5;
|
|
635
|
-
linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
|
|
636
|
-
id: lineId,
|
|
637
|
-
key: lineId,
|
|
638
|
-
x1: _xAxisScale(x1),
|
|
639
|
-
y1: yScale(y1),
|
|
640
|
-
x2: _xAxisScale(x2),
|
|
641
|
-
y2: yScale(y2),
|
|
642
|
-
strokeWidth: strokeWidth,
|
|
643
|
-
stroke: lineColor,
|
|
644
|
-
strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
|
|
645
|
-
strokeDasharray: (_points_i_lineOptions16 = _points[i].lineOptions) === null || _points_i_lineOptions16 === void 0 ? void 0 : _points_i_lineOptions16.strokeDasharray,
|
|
646
|
-
strokeDashoffset: (_points_i_lineOptions17 = _points[i].lineOptions) === null || _points_i_lineOptions17 === void 0 ? void 0 : _points_i_lineOptions17.strokeDashoffset,
|
|
647
|
-
opacity: 0.1
|
|
648
|
-
}));
|
|
649
758
|
}
|
|
650
759
|
}
|
|
651
760
|
}
|
|
@@ -985,6 +1094,69 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
985
1094
|
const yValue = point.yAxisCalloutData || point.y;
|
|
986
1095
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
987
1096
|
}
|
|
1097
|
+
function _getDomainNRangeValuesOfDateWithPadding(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
1098
|
+
let sDate;
|
|
1099
|
+
let lDate;
|
|
1100
|
+
sDate = (0, _d3array.min)(points, (point)=>{
|
|
1101
|
+
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1102
|
+
});
|
|
1103
|
+
lDate = (0, _d3array.max)(points, (point)=>{
|
|
1104
|
+
return (0, _d3array.max)(point.data, (item)=>item.x);
|
|
1105
|
+
});
|
|
1106
|
+
// Include tickValues if present
|
|
1107
|
+
sDate = (0, _d3array.min)([
|
|
1108
|
+
...tickValues,
|
|
1109
|
+
sDate
|
|
1110
|
+
]);
|
|
1111
|
+
lDate = (0, _d3array.max)([
|
|
1112
|
+
...tickValues,
|
|
1113
|
+
lDate
|
|
1114
|
+
]);
|
|
1115
|
+
// Calculate time-based padding (e.g. 10% of the date range)
|
|
1116
|
+
const dateRange = lDate.getTime() - sDate.getTime();
|
|
1117
|
+
const datePadding = _hasMarkersMode ? dateRange * 0.1 : 0;
|
|
1118
|
+
const paddedSDate = new Date(sDate.getTime() - datePadding);
|
|
1119
|
+
const paddedLDate = new Date(lDate.getTime() + datePadding);
|
|
1120
|
+
const rStartValue = margins.left;
|
|
1121
|
+
const rEndValue = width - margins.right;
|
|
1122
|
+
return isRTL ? {
|
|
1123
|
+
dStartValue: paddedLDate,
|
|
1124
|
+
dEndValue: paddedSDate,
|
|
1125
|
+
rStartValue,
|
|
1126
|
+
rEndValue
|
|
1127
|
+
} : {
|
|
1128
|
+
dStartValue: paddedSDate,
|
|
1129
|
+
dEndValue: paddedLDate,
|
|
1130
|
+
rStartValue,
|
|
1131
|
+
rEndValue
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
function _getDomainNRangeValuesWithPadding(points, margins, width, isRTL) {
|
|
1135
|
+
_xMin = (0, _d3array.min)(points, (point)=>{
|
|
1136
|
+
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
1137
|
+
});
|
|
1138
|
+
_xMax = (0, _d3array.max)(points, (point)=>{
|
|
1139
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
1140
|
+
return item.x;
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1143
|
+
if (_hasMarkersMode) {
|
|
1144
|
+
_xPadding = (_xMax - _xMin) * 0.1;
|
|
1145
|
+
}
|
|
1146
|
+
const rStartValue = margins.left;
|
|
1147
|
+
const rEndValue = width - margins.right;
|
|
1148
|
+
return isRTL ? {
|
|
1149
|
+
dStartValue: _xMax + _xPadding,
|
|
1150
|
+
dEndValue: _xMin - _xPadding,
|
|
1151
|
+
rStartValue,
|
|
1152
|
+
rEndValue
|
|
1153
|
+
} : {
|
|
1154
|
+
dStartValue: _xMin - _xPadding,
|
|
1155
|
+
dEndValue: _xMax + _xPadding,
|
|
1156
|
+
rStartValue,
|
|
1157
|
+
rEndValue
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
988
1160
|
function _isChartEmpty() {
|
|
989
1161
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
990
1162
|
}
|
|
@@ -1035,7 +1207,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1035
1207
|
legendBars: legendBars,
|
|
1036
1208
|
createYAxis: _index1.createNumericYAxis,
|
|
1037
1209
|
getmargins: _getMargins,
|
|
1038
|
-
getMinMaxOfYAxis:
|
|
1210
|
+
getMinMaxOfYAxis: _getNumericMinMaxOfY,
|
|
1039
1211
|
getGraphData: _initializeLineChartData,
|
|
1040
1212
|
xAxisType: isXAxisDateType ? _index1.XAxisTypes.DateAxis : _index1.XAxisTypes.NumericAxis,
|
|
1041
1213
|
getDomainNRangeValues: _getDomainNRangeValues,
|