@fluentui/react-charts 9.1.2 → 9.1.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 +16 -2
- package/dist/index.d.ts +23 -1
- package/lib/components/AreaChart/AreaChart.js +18 -8
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +17 -13
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +50 -35
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +44 -18
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +40 -36
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +1 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +4 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -23
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +25 -34
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +16 -7
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +17 -13
- 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/DeclarativeChart/PlotlySchemaAdapter.js +50 -35
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +43 -17
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +40 -36
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +4 -4
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -22
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +25 -34
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +4 -4
|
@@ -100,7 +100,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
100
100
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
101
|
let _xAxisScale = '';
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
-
let
|
|
103
|
+
let _yScalePrimary = '';
|
|
104
104
|
let _circleId = (0, _reactutilities.useId)('circle');
|
|
105
105
|
let _lineId = (0, _reactutilities.useId)('lineID');
|
|
106
106
|
let _borderId = (0, _reactutilities.useId)('borderID');
|
|
@@ -122,6 +122,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
122
122
|
const _isRTL = (0, _index1.useRtl)();
|
|
123
123
|
let xAxisCalloutAccessibilityData = {};
|
|
124
124
|
const cartesianChartRef = _react.useRef(null);
|
|
125
|
+
let _yScaleSecondary;
|
|
125
126
|
props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
|
|
126
127
|
const [hoverXValue, setHoverXValue] = _react.useState('');
|
|
127
128
|
const [activeLegend, setActiveLegend] = _react.useState('');
|
|
@@ -203,9 +204,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
203
204
|
function _getMargins(_margins) {
|
|
204
205
|
margins = _margins;
|
|
205
206
|
}
|
|
206
|
-
function _initializeLineChartData(xScale,
|
|
207
|
+
function _initializeLineChartData(xScale, yScalePrimary, containerHeight, containerWidth, xElement, yAxisElement, yScaleSecondary) {
|
|
207
208
|
_xAxisScale = xScale;
|
|
208
|
-
|
|
209
|
+
_yScalePrimary = yScalePrimary;
|
|
210
|
+
_yScaleSecondary = yScaleSecondary;
|
|
209
211
|
_renderedColorFillBars = props.colorFillBars ? _createColorFillBars(containerHeight) : [];
|
|
210
212
|
lines = _createLines(xElement, containerHeight);
|
|
211
213
|
}
|
|
@@ -363,6 +365,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
363
365
|
const legendVal = _points[i].legend;
|
|
364
366
|
const lineColor = _points[i].color;
|
|
365
367
|
const verticaLineHeight = containerHeight - margins.bottom + 6;
|
|
368
|
+
const yScale = _points[i].useSecondaryYScale && _yScaleSecondary ? _yScaleSecondary : _yScalePrimary;
|
|
366
369
|
if (_points[i].data.length === 1) {
|
|
367
370
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
368
371
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
@@ -373,12 +376,12 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
373
376
|
key: circleId,
|
|
374
377
|
r: activePoint === circleId ? 5.5 : 3.5,
|
|
375
378
|
cx: _xAxisScale(x1),
|
|
376
|
-
cy:
|
|
379
|
+
cy: yScale(y1),
|
|
377
380
|
fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
|
|
378
381
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
379
382
|
tabIndex: isLegendSelected ? 0 : undefined,
|
|
380
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
381
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
383
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
384
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
382
385
|
onMouseOut: _handleMouseOut,
|
|
383
386
|
strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
|
|
384
387
|
stroke: activePoint === circleId ? lineColor : '',
|
|
@@ -402,7 +405,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
402
405
|
var _points_i_lineOptions1;
|
|
403
406
|
const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
404
407
|
.x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
405
|
-
.y((d)=>
|
|
408
|
+
.y((d)=>yScale(d[1])).curve((0, _index1.getCurveFactory)(lineCurve));
|
|
406
409
|
const lineId = `${_lineId}_${i}`;
|
|
407
410
|
const borderId = `${_borderId}_${i}`;
|
|
408
411
|
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;
|
|
@@ -441,8 +444,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
441
444
|
stroke: lineColor,
|
|
442
445
|
strokeWidth: strokeWidth,
|
|
443
446
|
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',
|
|
444
|
-
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
445
|
-
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
447
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
448
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
446
449
|
onMouseOut: _handleMouseOut,
|
|
447
450
|
..._getClickHandler(_points[i].onLineClick),
|
|
448
451
|
opacity: 1,
|
|
@@ -473,8 +476,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
473
476
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
474
477
|
stroke: lineColor,
|
|
475
478
|
visibility: 'hidden',
|
|
476
|
-
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
477
|
-
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
|
|
479
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
480
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale),
|
|
478
481
|
onMouseOut: _handleMouseOut
|
|
479
482
|
}));
|
|
480
483
|
} else if (!props.optimizeLargeData) {
|
|
@@ -488,7 +491,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
488
491
|
const circleId = `${_circleId}_${i}_${j}`;
|
|
489
492
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
|
|
490
493
|
const { x: x2, y: y2 } = _points[i].data[j];
|
|
491
|
-
let path = _getPath(_xAxisScale(x1),
|
|
494
|
+
let path = _getPath(_xAxisScale(x1), yScale(y1), circleId, j, false, _points[i].index);
|
|
492
495
|
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;
|
|
493
496
|
const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
|
|
494
497
|
const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
|
|
@@ -497,8 +500,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
497
500
|
key: circleId,
|
|
498
501
|
d: path,
|
|
499
502
|
"data-is-focusable": isLegendSelected,
|
|
500
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
501
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
503
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
504
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
502
505
|
onMouseOut: _handleMouseOut,
|
|
503
506
|
onFocus: ()=>_handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
504
507
|
onBlur: _handleMouseOut,
|
|
@@ -516,7 +519,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
516
519
|
const lastCircleId = `${circleId}${j}L`;
|
|
517
520
|
const hiddenHoverCircleId = `${circleId}${j}D`;
|
|
518
521
|
const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
|
|
519
|
-
path = _getPath(_xAxisScale(x2),
|
|
522
|
+
path = _getPath(_xAxisScale(x2), yScale(y2), lastCircleId, j, true, _points[i].index);
|
|
520
523
|
const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
|
|
521
524
|
pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
522
525
|
key: `${lastCircleId}_container`
|
|
@@ -525,8 +528,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
525
528
|
key: lastCircleId,
|
|
526
529
|
d: path,
|
|
527
530
|
"data-is-focusable": isLegendSelected,
|
|
528
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
|
|
529
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
|
|
531
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
532
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
530
533
|
onMouseOut: _handleMouseOut,
|
|
531
534
|
onFocus: ()=>_handleFocus(lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
532
535
|
onBlur: _handleMouseOut,
|
|
@@ -543,11 +546,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
543
546
|
key: hiddenHoverCircleId,
|
|
544
547
|
r: 8,
|
|
545
548
|
cx: _xAxisScale(x2),
|
|
546
|
-
cy:
|
|
549
|
+
cy: yScale(y2),
|
|
547
550
|
opacity: 0,
|
|
548
551
|
width: 0,
|
|
549
|
-
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
|
|
550
|
-
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
|
|
552
|
+
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
553
|
+
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
551
554
|
onMouseOut: _handleMouseOut,
|
|
552
555
|
strokeWidth: 0,
|
|
553
556
|
focusable: false,
|
|
@@ -566,9 +569,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
566
569
|
id: borderId,
|
|
567
570
|
key: borderId,
|
|
568
571
|
x1: _xAxisScale(x1),
|
|
569
|
-
y1:
|
|
572
|
+
y1: yScale(y1),
|
|
570
573
|
x2: _xAxisScale(x2),
|
|
571
|
-
y2:
|
|
574
|
+
y2: yScale(y2),
|
|
572
575
|
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',
|
|
573
576
|
strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
|
|
574
577
|
...((_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.lineBorderColor) && {
|
|
@@ -583,15 +586,15 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
583
586
|
id: lineId,
|
|
584
587
|
key: lineId,
|
|
585
588
|
x1: _xAxisScale(x1),
|
|
586
|
-
y1:
|
|
589
|
+
y1: yScale(y1),
|
|
587
590
|
x2: _xAxisScale(x2),
|
|
588
|
-
y2:
|
|
591
|
+
y2: yScale(y2),
|
|
589
592
|
strokeWidth: strokeWidth,
|
|
590
593
|
ref: (e)=>{
|
|
591
594
|
_refCallback(e, lineId);
|
|
592
595
|
},
|
|
593
|
-
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
594
|
-
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
|
|
596
|
+
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
597
|
+
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
595
598
|
onMouseOut: _handleMouseOut,
|
|
596
599
|
stroke: lineColor,
|
|
597
600
|
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',
|
|
@@ -609,9 +612,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
609
612
|
id: lineId,
|
|
610
613
|
key: lineId,
|
|
611
614
|
x1: _xAxisScale(x1),
|
|
612
|
-
y1:
|
|
615
|
+
y1: yScale(y1),
|
|
613
616
|
x2: _xAxisScale(x2),
|
|
614
|
-
y2:
|
|
617
|
+
y2: yScale(y2),
|
|
615
618
|
strokeWidth: strokeWidth,
|
|
616
619
|
stroke: lineColor,
|
|
617
620
|
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',
|
|
@@ -677,9 +680,9 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
677
680
|
fill: colorFillBar.applyPattern ? `url(#${_colorFillBarPatternId}_${i})` : color,
|
|
678
681
|
fillOpacity: opacity,
|
|
679
682
|
x: _isRTL ? _xAxisScale(endX) : _xAxisScale(startX),
|
|
680
|
-
y:
|
|
683
|
+
y: _yScalePrimary(yMinMaxValues.endValue) - FILL_Y_PADDING,
|
|
681
684
|
width: Math.abs(_xAxisScale(endX) - _xAxisScale(startX)),
|
|
682
|
-
height:
|
|
685
|
+
height: _yScalePrimary(props.yMinValue || 0) - _yScalePrimary(yMinMaxValues.endValue) + FILL_Y_PADDING,
|
|
683
686
|
key: `${colorFillBarId}${j}`
|
|
684
687
|
}));
|
|
685
688
|
}
|
|
@@ -722,7 +725,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
722
725
|
refElement: element
|
|
723
726
|
});
|
|
724
727
|
}
|
|
725
|
-
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent)=>{
|
|
728
|
+
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
726
729
|
mouseEvent.persist();
|
|
727
730
|
const { data } = props;
|
|
728
731
|
const { lineChartData } = data;
|
|
@@ -776,8 +779,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
776
779
|
// if no points need to be called out then don't show vertical line and callout card
|
|
777
780
|
if (found && pointToHighlightUpdated) {
|
|
778
781
|
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
779
|
-
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${
|
|
780
|
-
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${
|
|
782
|
+
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${yScale(pointToHighlight.y)}`).attr('visibility', 'visibility');
|
|
783
|
+
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${yScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(pointToHighlight.y)}`);
|
|
781
784
|
setNearestCircleToHighlight(pointToHighlight);
|
|
782
785
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
783
786
|
setStackCalloutProps(found);
|
|
@@ -814,14 +817,14 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
814
817
|
setActivePoint(circleId);
|
|
815
818
|
}
|
|
816
819
|
}
|
|
817
|
-
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
|
|
820
|
+
function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent, yScale) {
|
|
818
821
|
mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
|
|
819
822
|
const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
|
|
820
823
|
const xVal = x instanceof Date ? x.getTime() : x;
|
|
821
824
|
const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
|
|
822
825
|
// if no points need to be called out then don't show vertical line and callout card
|
|
823
826
|
if (found) {
|
|
824
|
-
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${
|
|
827
|
+
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${yScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yScale(y)}`);
|
|
825
828
|
if (_uniqueCallOutID !== circleId) {
|
|
826
829
|
_uniqueCallOutID = circleId;
|
|
827
830
|
updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
@@ -1009,7 +1012,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
1009
1012
|
/* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
|
|
1010
1013
|
children: (props)=>{
|
|
1011
1014
|
_xAxisScale = props.xScale;
|
|
1012
|
-
|
|
1015
|
+
_yScalePrimary = props.yScalePrimary;
|
|
1016
|
+
_yScaleSecondary = props.yScaleSecondary;
|
|
1013
1017
|
return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", null, /*#__PURE__*/ _react.createElement("line", {
|
|
1014
1018
|
x1: 0,
|
|
1015
1019
|
y1: 0,
|