@fluentui/react-charting 5.24.31 → 5.24.33
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.json +57 -1
- package/CHANGELOG.md +23 -2
- package/dist/react-charting.d.ts +131 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +44 -2
- package/lib/components/AreaChart/AreaChart.base.js +18 -22
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.base.js +12 -6
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +1 -4
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +107 -52
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +13 -2
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +260 -100
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +7 -2
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +49 -39
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +5 -11
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +121 -1
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +18 -4
- package/lib/utilities/utilities.js +14 -5
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js +16 -20
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js +12 -7
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +1 -4
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -51
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +13 -2
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +257 -97
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +7 -2
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +48 -38
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +3 -9
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +121 -1
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +18 -4
- package/lib-amd/utilities/utilities.js +16 -6
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +16 -20
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +12 -6
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +1 -4
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -51
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +13 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +257 -97
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +7 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +48 -38
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +3 -9
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +121 -1
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +18 -4
- package/lib-commonjs/utilities/utilities.js +16 -6
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/project.json +155 -0
|
@@ -10,7 +10,7 @@ import { CartesianChart, } from '../../index';
|
|
|
10
10
|
import { DirectionalHint } from '@fluentui/react/lib/Callout';
|
|
11
11
|
import { formatDateToLocaleString } from '@fluentui/chart-utilities';
|
|
12
12
|
import { EventsAnnotation } from './eventAnnotation/EventAnnotation';
|
|
13
|
-
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfAxislabels, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfNumericForAreaLineScatterCharts, createStringYAxis, areArraysEqual, getCurveFactory, isScatterPolarSeries, getDomainPaddingForMarkers, isPlottable, getRangeForScatterMarkerSize, } from '../../utilities/index';
|
|
13
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, tooltipOfAxislabels, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfNumericForAreaLineScatterCharts, createStringYAxis, areArraysEqual, getCurveFactory, isScatterPolarSeries, getDomainPaddingForMarkers, isPlottable, getRangeForScatterMarkerSize, findCalloutPoints, } from '../../utilities/index';
|
|
14
14
|
import { toImage } from '../../utilities/image-export-utils';
|
|
15
15
|
import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';
|
|
16
16
|
var getClassNames = classNamesFunction();
|
|
@@ -326,11 +326,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
326
326
|
var formattedDate = xPointToHighlight instanceof Date
|
|
327
327
|
? formatDateToLocaleString(xPointToHighlight, _this_1.props.culture, _this_1.props.useUTC)
|
|
328
328
|
: xPointToHighlight;
|
|
329
|
-
var
|
|
330
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
331
|
-
var found = find(_this_1._calloutPoints, function (element) {
|
|
332
|
-
return element.x === modifiedXVal;
|
|
333
|
-
});
|
|
329
|
+
var found = findCalloutPoints(_this_1._calloutPoints, xPointToHighlight);
|
|
334
330
|
var pointToHighlight = lineChartData[linenumber].data[index];
|
|
335
331
|
var pointToHighlightUpdated = _this_1.state.nearestCircleToHighlight === null ||
|
|
336
332
|
(_this_1.state.nearestCircleToHighlight !== null &&
|
|
@@ -373,8 +369,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
373
369
|
_this_1._handleFocus = function (lineId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
|
|
374
370
|
_this_1._uniqueCallOutID = circleId;
|
|
375
371
|
var formattedData = x instanceof Date ? formatDateToLocaleString(x, _this_1.props.culture, _this_1.props.useUTC) : x;
|
|
376
|
-
var
|
|
377
|
-
var found = find(_this_1._calloutPoints, function (element) { return element.x === xVal; });
|
|
372
|
+
var found = findCalloutPoints(_this_1._calloutPoints, x);
|
|
378
373
|
// if no points need to be called out then don't show vertical line and callout card
|
|
379
374
|
if (found) {
|
|
380
375
|
var _this_2 = _this_1;
|
|
@@ -405,16 +400,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
405
400
|
_this_1._handleHover = function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor, mouseEvent) {
|
|
406
401
|
mouseEvent.persist();
|
|
407
402
|
var formattedData = x instanceof Date ? formatDateToLocaleString(x, _this_1.props.culture, _this_1.props.useUTC) : x;
|
|
408
|
-
var xVal = x instanceof Date ? x.getTime() : x;
|
|
409
|
-
var yVal = y instanceof Date ? y.getTime() : y;
|
|
410
403
|
var _this = _this_1;
|
|
411
|
-
var found =
|
|
404
|
+
var found = findCalloutPoints(_this_1._calloutPoints, x);
|
|
412
405
|
var hoverDp = undefined;
|
|
413
406
|
if (_this_1.props.isCalloutForStack === false && (found === null || found === void 0 ? void 0 : found.values)) {
|
|
414
|
-
var dp = find(found.values, function (val) { return (val === null || val === void 0 ? void 0 : val.y) ===
|
|
407
|
+
var dp = find(found.values, function (val) { return (val === null || val === void 0 ? void 0 : val.y) === y; });
|
|
415
408
|
if (dp) {
|
|
416
409
|
hoverDp = {
|
|
417
|
-
x:
|
|
410
|
+
x: x,
|
|
418
411
|
values: [dp],
|
|
419
412
|
};
|
|
420
413
|
}
|
|
@@ -432,7 +425,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
432
425
|
refSelected: "#".concat(circleId),
|
|
433
426
|
hoverXValue: xAxisCalloutData ? xAxisCalloutData : '' + formattedData,
|
|
434
427
|
YValueHover: found.values,
|
|
435
|
-
YValue:
|
|
428
|
+
YValue: y,
|
|
436
429
|
legendVal: legendVal,
|
|
437
430
|
lineColor: lineColor,
|
|
438
431
|
stackCalloutProps: found,
|
|
@@ -619,7 +612,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
619
612
|
_this_1._refArray = [];
|
|
620
613
|
_this_1._points = _this_1._injectIndexPropertyInLineChartData(_this_1.props.data.lineChartData);
|
|
621
614
|
_this_1._colorFillBars = [];
|
|
622
|
-
_this_1._calloutPoints = calloutData(_this_1._points) ||
|
|
615
|
+
_this_1._calloutPoints = calloutData(_this_1._points) || {};
|
|
623
616
|
_this_1._circleId = getId('circle');
|
|
624
617
|
_this_1._lineId = getId('lineID');
|
|
625
618
|
_this_1._borderId = getId('borderID');
|
|
@@ -655,7 +648,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
655
648
|
prevProps.width !== this.props.width ||
|
|
656
649
|
prevProps.data !== this.props.data) {
|
|
657
650
|
this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
|
|
658
|
-
this._calloutPoints = calloutData(this._points) ||
|
|
651
|
+
this._calloutPoints = calloutData(this._points) || {};
|
|
659
652
|
}
|
|
660
653
|
};
|
|
661
654
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -780,7 +773,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
780
773
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
781
774
|
LineChartBase.prototype._createLines = function (xElement, containerHeight) {
|
|
782
775
|
var _this_1 = this;
|
|
783
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
|
|
776
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27;
|
|
784
777
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
785
778
|
var lines = [];
|
|
786
779
|
if (this.state.isSelectedLegend) {
|
|
@@ -824,12 +817,12 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
824
817
|
})
|
|
825
818
|
: 0;
|
|
826
819
|
if (this_1._points[i].data.length === 1) {
|
|
827
|
-
var
|
|
820
|
+
var _28 = this_1._points[i].data[0], x1_1 = _28.x, y1 = _28.y, xAxisCalloutData_1 = _28.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _28.xAxisCalloutAccessibilityData;
|
|
828
821
|
var xPoint = this_1._xAxisScale(x1_1);
|
|
829
822
|
var yPoint = yScale(y1);
|
|
830
823
|
if (isPlottable(xPoint, yPoint)) {
|
|
831
824
|
var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
|
|
832
|
-
var
|
|
825
|
+
var isLegendSelected_1 = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
833
826
|
var currentMarkerSize = this_1._points[i].data[0].markerSize;
|
|
834
827
|
var supportsTextMode = (_b = (_a = this_1._points[i].lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === null || _b === void 0 ? void 0 : _b.includes('text');
|
|
835
828
|
var text = this_1._points[i].data[0].text;
|
|
@@ -838,14 +831,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
838
831
|
? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
|
|
839
832
|
: activePoint === circleId_1
|
|
840
833
|
? 5.5
|
|
841
|
-
: 3.5, cx: xPoint, cy: yPoint, fill: activePoint === circleId_1 ? theme.semanticColors.bodyBackground : lineColor, opacity:
|
|
834
|
+
: 3.5, cx: xPoint, cy: yPoint, fill: activePoint === circleId_1 ? theme.semanticColors.bodyBackground : lineColor, opacity: isLegendSelected_1 ? 1 : 0.1, onMouseOver: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, strokeWidth: activePoint === circleId_1 ? DEFAULT_LINE_STROKE_SIZE : 0, stroke: activePoint === circleId_1 ? lineColor : '', role: "img", "aria-label": this_1._getAriaLabel(i, 0), "data-is-focusable": isLegendSelected_1, ref: function (e) {
|
|
842
835
|
_this_1._refCallback(e, circleId_1);
|
|
843
836
|
}, onFocus: function () {
|
|
844
837
|
return _this_1._handleFocus(circleId_1, x1_1, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1);
|
|
845
838
|
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[0].onDataPointClick))),
|
|
846
839
|
!this_1._isScatterPolar && supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId_1, "-label"), x: xPoint, y: yPoint +
|
|
847
840
|
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 3.5, 4) +
|
|
848
|
-
12, className: classNames.markerLabel, opacity:
|
|
841
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected_1 ? 1 : 0.1 }, text))));
|
|
849
842
|
}
|
|
850
843
|
}
|
|
851
844
|
var gapIndex = 0;
|
|
@@ -863,7 +856,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
863
856
|
var lineId = "".concat(this_1._lineId, "_").concat(i);
|
|
864
857
|
var borderId = "".concat(this_1._borderId, "_").concat(i);
|
|
865
858
|
var strokeWidth = ((_f = this_1._points[i].lineOptions) === null || _f === void 0 ? void 0 : _f.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
866
|
-
var
|
|
859
|
+
var isLegendSelected_2 = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
867
860
|
var lineData = [];
|
|
868
861
|
for (var k = 0; k < this_1._points[i].data.length; k++) {
|
|
869
862
|
lineData.push([
|
|
@@ -876,7 +869,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
876
869
|
// Check if lines should be drawn based on mode
|
|
877
870
|
var lineMode = (_g = this_1._points[i].lineOptions) === null || _g === void 0 ? void 0 : _g.mode;
|
|
878
871
|
var shouldDrawLines = lineMode !== 'markers';
|
|
879
|
-
if (shouldDrawLines &&
|
|
872
|
+
if (shouldDrawLines && isLegendSelected_2) {
|
|
880
873
|
var lineBorderWidth = ((_h = this_1._points[i].lineOptions) === null || _h === void 0 ? void 0 : _h.lineBorderWidth)
|
|
881
874
|
? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
|
|
882
875
|
: 0;
|
|
@@ -895,7 +888,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
895
888
|
var showMarkers = (lineMode === null || lineMode === void 0 ? void 0 : lineMode.includes('markers')) || !lineMode; // Show markers by default if no mode specified
|
|
896
889
|
if (showMarkers) {
|
|
897
890
|
for (var k = 0; k < this_1._points[i].data.length; k++) {
|
|
898
|
-
var
|
|
891
|
+
var _29 = this_1._points[i].data[k], x = _29.x, y = _29.y;
|
|
899
892
|
var xPoint = this_1._xAxisScale(x instanceof Date ? x.getTime() : x);
|
|
900
893
|
var yPoint = yScale(y);
|
|
901
894
|
if (isPlottable(xPoint, yPoint)) {
|
|
@@ -907,7 +900,7 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
907
900
|
? 5.5
|
|
908
901
|
: 3.5, cx: xPoint, cy: yPoint, fill: activePoint === this_1._circleId
|
|
909
902
|
? theme.semanticColors.bodyBackground
|
|
910
|
-
: perPointColor || ((_u = this_1._points[i]) === null || _u === void 0 ? void 0 : _u.color) || lineColor, stroke: perPointColor || lineColor, strokeWidth: 1, opacity:
|
|
903
|
+
: perPointColor || ((_u = this_1._points[i]) === null || _u === void 0 ? void 0 : _u.color) || lineColor, stroke: perPointColor || lineColor, strokeWidth: 1, opacity: isLegendSelected_2 ? 1 : 0.1, onMouseMove: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOver: this_1._onMouseOverLargeDataset.bind(this_1, i, verticaLineHeight, yScale), onMouseOut: this_1._handleMouseOut }));
|
|
911
904
|
}
|
|
912
905
|
}
|
|
913
906
|
}
|
|
@@ -920,14 +913,14 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
920
913
|
var lineId = "".concat(this_1._lineId, "_").concat(i, "_").concat(j);
|
|
921
914
|
var borderId = "".concat(this_1._borderId, "_").concat(i, "_").concat(j);
|
|
922
915
|
var circleId = "".concat(this_1._circleId, "_").concat(i, "_").concat(j);
|
|
923
|
-
var
|
|
924
|
-
var
|
|
916
|
+
var _30 = this_1._points[i].data[j - 1], x1 = _30.x, y1 = _30.y, xAxisCalloutData = _30.xAxisCalloutData, xAxisCalloutAccessibilityData = _30.xAxisCalloutAccessibilityData;
|
|
917
|
+
var _31 = this_1._points[i].data[j], x2 = _31.x, y2 = _31.y;
|
|
925
918
|
var xPoint1 = this_1._xAxisScale(x1);
|
|
926
919
|
var yPoint1 = yScale(y1);
|
|
927
920
|
var xPoint2 = this_1._xAxisScale(x2);
|
|
928
921
|
var yPoint2 = yScale(y2);
|
|
929
922
|
var strokeWidth = ((_v = this_1._points[i].lineOptions) === null || _v === void 0 ? void 0 : _v.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
|
|
930
|
-
var
|
|
923
|
+
var isLegendSelected_3 = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
931
924
|
var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
|
|
932
925
|
var supportsTextMode = (_x = (_w = this_1._points[i].lineOptions) === null || _w === void 0 ? void 0 : _w.mode) === null || _x === void 0 ? void 0 : _x.includes('text');
|
|
933
926
|
var text = this_1._points[i].data[j - 1].text;
|
|
@@ -935,21 +928,21 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
935
928
|
if (isPlottable(xPoint1, yPoint1)) {
|
|
936
929
|
var path = this_1._getPath(xPoint1, yPoint1, circleId, j, false, this_1._points[i].index);
|
|
937
930
|
pointsForLine.push(((_z = (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.mode) === null || _z === void 0 ? void 0 : _z.includes('markers')) || supportsTextMode ? (React.createElement(React.Fragment, null,
|
|
938
|
-
React.createElement("circle", __assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint1, cy: yPoint1, "data-is-focusable":
|
|
931
|
+
React.createElement("circle", __assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint1, cy: yPoint1, "data-is-focusable": isLegendSelected_3, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
939
932
|
return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData);
|
|
940
|
-
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity:
|
|
933
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected_3 && !currentPointHidden ? 1 : 0.01, fill: ((_0 = this_1._points[i].data[j - 1]) === null || _0 === void 0 ? void 0 : _0.markerColor) || this_1._getPointFill(lineColor, circleId, j, false), stroke: ((_1 = this_1._points[i].data[j - 1]) === null || _1 === void 0 ? void 0 : _1.markerColor) || lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": (_2 = this_1._points[i].data[j - 1].text) !== null && _2 !== void 0 ? _2 : this_1._getAriaLabel(i, j - 1) })),
|
|
941
934
|
!this_1._isScatterPolar && supportsTextMode && text && (React.createElement("text", { key: "".concat(circleId, "-label"), x: xPoint1, y: yPoint1 +
|
|
942
935
|
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
943
|
-
12, className: classNames.markerLabel, opacity:
|
|
936
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected_3 && !currentPointHidden ? 1 : 0.01 }, text)))) : (React.createElement("path", __assign({ id: circleId, key: circleId, d: path, "data-is-focusable": isLegendSelected_3, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
944
937
|
return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData);
|
|
945
|
-
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity:
|
|
938
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected_3 && !currentPointHidden ? 1 : 0.01, fill: ((_3 = this_1._points[i].data[j - 1]) === null || _3 === void 0 ? void 0 : _3.markerColor) || this_1._getPointFill(lineColor, circleId, j, false), stroke: ((_4 = this_1._points[i].data[j - 1]) === null || _4 === void 0 ? void 0 : _4.markerColor) || lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) }))));
|
|
946
939
|
}
|
|
947
940
|
if (j + 1 === this_1._points[i].data.length) {
|
|
948
941
|
// If this is last point of the line segment.
|
|
949
942
|
var lastCircleId_1 = "".concat(circleId).concat(j, "L");
|
|
950
943
|
var hiddenHoverCircleId = "".concat(circleId).concat(j, "D");
|
|
951
944
|
var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
|
|
952
|
-
var
|
|
945
|
+
var _32 = this_1._points[i].data[j], lastCirlceXCallout_1 = _32.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _32.xAxisCalloutAccessibilityData;
|
|
953
946
|
currentMarkerSize = this_1._points[i].data[j].markerSize;
|
|
954
947
|
var lastSupportsTextMode = (_6 = (_5 = this_1._points[i].lineOptions) === null || _5 === void 0 ? void 0 : _5.mode) === null || _6 === void 0 ? void 0 : _6.includes('text');
|
|
955
948
|
var lastText = this_1._points[i].data[j].text;
|
|
@@ -957,21 +950,21 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
957
950
|
var path = this_1._getPath(xPoint2, yPoint2, lastCircleId_1, j, true, this_1._points[i].index);
|
|
958
951
|
pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
|
|
959
952
|
((_8 = (_7 = this_1._points[i].lineOptions) === null || _7 === void 0 ? void 0 : _7.mode) === null || _8 === void 0 ? void 0 : _8.includes('markers')) || lastSupportsTextMode ? (React.createElement(React.Fragment, null,
|
|
960
|
-
React.createElement("circle", __assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint2, cy: yPoint2, "data-is-focusable":
|
|
953
|
+
React.createElement("circle", __assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: xPoint2, cy: yPoint2, "data-is-focusable": isLegendSelected_3, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
961
954
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
962
|
-
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity:
|
|
955
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected_3 && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": (_9 = this_1._points[i].data[j].text) !== null && _9 !== void 0 ? _9 : this_1._getAriaLabel(i, j) })),
|
|
963
956
|
!this_1._isScatterPolar && lastSupportsTextMode && lastText && (React.createElement("text", { key: "".concat(lastCircleId_1, "-label"), x: xPoint2, y: yPoint2 +
|
|
964
957
|
Math.max(currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, 4) +
|
|
965
|
-
12, className: classNames.markerLabel, opacity:
|
|
958
|
+
12, className: classNames.markerLabel, opacity: isLegendSelected_3 && !currentPointHidden ? 1 : 0.01 }, text)))) : (React.createElement("path", __assign({ id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": isLegendSelected_3, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, onFocus: function () {
|
|
966
959
|
return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
|
|
967
|
-
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity:
|
|
960
|
+
}, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected_3 && !lastPointHidden ? 1 : 0.01, fill: ((_10 = this_1._points[i].data[j]) === null || _10 === void 0 ? void 0 : _10.markerColor) || this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: ((_11 = this_1._points[i].data[j]) === null || _11 === void 0 ? void 0 : _11.markerColor) || lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))),
|
|
968
961
|
React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: xPoint2, cy: yPoint2, opacity: 0, width: 0, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1, yScale, legendVal, lineColor), onMouseOut: this_1._handleMouseOut, strokeWidth: 0, focusable: false, onBlur: this_1._handleMouseOut })));
|
|
969
962
|
}
|
|
970
963
|
}
|
|
971
964
|
if (isPlottable(xPoint1, yPoint1) &&
|
|
972
965
|
isPlottable(xPoint2, yPoint2) &&
|
|
973
966
|
(!this_1._hasMarkersMode || ((_13 = (_12 = this_1._points[i].lineOptions) === null || _12 === void 0 ? void 0 : _12.mode) === null || _13 === void 0 ? void 0 : _13.includes('lines')))) {
|
|
974
|
-
if (
|
|
967
|
+
if (isLegendSelected_3) {
|
|
975
968
|
// don't draw line if it is in a gap
|
|
976
969
|
if (!isInGap) {
|
|
977
970
|
var lineBorderWidth = ((_14 = this_1._points[i].lineOptions) === null || _14 === void 0 ? void 0 : _14.lineBorderWidth)
|
|
@@ -996,12 +989,29 @@ var LineChartBase = /** @class */ (function (_super) {
|
|
|
996
989
|
_loop_2(j);
|
|
997
990
|
}
|
|
998
991
|
}
|
|
992
|
+
// Add filled area for scatterpolar charts
|
|
993
|
+
var fillMode = (_26 = this_1._points[i].lineOptions) === null || _26 === void 0 ? void 0 : _26.fill;
|
|
994
|
+
var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
|
|
995
|
+
if (fillMode === 'toself' && this_1._points[i].data.length >= 3 && isLegendSelected && this_1._isScatterPolar) {
|
|
996
|
+
var getScaledXValue_1 = function (dataPoint) {
|
|
997
|
+
return _this_1._xAxisScale(dataPoint.x instanceof Date ? dataPoint.x : dataPoint.x);
|
|
998
|
+
};
|
|
999
|
+
var fillPathGenerator = d3Line()
|
|
1000
|
+
.x(function (dataPoint) { return getScaledXValue_1(dataPoint); })
|
|
1001
|
+
.y(function (dataPoint) { return yScale(dataPoint.y); })
|
|
1002
|
+
.curve(getCurveFactory(lineCurve))
|
|
1003
|
+
.defined(function (dataPoint) { return isPlottable(getScaledXValue_1(dataPoint), yScale(dataPoint.y)); });
|
|
1004
|
+
var fillPath = fillPathGenerator(this_1._points[i].data);
|
|
1005
|
+
if (fillPath) {
|
|
1006
|
+
linesForLine.push(React.createElement("path", { key: "scatterpolar_fill_".concat(i), d: "".concat(fillPath, "Z"), fill: lineColor, fillOpacity: 0.5, stroke: lineColor, strokeWidth: 2, strokeOpacity: 0.8, pointerEvents: "none" }));
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
999
1009
|
if (this_1._isScatterPolar) {
|
|
1000
1010
|
pointsForLine.push.apply(pointsForLine, renderScatterPolarCategoryLabels({
|
|
1001
1011
|
xAxisScale: this_1._xAxisScale,
|
|
1002
1012
|
yAxisScale: yScale,
|
|
1003
1013
|
className: classNames.markerLabel || '',
|
|
1004
|
-
lineOptions: (
|
|
1014
|
+
lineOptions: (_27 = this_1._points[i]) === null || _27 === void 0 ? void 0 : _27.lineOptions,
|
|
1005
1015
|
}));
|
|
1006
1016
|
}
|
|
1007
1017
|
lines.push(React.createElement("g", { key: "line_".concat(i), role: "region", "aria-label": "".concat(legendVal, ", line ").concat(i + 1, " of ").concat(this_1._points.length, " with ").concat(this_1._points[i].data.length, " data points.") },
|