@automattic/charts 4.7.0 → 4.9.0
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 +30 -0
- package/TOKENS.md +6 -3
- package/dist/index.cjs +834 -321
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +68 -17
- package/dist/index.d.cts +102 -28
- package/dist/index.d.ts +102 -28
- package/dist/index.js +838 -327
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/charts/area-chart/area-chart.tsx +7 -4
- package/src/charts/area-chart/test/area-chart.test.tsx +24 -15
- package/src/charts/area-chart/test/tooltip-resolution-branches.test.tsx +1 -1
- package/src/charts/area-chart/test/tooltip-resolution.test.tsx +2 -2
- package/src/charts/area-chart/types.ts +2 -0
- package/src/charts/bar-chart/bar-chart.module.scss +7 -0
- package/src/charts/bar-chart/bar-chart.tsx +25 -16
- package/src/charts/bar-chart/private/comparison-bars.tsx +1 -0
- package/src/charts/bar-chart/test/bar-chart.test.tsx +106 -62
- package/src/charts/bar-chart/types.ts +2 -0
- package/src/charts/bar-list-chart/test/bar-list-chart.test.tsx +3 -1
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +1 -1
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +9 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +16 -8
- package/src/charts/heatmap-chart/heatmap-chart.tsx +183 -66
- package/src/charts/heatmap-chart/private/column-groups.ts +79 -8
- package/src/charts/heatmap-chart/private/fit-compact-cells.ts +72 -0
- package/src/charts/heatmap-chart/private/heatmap-context.ts +2 -2
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +15 -3
- package/src/charts/heatmap-chart/private/heatmap-scale.ts +74 -0
- package/src/charts/heatmap-chart/private/index.ts +6 -3
- package/src/charts/heatmap-chart/private/use-heatmap-colors.ts +24 -6
- package/src/charts/heatmap-chart/test/column-groups.test.ts +41 -4
- package/src/charts/heatmap-chart/test/fit-compact-cells.test.ts +59 -0
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +231 -8
- package/src/charts/heatmap-chart/test/heatmap-scale.test.ts +78 -0
- package/src/charts/heatmap-chart/test/use-heatmap-colors.test.ts +18 -6
- package/src/charts/heatmap-chart/types.ts +6 -3
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +46 -4
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +37 -1
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +53 -0
- package/src/charts/leaderboard-chart/types.ts +6 -1
- package/src/charts/line-chart/line-chart.tsx +7 -4
- package/src/charts/line-chart/private/line-chart-annotation-label-popover.tsx +19 -9
- package/src/charts/line-chart/test/default-tooltip-formatting.test.tsx +1 -1
- package/src/charts/line-chart/test/line-chart.test.tsx +45 -35
- package/src/charts/line-chart/test/tooltip-resolution.test.tsx +2 -2
- package/src/charts/line-chart/types.ts +5 -3
- package/src/charts/pie-chart/pie-chart.tsx +153 -143
- package/src/charts/pie-chart/test/pie-chart.test.tsx +171 -0
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +126 -124
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +55 -1
- package/src/charts/private/chart-composition/use-chart-children.ts +11 -6
- package/src/charts/private/pie-keyboard-navigation/index.ts +4 -0
- package/src/charts/private/pie-keyboard-navigation/order-arcs-for-navigation.ts +10 -0
- package/src/charts/private/pie-keyboard-navigation/pie-keyboard-navigation.module.scss +16 -0
- package/src/charts/private/pie-keyboard-navigation/pie-selection-announcement.tsx +14 -0
- package/src/charts/private/pie-keyboard-navigation/pie-selection-output.tsx +82 -0
- package/src/charts/private/pie-keyboard-navigation/pie-tooltip.tsx +44 -0
- package/src/charts/private/pie-keyboard-navigation/selected-segment-ring.tsx +47 -0
- package/src/charts/private/pie-keyboard-navigation/test/order-arcs-for-navigation.test.ts +34 -0
- package/src/charts/private/pie-keyboard-navigation/test/selected-segment-ring.test.ts +14 -0
- package/src/charts/private/pie-keyboard-navigation/use-pie-keyboard-navigation.ts +139 -0
- package/src/charts/private/test/label-text-color.test.ts +6 -8
- package/src/charts/private/x-zoom/test/x-zoom.test.tsx +3 -2
- package/src/components/tooltip/base-tooltip.tsx +31 -32
- package/src/components/tooltip/index.ts +3 -1
- package/src/components/tooltip/private/bounded-tooltip.tsx +15 -15
- package/src/components/tooltip/private/label-value-content.tsx +8 -0
- package/src/components/tooltip/private/xy-chart-tooltip-overlay.tsx +336 -0
- package/src/components/tooltip/test/tool-tip.test.tsx +8 -6
- package/src/components/tooltip/test/tooltip-box.test.tsx +53 -0
- package/src/components/tooltip/test/xy-chart-tooltip-overlay.test.tsx +445 -0
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +283 -365
- package/src/components/tooltip/{base-tooltip.module.scss → tooltip-box.module.scss} +5 -8
- package/src/components/tooltip/tooltip-box.tsx +43 -0
- package/src/components/tooltip/types.ts +7 -1
- package/src/components/tooltip/xy-chart-tooltip.tsx +410 -300
- package/src/hooks/test/use-chart-margin.test.tsx +8 -4
- package/src/hooks/use-chart-margin.tsx +21 -18
- package/src/index.ts +8 -3
- package/src/providers/chart-context/global-charts-provider.tsx +5 -14
- package/src/providers/chart-context/hooks/use-default-hidden-series.ts +1 -1
- package/src/providers/chart-context/private/catalog-pointers.ts +1 -0
- package/src/providers/chart-context/private/resolve-opaque-hex.ts +16 -0
- package/src/providers/chart-context/test/use-default-hidden-series.test.tsx +1 -1
- package/src/styles/chart-scope.scss +1 -0
- package/src/test-utils/zoned-parsing-suite.ts +0 -10
- package/src/types.ts +18 -2
- package/src/utils/test/date-formatting.test.ts +0 -10
- package/src/components/tooltip/accessible-tooltip.tsx +0 -433
- package/src/components/tooltip/test/accessible-tooltip.test.tsx +0 -331
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useCallback,
|
|
13
13
|
} from 'react';
|
|
14
14
|
import { Legend, useChartLegendItems } from '../../components/legend';
|
|
15
|
-
import {
|
|
15
|
+
import { XYChartTooltip, useKeyboardNavigation } from '../../components/tooltip';
|
|
16
16
|
import {
|
|
17
17
|
useXYChartTheme,
|
|
18
18
|
useChartDataTransform,
|
|
@@ -52,6 +52,7 @@ const AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(
|
|
|
52
52
|
(
|
|
53
53
|
{
|
|
54
54
|
data,
|
|
55
|
+
ariaLabel,
|
|
55
56
|
chartId: providedChartId,
|
|
56
57
|
width,
|
|
57
58
|
height,
|
|
@@ -421,10 +422,11 @@ const AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(
|
|
|
421
422
|
const chartHeight = contentHeight > 0 ? contentHeight : height;
|
|
422
423
|
|
|
423
424
|
return (
|
|
425
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- the application role hands arrow keys to the chart's point navigation.
|
|
424
426
|
<div
|
|
425
427
|
ref={ chartRef }
|
|
426
|
-
role="
|
|
427
|
-
aria-label={ __( 'Area chart', 'jetpack-charts' ) }
|
|
428
|
+
role="application"
|
|
429
|
+
aria-label={ ariaLabel ?? __( 'Area chart', 'jetpack-charts' ) }
|
|
428
430
|
tabIndex={ 0 }
|
|
429
431
|
onKeyDown={ onChartKeyDown }
|
|
430
432
|
onFocus={ onChartFocus }
|
|
@@ -434,6 +436,7 @@ const AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(
|
|
|
434
436
|
<div className={ plotStyles[ 'xy-plot' ] }>
|
|
435
437
|
{ zoomable && zoom.domain && <ZoomResetButton onClick={ zoom.reset } /> }
|
|
436
438
|
<XYChart
|
|
439
|
+
accessibilityLabel=""
|
|
437
440
|
theme={ theme }
|
|
438
441
|
width={ width }
|
|
439
442
|
height={ chartHeight }
|
|
@@ -509,7 +512,7 @@ const AreaChartInternal = forwardRef< ChartInstanceRef, AreaChartProps >(
|
|
|
509
512
|
|
|
510
513
|
{ withTooltips && (
|
|
511
514
|
<>
|
|
512
|
-
<
|
|
515
|
+
<XYChartTooltip
|
|
513
516
|
detectBounds
|
|
514
517
|
snapTooltipToDatumX
|
|
515
518
|
// Stacked mode: yAccessor returns raw value, not stacked y — snapping mispositions.
|
|
@@ -53,13 +53,13 @@ describe( 'AreaChart', () => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
test.each( [ [ 'Escape', '{Escape}' ] ] )(
|
|
56
|
-
'returns focus to the
|
|
56
|
+
'returns focus to the chart after %s',
|
|
57
57
|
async ( _name, keys ) => {
|
|
58
58
|
jest.useFakeTimers();
|
|
59
59
|
try {
|
|
60
60
|
const user = userEvent.setup( { advanceTimers: jest.advanceTimersByTime } );
|
|
61
61
|
renderWithProvider();
|
|
62
|
-
const chart = screen.getByRole( '
|
|
62
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
63
63
|
|
|
64
64
|
await user.tab();
|
|
65
65
|
expect( chart ).toHaveFocus();
|
|
@@ -139,7 +139,7 @@ describe( 'AreaChart', () => {
|
|
|
139
139
|
|
|
140
140
|
test( 'renders with valid data', () => {
|
|
141
141
|
renderWithProvider();
|
|
142
|
-
expect( screen.getByRole( '
|
|
142
|
+
expect( screen.getByRole( 'application', { name: /area chart/i } ) ).toBeInTheDocument();
|
|
143
143
|
} );
|
|
144
144
|
} );
|
|
145
145
|
|
|
@@ -203,7 +203,7 @@ describe( 'AreaChart', () => {
|
|
|
203
203
|
],
|
|
204
204
|
} );
|
|
205
205
|
|
|
206
|
-
const chart = screen.getByRole( '
|
|
206
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
207
207
|
const ticks = within( chart )
|
|
208
208
|
.getAllByText( /^-?[\d.,]+$/ )
|
|
209
209
|
.map( el => el.textContent );
|
|
@@ -228,7 +228,7 @@ describe( 'AreaChart', () => {
|
|
|
228
228
|
},
|
|
229
229
|
} );
|
|
230
230
|
|
|
231
|
-
const chart = screen.getByRole( '
|
|
231
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
232
232
|
expect( within( chart ).getAllByText( /^\d+%$/ ) ).toHaveLength( 6 );
|
|
233
233
|
} );
|
|
234
234
|
|
|
@@ -254,7 +254,7 @@ describe( 'AreaChart', () => {
|
|
|
254
254
|
],
|
|
255
255
|
} );
|
|
256
256
|
|
|
257
|
-
const chart = screen.getByRole( '
|
|
257
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
258
258
|
expect( within( chart ).getAllByText( /^-?[\d.,]+$/ ).length ).toBeGreaterThan( 2 );
|
|
259
259
|
} );
|
|
260
260
|
} );
|
|
@@ -275,7 +275,7 @@ describe( 'AreaChart', () => {
|
|
|
275
275
|
|
|
276
276
|
test( 'accepts custom stackOffset', () => {
|
|
277
277
|
renderWithProvider( { stackOffset: 'expand' } );
|
|
278
|
-
expect( screen.getByRole( '
|
|
278
|
+
expect( screen.getByRole( 'application', { name: /area chart/i } ) ).toBeInTheDocument();
|
|
279
279
|
} );
|
|
280
280
|
} );
|
|
281
281
|
|
|
@@ -344,7 +344,7 @@ describe( 'AreaChart', () => {
|
|
|
344
344
|
|
|
345
345
|
// Open a tooltip via keyboard navigation, then verify the hidden
|
|
346
346
|
// series' label is absent from the rendered tooltip rows.
|
|
347
|
-
const chart = screen.getByRole( '
|
|
347
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
348
348
|
chart.focus();
|
|
349
349
|
await user.keyboard( '{ArrowRight}' );
|
|
350
350
|
|
|
@@ -364,7 +364,7 @@ describe( 'AreaChart', () => {
|
|
|
364
364
|
} );
|
|
365
365
|
|
|
366
366
|
await user.click( screen.getByText( 'Series A' ) );
|
|
367
|
-
const chart = screen.getByRole( '
|
|
367
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
368
368
|
chart.focus();
|
|
369
369
|
await user.keyboard( '{ArrowRight}' );
|
|
370
370
|
|
|
@@ -762,7 +762,7 @@ describe( 'AreaChart', () => {
|
|
|
762
762
|
context?.toggleSeriesVisibility( chartId, 'Series A' );
|
|
763
763
|
} );
|
|
764
764
|
|
|
765
|
-
const chart = screen.getByRole( '
|
|
765
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
766
766
|
chart.focus();
|
|
767
767
|
await user.keyboard( '{ArrowRight}' );
|
|
768
768
|
|
|
@@ -775,17 +775,26 @@ describe( 'AreaChart', () => {
|
|
|
775
775
|
describe( 'Without GlobalChartsProvider', () => {
|
|
776
776
|
test( 'self-wraps in a provider when none is present', () => {
|
|
777
777
|
render( <AreaChartUnresponsive { ...defaultProps } /> );
|
|
778
|
-
expect( screen.getByRole( '
|
|
778
|
+
expect( screen.getByRole( 'application', { name: /area chart/i } ) ).toBeInTheDocument();
|
|
779
779
|
} );
|
|
780
780
|
} );
|
|
781
781
|
|
|
782
782
|
describe( 'Accessibility', () => {
|
|
783
783
|
test( 'chart container has expected ARIA attributes', () => {
|
|
784
784
|
renderWithProvider();
|
|
785
|
-
const chart = screen.getByRole( '
|
|
785
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
786
786
|
expect( chart ).toHaveAttribute( 'tabIndex', '0' );
|
|
787
787
|
expect( chart ).toHaveAttribute( 'aria-label', 'Area chart' );
|
|
788
788
|
} );
|
|
789
|
+
|
|
790
|
+
test.each( [
|
|
791
|
+
[ undefined, 'Area chart' ],
|
|
792
|
+
[ 'Views over time', 'Views over time' ],
|
|
793
|
+
] )( 'names the chart container from ariaLabel %p', ( ariaLabel, name ) => {
|
|
794
|
+
renderWithProvider( { ariaLabel } );
|
|
795
|
+
expect( screen.getByRole( 'application', { name } ) ).toBeInTheDocument();
|
|
796
|
+
expect( screen.queryByLabelText( 'XYChart' ) ).not.toBeInTheDocument();
|
|
797
|
+
} );
|
|
789
798
|
} );
|
|
790
799
|
|
|
791
800
|
describe( 'Chart Ref Interface', () => {
|
|
@@ -817,12 +826,12 @@ describe( 'AreaChart', () => {
|
|
|
817
826
|
} );
|
|
818
827
|
|
|
819
828
|
describe( 'Hover glyphs', () => {
|
|
820
|
-
// Trigger the
|
|
829
|
+
// Trigger the XYChartTooltip's keyboard nav so a tooltip is opened
|
|
821
830
|
// against a known datum index, which is the only reliable way to
|
|
822
831
|
// surface the visx TooltipContext state in a jsdom environment.
|
|
823
832
|
const focusFirstDatum = async () => {
|
|
824
833
|
const user = userEvent.setup();
|
|
825
|
-
const chart = screen.getByRole( '
|
|
834
|
+
const chart = screen.getByRole( 'application', { name: /area chart/i } );
|
|
826
835
|
chart.focus();
|
|
827
836
|
await user.keyboard( '{ArrowRight}' );
|
|
828
837
|
};
|
|
@@ -972,7 +981,7 @@ describe( 'AreaChart', () => {
|
|
|
972
981
|
|
|
973
982
|
// The visx grid has no role/testid, so query its internal class from within the plot.
|
|
974
983
|
/* eslint-disable testing-library/no-node-access */
|
|
975
|
-
const plot = screen.getByRole( '
|
|
984
|
+
const plot = screen.getByRole( 'application' );
|
|
976
985
|
expect( plot.querySelector( '.visx-rows' ) ).toBeInTheDocument();
|
|
977
986
|
|
|
978
987
|
const buttons = screen.getAllByRole( 'button' );
|
|
@@ -19,7 +19,7 @@ type CapturedRenderTooltip = ( params: RenderTooltipParams< DataPointDate > ) =>
|
|
|
19
19
|
let capturedRenderTooltip: CapturedRenderTooltip | undefined;
|
|
20
20
|
jest.mock( '../../../components/tooltip', () => ( {
|
|
21
21
|
...jest.requireActual( '../../../components/tooltip' ),
|
|
22
|
-
|
|
22
|
+
XYChartTooltip: ( props: { renderTooltip?: CapturedRenderTooltip } ) => {
|
|
23
23
|
capturedRenderTooltip = props.renderTooltip;
|
|
24
24
|
return null;
|
|
25
25
|
},
|
|
@@ -28,7 +28,7 @@ describe( 'area chart tooltip bucket info', () => {
|
|
|
28
28
|
</GlobalChartsProvider>
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
screen.getByRole( '
|
|
31
|
+
screen.getByRole( 'application', { name: /area chart/i } ).focus();
|
|
32
32
|
await user.keyboard( '{ArrowRight}' );
|
|
33
33
|
|
|
34
34
|
expect( screen.getByTestId( 'chart-tooltip-0' ) ).toHaveTextContent( '2.8.2026, 09 Uhr' );
|
|
@@ -61,7 +61,7 @@ describe( 'area chart tooltip bucket info', () => {
|
|
|
61
61
|
</GlobalChartsProvider>
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
screen.getByRole( '
|
|
64
|
+
screen.getByRole( 'application', { name: /area chart/i } ).focus();
|
|
65
65
|
await user.keyboard( '{ArrowRight}' );
|
|
66
66
|
|
|
67
67
|
expect( screen.getByTestId( 'chart-tooltip-0' ) ).not.toHaveTextContent( 'Uhr' );
|
|
@@ -11,6 +11,8 @@ import type { CurveType } from '../line-chart/types';
|
|
|
11
11
|
import type { ReactNode } from 'react';
|
|
12
12
|
|
|
13
13
|
export interface AreaChartProps extends BaseChartProps< SeriesData[] >, SeriesVisibilityProps {
|
|
14
|
+
/** Accessible name of the chart. Defaults to a localized "Area chart". */
|
|
15
|
+
ariaLabel?: string;
|
|
14
16
|
/**
|
|
15
17
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
16
18
|
*/
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
overflow: visible;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
// The CSS property, not the attribute: an SVG geometry attribute does
|
|
8
|
+
// not substitute var().
|
|
9
|
+
:global(.visx-bar),
|
|
10
|
+
:global(.bar-chart__comparison-bar) {
|
|
11
|
+
rx: var(--a8c-charts-border-radius-bar-chart);
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
// Keep the collapsed state in `from` and never on the element: a dropped
|
|
8
15
|
// animation then fails visible. `both`, not `forwards`, for backwards fill.
|
|
9
16
|
&--animated rect {
|
|
@@ -4,7 +4,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useCallback, useContext, useState, useRef, useMemo } from 'react';
|
|
6
6
|
import { Legend, useChartLegendItems } from '../../components/legend';
|
|
7
|
-
import {
|
|
7
|
+
import { XYChartTooltip, useKeyboardNavigation } from '../../components/tooltip';
|
|
8
8
|
import {
|
|
9
9
|
useXYChartTheme,
|
|
10
10
|
useChartDataTransform,
|
|
@@ -100,6 +100,7 @@ const renderTooltipRow = ( label: string | undefined, value: string ) => (
|
|
|
100
100
|
|
|
101
101
|
const BarChartInternal: FC< BarChartProps > = ( {
|
|
102
102
|
data,
|
|
103
|
+
ariaLabel,
|
|
103
104
|
chartId: providedChartId,
|
|
104
105
|
width,
|
|
105
106
|
height,
|
|
@@ -242,7 +243,7 @@ const BarChartInternal: FC< BarChartProps > = ( {
|
|
|
242
243
|
);
|
|
243
244
|
|
|
244
245
|
// The keyboard-navigation index space and the highlight CSS both stride over primary
|
|
245
|
-
// bars only;
|
|
246
|
+
// bars only; `XYChartTooltip` must use the same list, or its datum diverges from
|
|
246
247
|
// the highlighted bar once a comparison series shifts the indices.
|
|
247
248
|
const primarySeries = useMemo(
|
|
248
249
|
() => primaryEntries.map( ( { series } ) => series ),
|
|
@@ -474,7 +475,7 @@ const BarChartInternal: FC< BarChartProps > = ( {
|
|
|
474
475
|
// so a patterned shadow gets the same outline as its primary bar.
|
|
475
476
|
return `
|
|
476
477
|
.visx-bar[fill="url(#${ patternId })"],
|
|
477
|
-
.bar-chart__comparison-
|
|
478
|
+
.bar-chart__comparison-bar[fill="url(#${ patternId })"] {
|
|
478
479
|
stroke: ${ color };
|
|
479
480
|
stroke-width: 1;
|
|
480
481
|
}
|
|
@@ -603,10 +604,11 @@ const BarChartInternal: FC< BarChartProps > = ( {
|
|
|
603
604
|
const chartHeight = contentHeight > 0 ? contentHeight : height;
|
|
604
605
|
|
|
605
606
|
return (
|
|
607
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- the application role hands arrow keys to the chart's point navigation.
|
|
606
608
|
<div
|
|
607
|
-
role="
|
|
609
|
+
role="application"
|
|
608
610
|
ref={ chartRef }
|
|
609
|
-
aria-label={ __( 'Bar chart', 'jetpack-charts' ) }
|
|
611
|
+
aria-label={ ariaLabel ?? __( 'Bar chart', 'jetpack-charts' ) }
|
|
610
612
|
tabIndex={ 0 }
|
|
611
613
|
onKeyDown={ onChartKeyDown }
|
|
612
614
|
onFocus={ onChartFocus }
|
|
@@ -615,6 +617,7 @@ const BarChartInternal: FC< BarChartProps > = ( {
|
|
|
615
617
|
{ chartHeight > 0 && (
|
|
616
618
|
<div className={ plotStyles[ 'xy-plot' ] }>
|
|
617
619
|
<XYChart
|
|
620
|
+
accessibilityLabel=""
|
|
618
621
|
theme={ theme }
|
|
619
622
|
width={ width }
|
|
620
623
|
height={ chartHeight }
|
|
@@ -767,23 +770,29 @@ const BarChartInternal: FC< BarChartProps > = ( {
|
|
|
767
770
|
<WholeNumberTicks { ...wholeNumberTicksProps }>
|
|
768
771
|
{ valueTicks => (
|
|
769
772
|
<>
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
773
|
+
{ chartOptions.axis.x.display !== false && (
|
|
774
|
+
<Axis
|
|
775
|
+
{ ...chartOptions.axis.x }
|
|
776
|
+
{ ...( horizontal && valueTicks
|
|
777
|
+
? { tickValues: valueTicks }
|
|
778
|
+
: {} ) }
|
|
779
|
+
/>
|
|
780
|
+
) }
|
|
781
|
+
{ chartOptions.axis.y.display !== false && (
|
|
782
|
+
<Axis
|
|
783
|
+
{ ...chartOptions.axis.y }
|
|
784
|
+
{ ...( ! horizontal && valueTicks
|
|
785
|
+
? { tickValues: valueTicks }
|
|
786
|
+
: {} ) }
|
|
787
|
+
/>
|
|
788
|
+
) }
|
|
780
789
|
</>
|
|
781
790
|
) }
|
|
782
791
|
</WholeNumberTicks>
|
|
783
792
|
) }
|
|
784
793
|
|
|
785
794
|
{ withTooltips && (
|
|
786
|
-
<
|
|
795
|
+
<XYChartTooltip
|
|
787
796
|
tooltipPlacement={ tooltipPlacement }
|
|
788
797
|
tooltipAnchorTop={ tooltipAnchorTop }
|
|
789
798
|
style={ tooltipStyle }
|