@fluentui/react-charts 9.0.1 → 9.0.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 +58 -2
- package/dist/index.d.ts +1432 -238
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -0
- package/lib/GaugeChart.js +1 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/GroupedVerticalBarChart.js +1 -0
- package/lib/GroupedVerticalBarChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/ScatterChart.js +1 -0
- package/lib/ScatterChart.js.map +1 -0
- package/lib/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +30 -14
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +1 -1
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +1 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +592 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/index.js +3 -0
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +38 -37
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +43 -35
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1022 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +465 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -3
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +49 -4
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/colors.js +20 -0
- package/lib/utilities/colors.js.map +1 -1
- package/lib/utilities/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +53 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.js +210 -20
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.js.map +1 -0
- package/lib-commonjs/GaugeChart.js +6 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/ScatterChart.js +6 -0
- package/lib-commonjs/ScatterChart.js.map +1 -0
- package/lib-commonjs/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +621 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.js +8 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +37 -37
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +41 -33
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1038 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.js +8 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +8 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -3
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/colors.js +23 -0
- package/lib-commonjs/utilities/colors.js.map +1 -1
- package/lib-commonjs/utilities/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +59 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +206 -19
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -8
- package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
|
@@ -33,6 +33,9 @@ _export(exports, {
|
|
|
33
33
|
YAxisType: function() {
|
|
34
34
|
return YAxisType;
|
|
35
35
|
},
|
|
36
|
+
areArraysEqual: function() {
|
|
37
|
+
return areArraysEqual;
|
|
38
|
+
},
|
|
36
39
|
calculateLongestLabelWidth: function() {
|
|
37
40
|
return calculateLongestLabelWidth;
|
|
38
41
|
},
|
|
@@ -81,12 +84,18 @@ _export(exports, {
|
|
|
81
84
|
domainRangeOfDateForAreaLineVerticalBarChart: function() {
|
|
82
85
|
return domainRangeOfDateForAreaLineVerticalBarChart;
|
|
83
86
|
},
|
|
87
|
+
domainRangeOfDateForScatterChart: function() {
|
|
88
|
+
return domainRangeOfDateForScatterChart;
|
|
89
|
+
},
|
|
84
90
|
domainRangeOfNumericForAreaChart: function() {
|
|
85
91
|
return domainRangeOfNumericForAreaChart;
|
|
86
92
|
},
|
|
87
93
|
domainRangeOfNumericForHorizontalBarChartWithAxis: function() {
|
|
88
94
|
return domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
89
95
|
},
|
|
96
|
+
domainRangeOfNumericForScatterChart: function() {
|
|
97
|
+
return domainRangeOfNumericForScatterChart;
|
|
98
|
+
},
|
|
90
99
|
domainRangeOfVSBCNumeric: function() {
|
|
91
100
|
return domainRangeOfVSBCNumeric;
|
|
92
101
|
},
|
|
@@ -123,6 +132,9 @@ _export(exports, {
|
|
|
123
132
|
getBarWidth: function() {
|
|
124
133
|
return getBarWidth;
|
|
125
134
|
},
|
|
135
|
+
getCurveFactory: function() {
|
|
136
|
+
return getCurveFactory;
|
|
137
|
+
},
|
|
126
138
|
getDomainNRangeValues: function() {
|
|
127
139
|
return getDomainNRangeValues;
|
|
128
140
|
},
|
|
@@ -132,6 +144,9 @@ _export(exports, {
|
|
|
132
144
|
getScalePadding: function() {
|
|
133
145
|
return getScalePadding;
|
|
134
146
|
},
|
|
147
|
+
getSecureProps: function() {
|
|
148
|
+
return getSecureProps;
|
|
149
|
+
},
|
|
135
150
|
getTypeOfAxis: function() {
|
|
136
151
|
return getTypeOfAxis;
|
|
137
152
|
},
|
|
@@ -179,6 +194,7 @@ const _d3selection = require("d3-selection");
|
|
|
179
194
|
const _d3format = require("d3-format");
|
|
180
195
|
const _d3timeformat = require("d3-time-format");
|
|
181
196
|
const _d3time = require("d3-time");
|
|
197
|
+
const _d3shape = require("d3-shape");
|
|
182
198
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
183
199
|
var ChartTypes;
|
|
184
200
|
(function(ChartTypes) {
|
|
@@ -189,6 +205,7 @@ var ChartTypes;
|
|
|
189
205
|
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
190
206
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
191
207
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
208
|
+
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
192
209
|
})(ChartTypes || (ChartTypes = {}));
|
|
193
210
|
var XAxisTypes;
|
|
194
211
|
(function(XAxisTypes) {
|
|
@@ -359,23 +376,68 @@ function useRtl() {
|
|
|
359
376
|
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)(); // "dir" returns "ltr" or "rtl"
|
|
360
377
|
return dir === 'rtl';
|
|
361
378
|
}
|
|
362
|
-
function
|
|
379
|
+
function isPowerOf10(num) {
|
|
380
|
+
const roundedfinalYMax = handleFloatingPointPrecisionError(num);
|
|
381
|
+
return Math.log10(roundedfinalYMax) % 1 === 0;
|
|
382
|
+
}
|
|
383
|
+
//for reference, go through this 'https://docs.python.org/release/2.5.1/tut/node16.html'
|
|
384
|
+
function handleFloatingPointPrecisionError(num) {
|
|
385
|
+
const rounded = Math.round(num);
|
|
386
|
+
return Math.abs(num - rounded) < 1e-6 ? rounded : num;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* This method is used to calculate the rounded tick values for the y-axis
|
|
390
|
+
* @param {number} minVal
|
|
391
|
+
* @param {number} maxVal
|
|
392
|
+
* @param {number} splitInto
|
|
393
|
+
* @returns {number[]}
|
|
394
|
+
*/ function calculateRoundedTicks(minVal, maxVal, splitInto) {
|
|
395
|
+
const finalYmin = minVal >= 0 && minVal === maxVal ? 0 : minVal;
|
|
396
|
+
const finalYmax = minVal < 0 && minVal === maxVal ? 0 : maxVal;
|
|
397
|
+
const ticksInterval = (0, _d3array.nice)(finalYmin, finalYmax, splitInto);
|
|
398
|
+
const ticks = (0, _d3array.ticks)(ticksInterval[0], ticksInterval[ticksInterval.length - 1], splitInto);
|
|
399
|
+
if (ticks[ticks.length - 1] > finalYmax && isPowerOf10(finalYmax)) {
|
|
400
|
+
ticks.pop();
|
|
401
|
+
}
|
|
402
|
+
return ticks;
|
|
403
|
+
}
|
|
404
|
+
function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset, roundedTicks) {
|
|
405
|
+
if (roundedTicks) {
|
|
406
|
+
return calculateRoundedTicks(minVal, maxVal, splitInto);
|
|
407
|
+
}
|
|
363
408
|
const val = isIntegralDataset ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto >= 1 ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
409
|
+
/*
|
|
410
|
+
For cases where we have negative and positive values
|
|
411
|
+
The dataPointsArray is filled from 0 to minVal by val difference
|
|
412
|
+
Then the array is reversed and values from 0(excluding 0) to maxVal are appended
|
|
413
|
+
This ensures presence of 0 to act as an anchor reference.
|
|
414
|
+
For simple cases where the scale may not encounter such a need for 0,
|
|
415
|
+
We simply fill from minVal to maxVal
|
|
416
|
+
*/ const dataPointsArray = [
|
|
417
|
+
minVal < 0 && maxVal >= 0 ? 0 : minVal
|
|
367
418
|
];
|
|
419
|
+
/*For the case of all positive or all negative, we need to add another value
|
|
420
|
+
in array for atleast one interval, but in case of mix of positive and negative,
|
|
421
|
+
there will always be one more entry that will be added by the logic we have*/ if (dataPointsArray[0] === minVal) {
|
|
422
|
+
dataPointsArray.push(minVal + val);
|
|
423
|
+
}
|
|
424
|
+
if (minVal < 0 && maxVal >= 0) {
|
|
425
|
+
while(dataPointsArray[dataPointsArray.length - 1] > minVal){
|
|
426
|
+
dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] - val);
|
|
427
|
+
}
|
|
428
|
+
dataPointsArray.reverse();
|
|
429
|
+
}
|
|
368
430
|
while(dataPointsArray[dataPointsArray.length - 1] < maxVal){
|
|
369
431
|
dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] + val);
|
|
370
432
|
}
|
|
371
433
|
return dataPointsArray;
|
|
372
434
|
}
|
|
373
|
-
function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale = false) {
|
|
435
|
+
function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale = false, roundedTicks = false) {
|
|
374
436
|
switch(chartType){
|
|
375
437
|
case 6:
|
|
376
438
|
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
377
439
|
default:
|
|
378
|
-
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
440
|
+
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
|
|
379
441
|
}
|
|
380
442
|
}
|
|
381
443
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
@@ -397,10 +459,10 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData,
|
|
|
397
459
|
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
398
460
|
const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
399
461
|
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
|
|
400
|
-
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(
|
|
462
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
401
463
|
return yAxisScale;
|
|
402
464
|
}
|
|
403
|
-
function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale = false) {
|
|
465
|
+
function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
|
|
404
466
|
const { yMinMaxValues = {
|
|
405
467
|
startValue: 0,
|
|
406
468
|
endValue: 0
|
|
@@ -408,11 +470,18 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
408
470
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
409
471
|
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
410
472
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
411
|
-
const finalYmin = yMinMaxValues.startValue
|
|
412
|
-
const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset);
|
|
473
|
+
const finalYmin = Math.min(yMinMaxValues.startValue, yMinValue || 0);
|
|
474
|
+
const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset, roundedTicks);
|
|
475
|
+
let yMin = finalYmin;
|
|
476
|
+
let yMax = domainValues[domainValues.length - 1];
|
|
477
|
+
if (chartType === 7) {
|
|
478
|
+
const yPadding = (yMax - yMin) * 0.1;
|
|
479
|
+
yMin = yMin - yPadding;
|
|
480
|
+
yMax = yMax + yPadding;
|
|
481
|
+
}
|
|
413
482
|
const yAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
414
|
-
|
|
415
|
-
|
|
483
|
+
domainValues[0],
|
|
484
|
+
yMax
|
|
416
485
|
]).range([
|
|
417
486
|
containerHeight - margins.bottom,
|
|
418
487
|
margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
|
|
@@ -443,7 +512,7 @@ const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints,
|
|
|
443
512
|
if (yAxisTickFormat) {
|
|
444
513
|
yAxis.tickFormat(yAxisTickFormat);
|
|
445
514
|
}
|
|
446
|
-
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(
|
|
515
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
447
516
|
return yAxisScale;
|
|
448
517
|
};
|
|
449
518
|
const createStringYAxisForOtherCharts = (yAxisParams, dataPoints, isRtl)=>{
|
|
@@ -457,7 +526,7 @@ const createStringYAxisForOtherCharts = (yAxisParams, dataPoints, isRtl)=>{
|
|
|
457
526
|
if (yAxisTickFormat) {
|
|
458
527
|
yAxis.tickFormat(yAxisTickFormat);
|
|
459
528
|
}
|
|
460
|
-
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(
|
|
529
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
461
530
|
return yAxisScale;
|
|
462
531
|
};
|
|
463
532
|
function calloutData(values) {
|
|
@@ -501,8 +570,9 @@ function calloutData(values) {
|
|
|
501
570
|
}
|
|
502
571
|
});
|
|
503
572
|
const result = Object.keys(xValToDataPoints).map((xValue)=>{
|
|
573
|
+
const originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
504
574
|
return {
|
|
505
|
-
x:
|
|
575
|
+
x: originalXValue,
|
|
506
576
|
values: xValToDataPoints[xValue]
|
|
507
577
|
};
|
|
508
578
|
});
|
|
@@ -531,7 +601,7 @@ function createWrapOfXLabels(wrapLabelProps) {
|
|
|
531
601
|
if (node === null) {
|
|
532
602
|
return;
|
|
533
603
|
}
|
|
534
|
-
const axisNode = (0, _d3selection.select)(node).call(
|
|
604
|
+
const axisNode = (0, _d3selection.select)(node).call(xAxis);
|
|
535
605
|
let removeVal = 0;
|
|
536
606
|
const width = 10;
|
|
537
607
|
const arr = [];
|
|
@@ -596,6 +666,7 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, xVal
|
|
|
596
666
|
if (node === null) {
|
|
597
667
|
return;
|
|
598
668
|
}
|
|
669
|
+
let tickIndex = 0;
|
|
599
670
|
const axisNode = (0, _d3selection.select)(node).call(yAxis);
|
|
600
671
|
axisNode.selectAll('.tick text').each(function() {
|
|
601
672
|
const text = (0, _d3selection.select)(this);
|
|
@@ -607,11 +678,12 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, xVal
|
|
|
607
678
|
const x = text.attr('x');
|
|
608
679
|
const dy = parseFloat(text.attr('dy'));
|
|
609
680
|
const dx = 0;
|
|
610
|
-
|
|
681
|
+
const uid = tickIndex++;
|
|
682
|
+
text.text(null).append('tspan').attr('x', x).attr('y', y).attr('id', `BaseSpan-${uid}`).attr('dy', dy + 'em').attr('data-', totalWord);
|
|
611
683
|
if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
|
|
612
|
-
text.append('tspan').attr('id',
|
|
684
|
+
text.append('tspan').attr('id', `showDots-${uid}`).attr('x', isRtl ? 0 : x).attr('y', y).attr('dy', dy).attr('dx', padding + dx + 'em').text(truncatedWord);
|
|
613
685
|
} else {
|
|
614
|
-
text.attr('text-align', 'start').append('tspan').attr('id',
|
|
686
|
+
text.attr('text-align', 'start').append('tspan').attr('id', `LessLength-${uid}`).attr('x', isRtl ? 0 : x).attr('y', y).attr('dx', padding + dx + 'em').text(totalWord);
|
|
615
687
|
}
|
|
616
688
|
});
|
|
617
689
|
}
|
|
@@ -713,6 +785,32 @@ function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
|
|
|
713
785
|
rEndValue
|
|
714
786
|
};
|
|
715
787
|
}
|
|
788
|
+
function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
789
|
+
let xMin = (0, _d3array.min)(points, (point)=>{
|
|
790
|
+
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
791
|
+
});
|
|
792
|
+
let xMax = (0, _d3array.max)(points, (point)=>{
|
|
793
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
794
|
+
return item.x;
|
|
795
|
+
});
|
|
796
|
+
});
|
|
797
|
+
const xPadding = (xMax - xMin) * 0.1;
|
|
798
|
+
xMin = xMin - xPadding;
|
|
799
|
+
xMax = xMax + xPadding;
|
|
800
|
+
const rStartValue = margins.left;
|
|
801
|
+
const rEndValue = width - margins.right;
|
|
802
|
+
return isRTL ? {
|
|
803
|
+
dStartValue: xMax,
|
|
804
|
+
dEndValue: xMin,
|
|
805
|
+
rStartValue,
|
|
806
|
+
rEndValue
|
|
807
|
+
} : {
|
|
808
|
+
dStartValue: xMin,
|
|
809
|
+
dEndValue: xMax,
|
|
810
|
+
rStartValue,
|
|
811
|
+
rEndValue
|
|
812
|
+
};
|
|
813
|
+
}
|
|
716
814
|
function domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, containerWidth, isRTL, shiftX) {
|
|
717
815
|
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
718
816
|
const rMin = isRTL ? margins.left : margins.left + shiftX;
|
|
@@ -809,6 +907,50 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
|
|
|
809
907
|
rEndValue
|
|
810
908
|
};
|
|
811
909
|
}
|
|
910
|
+
function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues = []) {
|
|
911
|
+
let sDate;
|
|
912
|
+
let lDate;
|
|
913
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
914
|
+
sDate = (0, _d3array.min)(points, (point)=>{
|
|
915
|
+
return (0, _d3array.min)(point.data, (item)=>{
|
|
916
|
+
return item.x;
|
|
917
|
+
});
|
|
918
|
+
});
|
|
919
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
920
|
+
lDate = (0, _d3array.max)(points, (point)=>{
|
|
921
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
922
|
+
return item.x;
|
|
923
|
+
});
|
|
924
|
+
});
|
|
925
|
+
const xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
926
|
+
sDate = new Date(sDate.getTime() - xPadding);
|
|
927
|
+
lDate = new Date(lDate.getTime() + xPadding);
|
|
928
|
+
// Need to draw graph with given small and large date
|
|
929
|
+
// (Which Involves customization of date axis tick values)
|
|
930
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
931
|
+
// So, Finding smallest and largest dates
|
|
932
|
+
sDate = (0, _d3array.min)([
|
|
933
|
+
...tickValues,
|
|
934
|
+
sDate
|
|
935
|
+
]);
|
|
936
|
+
lDate = (0, _d3array.max)([
|
|
937
|
+
...tickValues,
|
|
938
|
+
lDate
|
|
939
|
+
]);
|
|
940
|
+
const rStartValue = margins.left;
|
|
941
|
+
const rEndValue = width - margins.right;
|
|
942
|
+
return isRTL ? {
|
|
943
|
+
dStartValue: lDate,
|
|
944
|
+
dEndValue: sDate,
|
|
945
|
+
rStartValue,
|
|
946
|
+
rEndValue
|
|
947
|
+
} : {
|
|
948
|
+
dStartValue: sDate,
|
|
949
|
+
dEndValue: lDate,
|
|
950
|
+
rStartValue,
|
|
951
|
+
rEndValue
|
|
952
|
+
};
|
|
953
|
+
}
|
|
812
954
|
function domainRageOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
|
|
813
955
|
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
814
956
|
const xMin = (0, _d3array.min)(points, (point)=>point.x);
|
|
@@ -843,6 +985,9 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
843
985
|
case 6:
|
|
844
986
|
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
845
987
|
break;
|
|
988
|
+
case 7:
|
|
989
|
+
domainNRangeValue = domainRangeOfNumericForScatterChart(points, margins, width, isRTL);
|
|
990
|
+
break;
|
|
846
991
|
default:
|
|
847
992
|
domainNRangeValue = {
|
|
848
993
|
dStartValue: 0,
|
|
@@ -859,6 +1004,9 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
859
1004
|
case 3:
|
|
860
1005
|
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
861
1006
|
break;
|
|
1007
|
+
case 7:
|
|
1008
|
+
domainNRangeValue = domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues);
|
|
1009
|
+
break;
|
|
862
1010
|
default:
|
|
863
1011
|
domainNRangeValue = {
|
|
864
1012
|
dStartValue: 0,
|
|
@@ -874,6 +1022,7 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
874
1022
|
case 4:
|
|
875
1023
|
case 2:
|
|
876
1024
|
case 5:
|
|
1025
|
+
case 7:
|
|
877
1026
|
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
878
1027
|
break;
|
|
879
1028
|
default:
|
|
@@ -954,6 +1103,7 @@ function getMinMaxOfYAxis(points, chartType, yAxisType = 0) {
|
|
|
954
1103
|
switch(chartType){
|
|
955
1104
|
case 0:
|
|
956
1105
|
case 1:
|
|
1106
|
+
case 7:
|
|
957
1107
|
minMaxValues = findNumericMinMaxOfY(points);
|
|
958
1108
|
break;
|
|
959
1109
|
case 3:
|
|
@@ -1175,6 +1325,20 @@ const formatDate = (date, useUTC)=>{
|
|
|
1175
1325
|
const timeFormat = useUTC ? _d3timeformat.utcFormat : _d3timeformat.timeFormat;
|
|
1176
1326
|
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1177
1327
|
};
|
|
1328
|
+
function areArraysEqual(arr1, arr2) {
|
|
1329
|
+
if (arr1 === arr2 || !arr1 && !arr2) {
|
|
1330
|
+
return true;
|
|
1331
|
+
}
|
|
1332
|
+
if (!arr1 || !arr2 || arr1.length !== arr2.length) {
|
|
1333
|
+
return false;
|
|
1334
|
+
}
|
|
1335
|
+
for(let i = 0; i < arr1.length; i++){
|
|
1336
|
+
if (arr1[i] !== arr2[i]) {
|
|
1337
|
+
return false;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return true;
|
|
1341
|
+
}
|
|
1178
1342
|
const cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1179
1343
|
function resolveCSSVariables(chartContainer, styleRules) {
|
|
1180
1344
|
const containerStyles = getComputedStyle(chartContainer);
|
|
@@ -1182,3 +1346,26 @@ function resolveCSSVariables(chartContainer, styleRules) {
|
|
|
1182
1346
|
return containerStyles.getPropertyValue(group1);
|
|
1183
1347
|
});
|
|
1184
1348
|
}
|
|
1349
|
+
function getSecureProps(props = {}) {
|
|
1350
|
+
const { dangerouslySetInnerHTML, ...result } = props;
|
|
1351
|
+
return result;
|
|
1352
|
+
}
|
|
1353
|
+
function getCurveFactory(curve, defaultFactory = _d3shape.curveLinear) {
|
|
1354
|
+
if (typeof curve === 'function') {
|
|
1355
|
+
return curve;
|
|
1356
|
+
}
|
|
1357
|
+
switch(curve){
|
|
1358
|
+
case 'linear':
|
|
1359
|
+
return _d3shape.curveLinear;
|
|
1360
|
+
case 'natural':
|
|
1361
|
+
return _d3shape.curveNatural;
|
|
1362
|
+
case 'step':
|
|
1363
|
+
return _d3shape.curveStep;
|
|
1364
|
+
case 'stepAfter':
|
|
1365
|
+
return _d3shape.curveStepAfter;
|
|
1366
|
+
case 'stepBefore':
|
|
1367
|
+
return _d3shape.curveStepBefore;
|
|
1368
|
+
default:
|
|
1369
|
+
return defaultFactory;
|
|
1370
|
+
}
|
|
1371
|
+
}
|