@fluentui/react-charts 9.1.1 → 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 +38 -2
- package/dist/index.d.ts +89 -6
- 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/CommonComponents/useCartesianChartStyles.styles.js +4 -4
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +25 -13
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +57 -36
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -3
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +4 -4
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +45 -19
- 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/LineChart/eventAnnotation/LabelLink.js +2 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +51 -22
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib/components/ResponsiveContainer/index.js +2 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js +19 -0
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -3
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.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 +5 -5
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +62 -24
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +3 -3
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +27 -36
- 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/CommonComponents/useCartesianChartStyles.styles.js +5 -5
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +25 -13
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +57 -36
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +4 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +6 -4
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +44 -18
- 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/LineChart/eventAnnotation/LabelLink.js +2 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +47 -21
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/index.js +2 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +27 -0
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +4 -4
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.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 +5 -5
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -23
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +27 -36
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -10
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +0 -23
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +0 -47
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,48 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-charts
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 23 Jun 2025 15:47:17 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.1.3)
|
|
8
|
+
|
|
9
|
+
Mon, 23 Jun 2025 15:47:17 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.2..@fluentui/react-charts_v9.1.3)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Add negative y value support in GVBC ([PR #34687](https://github.com/microsoft/fluentui/pull/34687) by anushgupta@microsoft.com)
|
|
15
|
+
- add support for negative vsbc ([PR #34668](https://github.com/microsoft/fluentui/pull/34668) by anushgupta@microsoft.com)
|
|
16
|
+
- port v8 changes to v9 ([PR #34665](https://github.com/microsoft/fluentui/pull/34665) by anushgupta@microsoft.com)
|
|
17
|
+
- Bump @fluentui/react-overflow to v9.4.3 ([PR #34677](https://github.com/microsoft/fluentui/pull/34677) by beachball)
|
|
18
|
+
- Bump @fluentui/react-popover to v9.11.3 ([PR #34677](https://github.com/microsoft/fluentui/pull/34677) by beachball)
|
|
19
|
+
- Bump @fluentui/react-tooltip to v9.7.3 ([PR #34677](https://github.com/microsoft/fluentui/pull/34677) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.1.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.1.2)
|
|
22
|
+
|
|
23
|
+
Wed, 18 Jun 2025 17:33:57 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.1..@fluentui/react-charts_v9.1.2)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- chore (react-charts): Remove enzyme dependency for tests ([PR #34595](https://github.com/microsoft/fluentui/pull/34595) by 98592573+AtishayMsft@users.noreply.github.com)
|
|
29
|
+
- fix (react-charts): Update traceinfo property structure ([PR #34652](https://github.com/microsoft/fluentui/pull/34652) by 98592573+AtishayMsft@users.noreply.github.com)
|
|
30
|
+
- fix(react-charts): Consume y axis tick format for bar labels ([PR #34653](https://github.com/microsoft/fluentui/pull/34653) by 98592573+AtishayMsft@users.noreply.github.com)
|
|
31
|
+
- fix(react-charts): Fix svg tooltip background alignment ([PR #34663](https://github.com/microsoft/fluentui/pull/34663) by 98592573+AtishayMsft@users.noreply.github.com)
|
|
32
|
+
- port v8 fixes to v9 ([PR #34670](https://github.com/microsoft/fluentui/pull/34670) by anushgupta@microsoft.com)
|
|
33
|
+
- Charts made responsive ([PR #34641](https://github.com/microsoft/fluentui/pull/34641) by anushgupta@microsoft.com)
|
|
34
|
+
- Bump @fluentui/react-button to v9.5.1 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
35
|
+
- Bump @fluentui/react-jsx-runtime to v9.1.1 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
36
|
+
- Bump @fluentui/react-overflow to v9.4.2 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
37
|
+
- Bump @fluentui/react-popover to v9.11.2 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
38
|
+
- Bump @fluentui/react-shared-contexts to v9.24.0 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
39
|
+
- Bump @fluentui/react-tabster to v9.25.1 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
40
|
+
- Bump @fluentui/react-tooltip to v9.7.2 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
41
|
+
- Bump @fluentui/react-utilities to v9.21.1 ([PR #34675](https://github.com/microsoft/fluentui/pull/34675) by beachball)
|
|
42
|
+
|
|
7
43
|
## [9.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.1.1)
|
|
8
44
|
|
|
9
|
-
Fri, 13 Jun 2025 12:
|
|
45
|
+
Fri, 13 Jun 2025 12:32:53 GMT
|
|
10
46
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.0..@fluentui/react-charts_v9.1.1)
|
|
11
47
|
|
|
12
48
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -343,6 +343,11 @@ export declare interface CartesianChartProps {
|
|
|
343
343
|
* props for the svg; use this to include aria-* or other attributes on the tag
|
|
344
344
|
*/
|
|
345
345
|
svgProps?: React_2.SVGProps<SVGSVGElement>;
|
|
346
|
+
/**
|
|
347
|
+
* Prop to disable shrinking of the chart beyond a certain limit and enable scrolling when the chart overflows
|
|
348
|
+
* @default True for LineChart but False for other charts
|
|
349
|
+
*/
|
|
350
|
+
enableReflow?: boolean;
|
|
346
351
|
/**
|
|
347
352
|
* Props related to reflow behavior of the chart
|
|
348
353
|
*/
|
|
@@ -441,6 +446,10 @@ export declare interface CartesianChartStyleProps {
|
|
|
441
446
|
* boolean flag which determines if shape is drawn in callout
|
|
442
447
|
*/
|
|
443
448
|
toDrawShape?: boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Prop to disable shrinking of the chart beyond a certain limit and enable scrolling when the chart overflows
|
|
451
|
+
*/
|
|
452
|
+
enableReflow?: boolean;
|
|
444
453
|
}
|
|
445
454
|
|
|
446
455
|
/**
|
|
@@ -644,7 +653,7 @@ declare enum ChartTypes {
|
|
|
644
653
|
|
|
645
654
|
export declare interface ChildProps {
|
|
646
655
|
xScale?: any;
|
|
647
|
-
|
|
656
|
+
yScalePrimary?: any;
|
|
648
657
|
yScaleSecondary?: any;
|
|
649
658
|
containerHeight?: number;
|
|
650
659
|
containerWidth?: number;
|
|
@@ -1265,6 +1274,11 @@ export declare interface GroupedVerticalBarChartProps extends CartesianChartProp
|
|
|
1265
1274
|
* @default 'default'
|
|
1266
1275
|
*/
|
|
1267
1276
|
mode?: 'default' | 'plotly';
|
|
1277
|
+
/**
|
|
1278
|
+
* @default false
|
|
1279
|
+
* The prop used to enable rounded corners for the chart.
|
|
1280
|
+
*/
|
|
1281
|
+
roundCorners?: boolean;
|
|
1268
1282
|
}
|
|
1269
1283
|
|
|
1270
1284
|
/**
|
|
@@ -1328,6 +1342,11 @@ export declare interface GVBarChartSeriesPoint {
|
|
|
1328
1342
|
* Accessibility data for callout
|
|
1329
1343
|
*/
|
|
1330
1344
|
callOutAccessibilityData?: AccessibilityProps;
|
|
1345
|
+
/**
|
|
1346
|
+
* Whether to use the secondary y scale or not
|
|
1347
|
+
* False by default.
|
|
1348
|
+
*/
|
|
1349
|
+
useSecondaryYScale?: boolean;
|
|
1331
1350
|
}
|
|
1332
1351
|
|
|
1333
1352
|
export declare interface GVDataPoint {
|
|
@@ -2224,6 +2243,11 @@ export declare interface LineChartPoints {
|
|
|
2224
2243
|
* Defines the function that is executed on clicking line
|
|
2225
2244
|
*/
|
|
2226
2245
|
onLineClick?: () => void;
|
|
2246
|
+
/**
|
|
2247
|
+
* Whether to use the secondary y scale or not
|
|
2248
|
+
* False by default.
|
|
2249
|
+
*/
|
|
2250
|
+
useSecondaryYScale?: boolean;
|
|
2227
2251
|
}
|
|
2228
2252
|
|
|
2229
2253
|
/**
|
|
@@ -2477,6 +2501,13 @@ export declare interface ModifiedCartesianChartProps extends CartesianChartProps
|
|
|
2477
2501
|
* Used to control the first render cycle Performance optimization code.
|
|
2478
2502
|
*/
|
|
2479
2503
|
enableFirstRenderOptimization?: boolean;
|
|
2504
|
+
/**
|
|
2505
|
+
* Get the min and max values of the y-axis
|
|
2506
|
+
*/
|
|
2507
|
+
getMinMaxOfYAxis?: (points: DataPoint[], yAxisType: YAxisType | undefined, useSecondaryYScale?: boolean) => {
|
|
2508
|
+
startValue: number;
|
|
2509
|
+
endValue: number;
|
|
2510
|
+
};
|
|
2480
2511
|
}
|
|
2481
2512
|
|
|
2482
2513
|
declare type NodesInColumns = {
|
|
@@ -2536,13 +2567,59 @@ declare interface RenderFunction<P> {
|
|
|
2536
2567
|
(props?: P, defaultRender?: (props?: P) => JSX.Element | null): JSX.Element | null;
|
|
2537
2568
|
}
|
|
2538
2569
|
|
|
2570
|
+
/**
|
|
2571
|
+
* Responsive Child props
|
|
2572
|
+
* {@docCategory ResponsiveContainer}
|
|
2573
|
+
*/
|
|
2574
|
+
export declare interface ResponsiveChildProps {
|
|
2575
|
+
width?: number;
|
|
2576
|
+
height?: number;
|
|
2577
|
+
shouldResize?: number;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
/**
|
|
2581
|
+
* Responsive Container component
|
|
2582
|
+
* {@docCategory ResponsiveContainer}
|
|
2583
|
+
*/
|
|
2539
2584
|
export declare const ResponsiveContainer: React_2.FC<ResponsiveContainerProps>;
|
|
2540
2585
|
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2586
|
+
/**
|
|
2587
|
+
* Responsive Container props
|
|
2588
|
+
* {@docCategory ResponsiveContainer}
|
|
2589
|
+
*/
|
|
2590
|
+
export declare interface ResponsiveContainerProps {
|
|
2591
|
+
/**
|
|
2592
|
+
* Aspect ratio (width / height) of the container. If specified, the height will be calculated by width / aspect.
|
|
2593
|
+
*/
|
|
2594
|
+
aspect?: number;
|
|
2595
|
+
/**
|
|
2596
|
+
* Width of the container
|
|
2597
|
+
*/
|
|
2544
2598
|
width?: number | string;
|
|
2599
|
+
/**
|
|
2600
|
+
* Height of the container
|
|
2601
|
+
*/
|
|
2545
2602
|
height?: number | string;
|
|
2603
|
+
/**
|
|
2604
|
+
* Minimum width of the container
|
|
2605
|
+
*/
|
|
2606
|
+
minWidth?: number | string;
|
|
2607
|
+
/**
|
|
2608
|
+
* Minimum height of the container
|
|
2609
|
+
*/
|
|
2610
|
+
minHeight?: number | string;
|
|
2611
|
+
/**
|
|
2612
|
+
* Maximum height of the container
|
|
2613
|
+
*/
|
|
2614
|
+
maxHeight?: number;
|
|
2615
|
+
/**
|
|
2616
|
+
* Callback providing the updated chart width and height values when the container is resized
|
|
2617
|
+
*/
|
|
2618
|
+
onResize?: (width: number, height: number) => void;
|
|
2619
|
+
/**
|
|
2620
|
+
* Child component to be rendered within the container
|
|
2621
|
+
*/
|
|
2622
|
+
children: React_2.ReactElement<ResponsiveChildProps>;
|
|
2546
2623
|
}
|
|
2547
2624
|
|
|
2548
2625
|
export declare const SankeyChart: React_2.FunctionComponent<SankeyChartProps>;
|
|
@@ -3128,9 +3205,9 @@ export declare interface VerticalStackedBarChartProps extends CartesianChartProp
|
|
|
3128
3205
|
*/
|
|
3129
3206
|
onRenderCalloutPerDataPoint?: RenderFunction<VSChartDataPoint>;
|
|
3130
3207
|
/**
|
|
3131
|
-
* yMinValue is
|
|
3208
|
+
* yMinValue is supported for bar charts that has only lines
|
|
3132
3209
|
*/
|
|
3133
|
-
yMinValue?: undefined;
|
|
3210
|
+
yMinValue?: number | undefined;
|
|
3134
3211
|
/**
|
|
3135
3212
|
* Allow hover actions on the legend
|
|
3136
3213
|
* @default true
|
|
@@ -3289,6 +3366,12 @@ export declare interface VSChartDataPoint {
|
|
|
3289
3366
|
culture?: string;
|
|
3290
3367
|
}
|
|
3291
3368
|
|
|
3369
|
+
/**
|
|
3370
|
+
* An HOC to update wrapped component on container resize.
|
|
3371
|
+
* {@docCategory ResponsiveContainer}
|
|
3372
|
+
*/
|
|
3373
|
+
export declare function withResponsiveContainer<TProps extends Omit<ResponsiveContainerProps, 'children'>>(WrappedComponent: React_2.ComponentType<TProps>): React_2.FC<TProps>;
|
|
3374
|
+
|
|
3292
3375
|
declare enum XAxisTypes {
|
|
3293
3376
|
NumericAxis = 0,
|
|
3294
3377
|
DateAxis = 1,
|
|
@@ -6,7 +6,7 @@ import { select as d3Select } from 'd3-selection';
|
|
|
6
6
|
import { tokens } from '@fluentui/react-theme';
|
|
7
7
|
import { area as d3Area, stack as d3Stack, curveMonotoneX as d3CurveBasis, line as d3Line } from 'd3-shape';
|
|
8
8
|
import { CartesianChart } from '../../index';
|
|
9
|
-
import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, getNextColor, getColorFromToken, formatDate, getSecureProps, areArraysEqual, getCurveFactory, find } from '../../utilities/index';
|
|
9
|
+
import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, getNextColor, getColorFromToken, formatDate, getSecureProps, areArraysEqual, getCurveFactory, find, findNumericMinMaxOfY } from '../../utilities/index';
|
|
10
10
|
import { useId } from '@fluentui/react-utilities';
|
|
11
11
|
import { Legends } from '../Legends/index';
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -29,6 +29,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
29
29
|
const _enableComputationOptimization = true;
|
|
30
30
|
const _firstRenderOptimization = true;
|
|
31
31
|
const _emptyChartId = useId('_AreaChart_empty');
|
|
32
|
+
let _containsSecondaryYAxis = false;
|
|
32
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
34
|
let _calloutPoints;
|
|
34
35
|
let _createSet;
|
|
@@ -199,7 +200,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
199
200
|
var _props_legendProps;
|
|
200
201
|
const renderPoints = [];
|
|
201
202
|
let maxOfYVal = 0;
|
|
202
|
-
if (
|
|
203
|
+
if (_shouldFillToZeroY()) {
|
|
203
204
|
keys.forEach((key, index)=>{
|
|
204
205
|
const currentLayer = [];
|
|
205
206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -236,7 +237,10 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
236
237
|
_isMultiStackChart = !!(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) ? (renderPoints === null || renderPoints === void 0 ? void 0 : renderPoints.length) >= 1 : (renderPoints === null || renderPoints === void 0 ? void 0 : renderPoints.length) > 1);
|
|
237
238
|
return {
|
|
238
239
|
renderData: renderPoints,
|
|
239
|
-
maxOfYVal
|
|
240
|
+
// The maxOfYVal prop is only required for the primary y-axis. When the data includes
|
|
241
|
+
// a secondary y-axis, the mode defaults to tozeroy, so maxOfYVal should be calculated using
|
|
242
|
+
// only the data points associated with the primary y-axis.
|
|
243
|
+
maxOfYVal: _containsSecondaryYAxis ? findNumericMinMaxOfY(props.data.lineChartData).endValue : maxOfYVal
|
|
240
244
|
};
|
|
241
245
|
}
|
|
242
246
|
function _createDataSet(points) {
|
|
@@ -338,8 +342,8 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
338
342
|
}
|
|
339
343
|
function _getGraphData(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
340
344
|
xAxis, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
341
|
-
yAxis, containerHeight, containerWidth, xElement) {
|
|
342
|
-
_chart = _drawGraph(containerHeight, xAxis, yAxis, xElement);
|
|
345
|
+
yAxis, containerHeight, containerWidth, xElement, yAxisElement, yScaleSecondary) {
|
|
346
|
+
_chart = _drawGraph(containerHeight, xAxis, yAxis, yScaleSecondary, xElement);
|
|
343
347
|
}
|
|
344
348
|
function _onLegendHover(legend) {
|
|
345
349
|
setActiveLegend(legend);
|
|
@@ -425,8 +429,8 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
425
429
|
}
|
|
426
430
|
return fillColor;
|
|
427
431
|
}
|
|
428
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
429
|
-
|
|
432
|
+
function _drawGraph(containerHeight, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
+
xScale, yScalePrimary, yScaleSecondary, xElement) {
|
|
430
434
|
const points = _addDefaultColors(props.data.lineChartData);
|
|
431
435
|
const { pointOptions, pointLineOptions } = props.data;
|
|
432
436
|
const graph = [];
|
|
@@ -434,6 +438,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
434
438
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
435
439
|
_data.forEach((singleStackedData, index)=>{
|
|
436
440
|
var _points_index_lineOptions, _points_index_lineOptions1, _points_index_lineOptions2, _points_index_lineOptions3, _points_index_lineOptions4;
|
|
441
|
+
const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
437
442
|
const curveFactory = getCurveFactory((_points_index_lineOptions = points[index].lineOptions) === null || _points_index_lineOptions === void 0 ? void 0 : _points_index_lineOptions.curve, d3CurveBasis);
|
|
438
443
|
const area = d3Area()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
439
444
|
.x((d)=>xScale(d.xVal))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -442,7 +447,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
442
447
|
const line = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
443
448
|
.x((d)=>xScale(d.xVal))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
444
449
|
.y((d)=>yScale(d.values[1])).curve(curveFactory);
|
|
445
|
-
const layerOpacity =
|
|
450
|
+
const layerOpacity = _shouldFillToZeroY() ? 0.8 : _opacity[index];
|
|
446
451
|
var _points_index_lineOptions_strokeWidth;
|
|
447
452
|
graph.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
448
453
|
key: `${index}-graph-${_uniqueIdForGraph}`
|
|
@@ -506,6 +511,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
506
511
|
if (points.length === index) {
|
|
507
512
|
return;
|
|
508
513
|
}
|
|
514
|
+
const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
509
515
|
if (!props.optimizeLargeData || singleStackedData.length === 1) {
|
|
510
516
|
// Render circles for all data points
|
|
511
517
|
graph.push(/*#__PURE__*/ React.createElement("g", {
|
|
@@ -701,9 +707,13 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
701
707
|
const { chartTitle, lineChartData } = props.data;
|
|
702
708
|
return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} data series. `;
|
|
703
709
|
}
|
|
710
|
+
function _shouldFillToZeroY() {
|
|
711
|
+
return props.mode === 'tozeroy' || _containsSecondaryYAxis;
|
|
712
|
+
}
|
|
704
713
|
if (!_isChartEmpty()) {
|
|
705
714
|
const { lineChartData } = props.data;
|
|
706
715
|
const points = _addDefaultColors(lineChartData);
|
|
716
|
+
_containsSecondaryYAxis = !!props.secondaryYScaleOptions && points.some((point)=>point.useSecondaryYScale);
|
|
707
717
|
_createSet = _createDataSet;
|
|
708
718
|
const { colors, opacity, data, calloutPoints } = _createSet(points);
|
|
709
719
|
_calloutPoints = calloutPoints;
|