@fluentui/react-charts 9.3.2 → 9.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -2
- package/dist/index.d.ts +151 -1
- package/lib/components/AreaChart/AreaChart.js +208 -60
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +14 -12
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +5 -6
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +2 -1
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +471 -207
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +8 -7
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +16 -32
- 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 +4 -4
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +23 -45
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +21 -46
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.js +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +145 -97
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +7 -11
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/types/DataPoint.js +1 -3
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +77 -26
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +207 -59
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +470 -206
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
- 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 +4 -4
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
- 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/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +144 -96
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -3
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +80 -26
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +13 -13
|
@@ -118,6 +118,9 @@ _export(exports, {
|
|
|
118
118
|
find: function() {
|
|
119
119
|
return find;
|
|
120
120
|
},
|
|
121
|
+
findCalloutPoints: function() {
|
|
122
|
+
return findCalloutPoints;
|
|
123
|
+
},
|
|
121
124
|
findHBCWANumericMinMaxOfY: function() {
|
|
122
125
|
return findHBCWANumericMinMaxOfY;
|
|
123
126
|
},
|
|
@@ -294,7 +297,7 @@ function defaultYAxisTickFormatter(value) {
|
|
|
294
297
|
return yAxisTickFormatterInternal(value);
|
|
295
298
|
}
|
|
296
299
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType, _useRtl) {
|
|
297
|
-
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
300
|
+
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
|
|
298
301
|
const xAxisScale = createNumericScale(scaleType).domain([
|
|
299
302
|
domainNRangeValues.dStartValue,
|
|
300
303
|
domainNRangeValues.dEndValue
|
|
@@ -305,6 +308,9 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
|
|
|
305
308
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
306
309
|
let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
307
310
|
const tickFormat = (domainValue, _index, defaultFormat)=>{
|
|
311
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
312
|
+
return tickText[_index];
|
|
313
|
+
}
|
|
308
314
|
if (tickParams.tickFormat) {
|
|
309
315
|
return (0, _d3format.format)(tickParams.tickFormat)(domainValue);
|
|
310
316
|
}
|
|
@@ -526,7 +532,7 @@ function getDateFormatLevel(date, useUTC) {
|
|
|
526
532
|
return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
|
|
527
533
|
}
|
|
528
534
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
529
|
-
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
535
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
|
|
530
536
|
const isUtcSet = useUTC === true || useUTC === 'utc';
|
|
531
537
|
const xAxisScale = isUtcSet ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
|
|
532
538
|
xAxisScale.domain([
|
|
@@ -552,6 +558,9 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
552
558
|
const formatOptions = options !== null && options !== void 0 ? options : (0, _chartutilities.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel, highestFormatLevel);
|
|
553
559
|
const formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, isUtcSet);
|
|
554
560
|
const tickFormat = (domainValue, _index)=>{
|
|
561
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
562
|
+
return tickText[_index];
|
|
563
|
+
}
|
|
555
564
|
if (customDateTimeFormatter) {
|
|
556
565
|
return customDateTimeFormatter(domainValue);
|
|
557
566
|
}
|
|
@@ -596,7 +605,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
596
605
|
};
|
|
597
606
|
}
|
|
598
607
|
function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
|
|
599
|
-
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
608
|
+
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap, calcMaxLabelWidth, tickText } = xAxisParams;
|
|
600
609
|
const xAxisScale = (0, _d3scale.scaleBand)().domain(dataset).range([
|
|
601
610
|
domainNRangeValues.rStartValue,
|
|
602
611
|
domainNRangeValues.rEndValue
|
|
@@ -604,7 +613,10 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
|
|
|
604
613
|
var _tickParams_tickValues;
|
|
605
614
|
let tickValues = (_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : dataset;
|
|
606
615
|
const tickFormat = (domainValue, _index)=>{
|
|
607
|
-
|
|
616
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
617
|
+
return tickText[_index];
|
|
618
|
+
}
|
|
619
|
+
return domainValue;
|
|
608
620
|
};
|
|
609
621
|
if (hideTickOverlap) {
|
|
610
622
|
let nonOverlappingTickValues = [];
|
|
@@ -705,7 +717,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
705
717
|
const { yMinMaxValues = {
|
|
706
718
|
startValue: 0,
|
|
707
719
|
endValue: 0
|
|
708
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, tickValues, tickStep, tick0 } = yAxisParams;
|
|
720
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, tickValues, tickStep, tick0, tickText } = yAxisParams;
|
|
709
721
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
710
722
|
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
711
723
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -719,7 +731,20 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
719
731
|
]);
|
|
720
732
|
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
721
733
|
const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
722
|
-
|
|
734
|
+
const tickFormat = (domainValue, index)=>{
|
|
735
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
736
|
+
return tickText[index];
|
|
737
|
+
}
|
|
738
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
739
|
+
return yAxisTickFormat(domainValue, index);
|
|
740
|
+
}
|
|
741
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
742
|
+
return (0, _d3format.format)(yAxisTickFormat)(domainValue);
|
|
743
|
+
}
|
|
744
|
+
const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
745
|
+
return defaultYAxisTickFormatter(value);
|
|
746
|
+
};
|
|
747
|
+
yAxis.tickFormat(tickFormat);
|
|
723
748
|
let customTickValues;
|
|
724
749
|
if (tickValues) {
|
|
725
750
|
customTickValues = tickValues;
|
|
@@ -736,7 +761,7 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, cha
|
|
|
736
761
|
const { yMinMaxValues = {
|
|
737
762
|
startValue: 0,
|
|
738
763
|
endValue: 0
|
|
739
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight, tickValues, tickStep, tick0 } = yAxisParams;
|
|
764
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight, tickValues, tickStep, tick0, tickText } = yAxisParams;
|
|
740
765
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
741
766
|
const tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
742
767
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -791,15 +816,24 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, cha
|
|
|
791
816
|
}
|
|
792
817
|
}
|
|
793
818
|
const tickFormat = (domainValue, index, defaultFormat)=>{
|
|
819
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
820
|
+
return tickText[index];
|
|
821
|
+
}
|
|
822
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
823
|
+
return yAxisTickFormat(domainValue, index);
|
|
824
|
+
}
|
|
825
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
826
|
+
return (0, _d3format.format)(yAxisTickFormat)(domainValue);
|
|
827
|
+
}
|
|
794
828
|
const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
795
829
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
796
830
|
};
|
|
797
|
-
|
|
831
|
+
yAxis.tickFormat((v, i)=>tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)));
|
|
798
832
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate').style('text-anchor', !useSecondaryYScale && (_useRtl ? 'start' : 'end')) : '';
|
|
799
833
|
return yAxisScale;
|
|
800
834
|
}
|
|
801
835
|
const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints, isRtl, barWidth)=>{
|
|
802
|
-
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding } = yAxisParams;
|
|
836
|
+
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding, tickValues, tickText } = yAxisParams;
|
|
803
837
|
let yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
804
838
|
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
805
839
|
const yAxisScale = (0, _d3scale.scaleBand)().domain(dataPoints).range([
|
|
@@ -807,15 +841,22 @@ const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints,
|
|
|
807
841
|
margins.top
|
|
808
842
|
]).padding(yAxisPaddingValue);
|
|
809
843
|
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
844
|
+
const customTickValues = tickValues !== null && tickValues !== void 0 ? tickValues : dataPoints;
|
|
845
|
+
const tickFormat = (domainValue, _index)=>{
|
|
846
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
847
|
+
return tickText[_index];
|
|
848
|
+
}
|
|
849
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
850
|
+
return yAxisTickFormat(domainValue, _index);
|
|
851
|
+
}
|
|
852
|
+
return domainValue;
|
|
853
|
+
};
|
|
854
|
+
const yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat);
|
|
814
855
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
815
856
|
return yAxisScale;
|
|
816
857
|
};
|
|
817
858
|
const createStringYAxis = (yAxisParams, dataPoints, isRtl, barWidth, chartType)=>{
|
|
818
|
-
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding = 0, containerWidth } = yAxisParams;
|
|
859
|
+
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding = 0, containerWidth, tickValues, tickText } = yAxisParams;
|
|
819
860
|
const yAxisScale = (0, _d3scale.scaleBand)().domain(dataPoints).range([
|
|
820
861
|
containerHeight - margins.bottom,
|
|
821
862
|
margins.top
|
|
@@ -824,13 +865,20 @@ const createStringYAxis = (yAxisParams, dataPoints, isRtl, barWidth, chartType)=
|
|
|
824
865
|
yAxisScale.paddingInner(1).paddingOuter(0);
|
|
825
866
|
}
|
|
826
867
|
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
827
|
-
const
|
|
868
|
+
const customTickValues = tickValues !== null && tickValues !== void 0 ? tickValues : dataPoints;
|
|
869
|
+
const tickFormat = (domainValue, _index)=>{
|
|
870
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
871
|
+
return tickText[_index];
|
|
872
|
+
}
|
|
873
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
874
|
+
return yAxisTickFormat(domainValue, _index);
|
|
875
|
+
}
|
|
876
|
+
return domainValue;
|
|
877
|
+
};
|
|
878
|
+
const yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat).tickSize(0);
|
|
828
879
|
if (chartType === 3) {
|
|
829
880
|
axis.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
830
881
|
}
|
|
831
|
-
if (yAxisTickFormat) {
|
|
832
|
-
yAxis.tickFormat(yAxisTickFormat);
|
|
833
|
-
}
|
|
834
882
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
835
883
|
return yAxisScale;
|
|
836
884
|
};
|
|
@@ -875,14 +923,7 @@ function calloutData(values) {
|
|
|
875
923
|
];
|
|
876
924
|
}
|
|
877
925
|
});
|
|
878
|
-
|
|
879
|
-
const originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
880
|
-
return {
|
|
881
|
-
x: originalXValue,
|
|
882
|
-
values: xValToDataPoints[xValue]
|
|
883
|
-
};
|
|
884
|
-
});
|
|
885
|
-
return result;
|
|
926
|
+
return xValToDataPoints;
|
|
886
927
|
}
|
|
887
928
|
function getUnique(arr, comp) {
|
|
888
929
|
const unique = arr // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1775,3 +1816,16 @@ function precisionRound(value, precision, base = 10) {
|
|
|
1775
1816
|
const exp = Math.pow(base, precision);
|
|
1776
1817
|
return Math.round(value * exp) / exp;
|
|
1777
1818
|
}
|
|
1819
|
+
const findCalloutPoints = (calloutPointsByX, x)=>{
|
|
1820
|
+
if (x === null) {
|
|
1821
|
+
return undefined;
|
|
1822
|
+
}
|
|
1823
|
+
const key = x instanceof Date ? x.getTime() : x;
|
|
1824
|
+
if (!calloutPointsByX[key]) {
|
|
1825
|
+
return undefined;
|
|
1826
|
+
}
|
|
1827
|
+
return {
|
|
1828
|
+
x,
|
|
1829
|
+
values: calloutPointsByX[key]
|
|
1830
|
+
};
|
|
1831
|
+
};
|