@react-magma/charts 13.2.1-next.0 → 13.3.0-next.1

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.
@@ -61,6 +61,21 @@ export interface ChartToolbarConfig {
61
61
  * @default 2
62
62
  */
63
63
  titleLevel?: 1 | 2 | 3 | 4 | 5 | 6;
64
+ /**
65
+ * Custom content rendered before the chart title.
66
+ *
67
+ * The content is placed inline in the title row and follows the same
68
+ * accessibility rules as `titleSuffix`.
69
+ */
70
+ titlePrefix?: React.ReactNode;
71
+ /**
72
+ * Custom content rendered after the chart title and before toolbar actions.
73
+ *
74
+ * The content is placed inline in the title row and renders outside the
75
+ * heading element to preserve `options.title` as the heading's accessible name.
76
+ * Useful for patterns like Tooltip + IconButton.
77
+ */
78
+ titleSuffix?: React.ReactNode;
64
79
  }
65
80
  export interface CarbonChartProps extends React.HTMLAttributes<HTMLDivElement> {
66
81
  dataSet: Array<Object>;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { CarbonChartProps, CarbonChartType } from '../CarbonChart';
2
3
  declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/types-6-0").ReactFramework, import("@storybook/react/types-6-0").Args>;
3
4
  export default _default;
@@ -114,3 +115,46 @@ export declare const TableOnly: {
114
115
  };
115
116
  };
116
117
  };
118
+ declare const slotContent: {
119
+ tooltip: React.JSX.Element;
120
+ badge: React.JSX.Element;
121
+ none: undefined;
122
+ };
123
+ interface TitleSlotsArgs extends Omit<CarbonChartProps, 'options'> {
124
+ content: keyof typeof slotContent;
125
+ slotPosition: 'titleSuffix' | 'titlePrefix';
126
+ title: string;
127
+ }
128
+ export declare const TitleSlots: {
129
+ render: ({ content, slotPosition, title, ...args }: TitleSlotsArgs) => React.JSX.Element;
130
+ argTypes: {
131
+ content: {
132
+ control: {
133
+ type: string;
134
+ };
135
+ options: string[];
136
+ };
137
+ slotPosition: {
138
+ control: {
139
+ type: string;
140
+ };
141
+ options: string[];
142
+ };
143
+ title: {
144
+ control: {
145
+ type: string;
146
+ };
147
+ };
148
+ };
149
+ args: {
150
+ content: string;
151
+ isInverse: boolean;
152
+ slotPosition: string;
153
+ title: string;
154
+ type: CarbonChartType;
155
+ dataSet: {
156
+ group: string;
157
+ value: number;
158
+ }[];
159
+ };
160
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-magma/charts",
3
- "version": "13.2.1-next.0",
3
+ "version": "13.3.0-next.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,12 +2,14 @@ import React from 'react';
2
2
 
3
3
  import { act, render, screen, fireEvent } from '@testing-library/react';
4
4
  import userEvent from '@testing-library/user-event';
5
+ import { axe } from 'jest-axe';
5
6
  import {
6
7
  ThemeContext,
7
8
  magma,
8
9
  DropdownMenuItem,
9
10
  I18nContext,
10
11
  defaultI18n,
12
+ useIsInverse,
11
13
  } from 'react-magma-dom';
12
14
 
13
15
  import { CarbonChart, CarbonChartType } from '.';
@@ -1092,6 +1094,148 @@ describe('CarbonChart', () => {
1092
1094
  });
1093
1095
  });
1094
1096
 
1097
+ describe('custom content slots', () => {
1098
+ const toolbarProps = {
1099
+ dataSet,
1100
+ options: chartOptions,
1101
+ type: CarbonChartType.bar,
1102
+ chartToolbar: {},
1103
+ };
1104
+
1105
+ it('should render titlePrefix and titleSuffix around the title', () => {
1106
+ render(
1107
+ <CarbonChart
1108
+ {...toolbarProps}
1109
+ chartToolbar={{
1110
+ titlePrefix: <span data-testid="before">Badge</span>,
1111
+ titleSuffix: <button type="button">About this chart</button>,
1112
+ }}
1113
+ />
1114
+ );
1115
+
1116
+ const before = screen.getByTestId('before');
1117
+ const heading = screen.getByRole('heading', {
1118
+ level: 2,
1119
+ name: chartOptions.title,
1120
+ });
1121
+ const after = screen.getByRole('button', { name: 'About this chart' });
1122
+
1123
+ expect(
1124
+ before.compareDocumentPosition(heading) &
1125
+ Node.DOCUMENT_POSITION_FOLLOWING
1126
+ ).toBeTruthy();
1127
+ expect(
1128
+ heading.compareDocumentPosition(after) &
1129
+ Node.DOCUMENT_POSITION_FOLLOWING
1130
+ ).toBeTruthy();
1131
+ });
1132
+
1133
+ it('should place title slots before the toolbar actions in focus order', () => {
1134
+ render(
1135
+ <CarbonChart
1136
+ {...toolbarProps}
1137
+ chartToolbar={{
1138
+ titleSuffix: <button type="button">About this chart</button>,
1139
+ }}
1140
+ />
1141
+ );
1142
+
1143
+ const after = screen.getByRole('button', { name: 'About this chart' });
1144
+ const tableButton = screen.getByRole('button', {
1145
+ name: chartOptions.title,
1146
+ });
1147
+
1148
+ expect(
1149
+ after.compareDocumentPosition(tableButton) &
1150
+ Node.DOCUMENT_POSITION_FOLLOWING
1151
+ ).toBeTruthy();
1152
+ });
1153
+
1154
+ it('should keep the title as the accessible name when titleSuffix is used', () => {
1155
+ render(
1156
+ <CarbonChart
1157
+ {...toolbarProps}
1158
+ chartToolbar={{
1159
+ titleSuffix: <button type="button">About this chart</button>,
1160
+ }}
1161
+ />
1162
+ );
1163
+
1164
+ // The heading, the chart region and the table modal must all stay
1165
+ // anchored to options.title, which is also the exported file name.
1166
+ expect(
1167
+ screen.getByRole('heading', { level: 2, name: chartOptions.title })
1168
+ ).toBeInTheDocument();
1169
+ expect(
1170
+ screen.getByRole('region', { name: chartOptions.title })
1171
+ ).toBeInTheDocument();
1172
+
1173
+ fireEvent.click(screen.getByRole('button', { name: chartOptions.title }));
1174
+
1175
+ expect(
1176
+ screen.getByRole('heading', {
1177
+ level: 2,
1178
+ name: `Tabular representation ${chartOptions.title}`,
1179
+ })
1180
+ ).toBeInTheDocument();
1181
+ });
1182
+
1183
+ it('should render no slot markup by default', () => {
1184
+ render(<CarbonChart {...toolbarProps} />);
1185
+
1186
+ expect(screen.queryByTestId('before')).not.toBeInTheDocument();
1187
+ expect(
1188
+ screen.getByRole('heading', { level: 2, name: chartOptions.title })
1189
+ ).toBeInTheDocument();
1190
+ });
1191
+
1192
+ it('should expose the resolved inverse value to slot content', () => {
1193
+ // Slot content is the adopter's, so it reads isInverse from context
1194
+ // rather than from our prop.
1195
+ function InverseProbe() {
1196
+ return <span>{useIsInverse() ? 'inverse' : 'default'}</span>;
1197
+ }
1198
+
1199
+ render(
1200
+ <CarbonChart
1201
+ {...toolbarProps}
1202
+ isInverse
1203
+ chartToolbar={{
1204
+ titlePrefix: <InverseProbe />,
1205
+ titleSuffix: <InverseProbe />,
1206
+ }}
1207
+ />
1208
+ );
1209
+
1210
+ expect(screen.getAllByText('inverse')).toHaveLength(2);
1211
+ });
1212
+
1213
+ it('should not introduce accessibility violations with both slots', async () => {
1214
+ const { container } = render(
1215
+ <CarbonChart
1216
+ {...toolbarProps}
1217
+ chartToolbar={{
1218
+ titlePrefix: <span>Badge</span>,
1219
+ titleSuffix: <button type="button">About this chart</button>,
1220
+ }}
1221
+ />
1222
+ );
1223
+
1224
+ // aria-tooltip-name, aria-allowed-attr, and aria-roles come from
1225
+ // Carbon's own SVG output and are present on a chart with no slots at all,
1226
+ // so they are excluded here rather than being attributed to the slots.
1227
+ const results = await axe(container, {
1228
+ rules: {
1229
+ 'aria-tooltip-name': { enabled: false },
1230
+ 'aria-allowed-attr': { enabled: false },
1231
+ 'aria-roles': { enabled: false },
1232
+ },
1233
+ });
1234
+
1235
+ expect(results).toHaveNoViolations();
1236
+ });
1237
+ });
1238
+
1095
1239
  describe('Legend accessibility wrap', () => {
1096
1240
  const testId = 'legend-a11y';
1097
1241
 
@@ -28,6 +28,7 @@ import {
28
28
  Announce,
29
29
  DropdownDivider,
30
30
  DropdownMenuItem,
31
+ InverseContext,
31
32
  ThemeInterface,
32
33
  ThemeContext,
33
34
  useDeviceDetect,
@@ -112,6 +113,22 @@ export interface ChartToolbarConfig {
112
113
  * @default 2
113
114
  */
114
115
  titleLevel?: 1 | 2 | 3 | 4 | 5 | 6;
116
+ /**
117
+ * Custom content rendered before the chart title.
118
+ *
119
+ * The content is placed inline in the title row and follows the same
120
+ * accessibility rules as `titleSuffix`.
121
+ */
122
+ titlePrefix?: React.ReactNode;
123
+
124
+ /**
125
+ * Custom content rendered after the chart title and before toolbar actions.
126
+ *
127
+ * The content is placed inline in the title row and renders outside the
128
+ * heading element to preserve `options.title` as the heading's accessible name.
129
+ * Useful for patterns like Tooltip + IconButton.
130
+ */
131
+ titleSuffix?: React.ReactNode;
115
132
  }
116
133
 
117
134
  export interface CarbonChartProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -729,6 +746,18 @@ const ChartTitle = styled.h2<{
729
746
  : props.theme.colors.neutral700} !important;
730
747
  `;
731
748
 
749
+ const TitleGroup = styled.div<{ theme: ThemeInterface }>`
750
+ align-items: center;
751
+ display: flex;
752
+ gap: ${props => props.theme.spaceScale.spacing02};
753
+ min-width: 0;
754
+ `;
755
+
756
+ const TitleSlot = styled.div`
757
+ align-items: center;
758
+ display: flex;
759
+ `;
760
+
732
761
  const ToolbarActions = styled.div<{ theme: ThemeInterface }>`
733
762
  align-items: center;
734
763
  display: flex;
@@ -1069,13 +1098,21 @@ function CarbonChartToolbar({
1069
1098
  isInverse={isInverse}
1070
1099
  theme={theme}
1071
1100
  >
1072
- <ChartTitle
1073
- as={`h${config.titleLevel ?? 2}` as keyof JSX.IntrinsicElements}
1074
- isInverse={isInverse}
1075
- theme={theme}
1076
- >
1077
- {resolvedTitle}
1078
- </ChartTitle>
1101
+ <TitleGroup theme={theme}>
1102
+ {config.titlePrefix ? (
1103
+ <TitleSlot>{config.titlePrefix}</TitleSlot>
1104
+ ) : null}
1105
+ <ChartTitle
1106
+ as={`h${config.titleLevel ?? 2}` as keyof JSX.IntrinsicElements}
1107
+ isInverse={isInverse}
1108
+ theme={theme}
1109
+ >
1110
+ {resolvedTitle}
1111
+ </ChartTitle>
1112
+ {config.titleSuffix ? (
1113
+ <TitleSlot>{config.titleSuffix}</TitleSlot>
1114
+ ) : null}
1115
+ </TitleGroup>
1079
1116
  <ToolbarActions theme={theme}>
1080
1117
  {showTable && (
1081
1118
  <ChartTableButton
@@ -1611,18 +1648,26 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1611
1648
  >
1612
1649
  <ChartContentWrapper>
1613
1650
  {chartToolbar && (
1614
- <CarbonChartToolbar
1615
- config={chartToolbar}
1616
- dataSet={dataSet as Array<Record<string, unknown>>}
1617
- isInverse={isInverse}
1618
- isTableOpen={isTableOpen}
1619
- isFullscreen={isFullscreen}
1620
- onOpenTable={openTableModal}
1621
- onToggleFullscreen={toggleFullscreen}
1622
- theme={theme}
1623
- title={chartTitle}
1624
- wrapperRef={internalRef}
1625
- />
1651
+ /*
1652
+ * Slot content comes from the adopter, so it resolves
1653
+ * `isInverse` from context rather than from our prop. Without
1654
+ * this provider a Magma component in a title slot would stay
1655
+ * light on an inverse chart.
1656
+ */
1657
+ <InverseContext.Provider value={{ isInverse }}>
1658
+ <CarbonChartToolbar
1659
+ config={chartToolbar}
1660
+ dataSet={dataSet as Array<Record<string, unknown>>}
1661
+ isInverse={isInverse}
1662
+ isTableOpen={isTableOpen}
1663
+ isFullscreen={isFullscreen}
1664
+ onOpenTable={openTableModal}
1665
+ onToggleFullscreen={toggleFullscreen}
1666
+ theme={theme}
1667
+ title={chartTitle}
1668
+ wrapperRef={internalRef}
1669
+ />
1670
+ </InverseContext.Provider>
1626
1671
  )}
1627
1672
  <ChartType data={dataSet} options={newOptions} />
1628
1673
  </ChartContentWrapper>
@@ -475,93 +475,95 @@ html[data-carbon-theme='g10'] {
475
475
  --cds-fluid-display-04-line-height: 1.19;
476
476
  --cds-fluid-display-04-letter-spacing: 0;
477
477
  }
478
- .carbon-chart-wrapper a,
479
- .carbon-chart-wrapper abbr,
480
- .carbon-chart-wrapper acronym,
481
- .carbon-chart-wrapper address,
482
- .carbon-chart-wrapper applet,
483
- .carbon-chart-wrapper article,
484
- .carbon-chart-wrapper aside,
485
- .carbon-chart-wrapper audio,
486
- .carbon-chart-wrapper b,
487
- .carbon-chart-wrapper big,
488
- .carbon-chart-wrapper blockquote,
489
- .carbon-chart-wrapper body,
490
- .carbon-chart-wrapper canvas,
491
- .carbon-chart-wrapper caption,
492
- .carbon-chart-wrapper center,
493
- .carbon-chart-wrapper cite,
494
- .carbon-chart-wrapper code,
495
- .carbon-chart-wrapper dd,
496
- .carbon-chart-wrapper del,
497
- .carbon-chart-wrapper details,
498
- .carbon-chart-wrapper dfn,
499
- .carbon-chart-wrapper div,
500
- .carbon-chart-wrapper dl,
501
- .carbon-chart-wrapper dt,
502
- .carbon-chart-wrapper em,
503
- .carbon-chart-wrapper embed,
504
- .carbon-chart-wrapper fieldset,
505
- .carbon-chart-wrapper figcaption,
506
- .carbon-chart-wrapper figure,
507
- .carbon-chart-wrapper footer,
508
- .carbon-chart-wrapper form,
509
- .carbon-chart-wrapper h1,
510
- .carbon-chart-wrapper h2,
511
- .carbon-chart-wrapper h3,
512
- .carbon-chart-wrapper h4,
513
- .carbon-chart-wrapper h5,
514
- .carbon-chart-wrapper h6,
515
- .carbon-chart-wrapper header,
516
- .carbon-chart-wrapper hgroup,
517
- .carbon-chart-wrapper html,
518
- .carbon-chart-wrapper i,
519
- .carbon-chart-wrapper iframe,
520
- .carbon-chart-wrapper img,
521
- .carbon-chart-wrapper ins,
522
- .carbon-chart-wrapper kbd,
523
- .carbon-chart-wrapper label,
524
- .carbon-chart-wrapper legend,
525
- .carbon-chart-wrapper li,
526
- .carbon-chart-wrapper mark,
527
- .carbon-chart-wrapper menu,
528
- .carbon-chart-wrapper nav,
529
- .carbon-chart-wrapper object,
530
- .carbon-chart-wrapper ol,
531
- .carbon-chart-wrapper output,
532
- .carbon-chart-wrapper p,
533
- .carbon-chart-wrapper pre,
534
- .carbon-chart-wrapper q,
535
- .carbon-chart-wrapper ruby,
536
- .carbon-chart-wrapper s,
537
- .carbon-chart-wrapper samp,
538
- .carbon-chart-wrapper section,
539
- .carbon-chart-wrapper small,
540
- .carbon-chart-wrapper span,
541
- .carbon-chart-wrapper strike,
542
- .carbon-chart-wrapper strong,
543
- .carbon-chart-wrapper sub,
544
- .carbon-chart-wrapper summary,
545
- .carbon-chart-wrapper sup,
546
- .carbon-chart-wrapper table,
547
- .carbon-chart-wrapper tbody,
548
- .carbon-chart-wrapper td,
549
- .carbon-chart-wrapper tfoot,
550
- .carbon-chart-wrapper th,
551
- .carbon-chart-wrapper thead,
552
- .carbon-chart-wrapper time,
553
- .carbon-chart-wrapper tr,
554
- .carbon-chart-wrapper tt,
555
- .carbon-chart-wrapper u,
556
- .carbon-chart-wrapper ul,
557
- .carbon-chart-wrapper var,
558
- .carbon-chart-wrapper video {
559
- border: 0;
560
- font: inherit;
561
- font-size: 100%;
562
- margin: 0;
563
- padding: 0;
564
- vertical-align: baseline;
478
+ @layer carbon-reset {
479
+ .carbon-chart-wrapper a,
480
+ .carbon-chart-wrapper abbr,
481
+ .carbon-chart-wrapper acronym,
482
+ .carbon-chart-wrapper address,
483
+ .carbon-chart-wrapper applet,
484
+ .carbon-chart-wrapper article,
485
+ .carbon-chart-wrapper aside,
486
+ .carbon-chart-wrapper audio,
487
+ .carbon-chart-wrapper b,
488
+ .carbon-chart-wrapper big,
489
+ .carbon-chart-wrapper blockquote,
490
+ .carbon-chart-wrapper body,
491
+ .carbon-chart-wrapper canvas,
492
+ .carbon-chart-wrapper caption,
493
+ .carbon-chart-wrapper center,
494
+ .carbon-chart-wrapper cite,
495
+ .carbon-chart-wrapper code,
496
+ .carbon-chart-wrapper dd,
497
+ .carbon-chart-wrapper del,
498
+ .carbon-chart-wrapper details,
499
+ .carbon-chart-wrapper dfn,
500
+ .carbon-chart-wrapper div,
501
+ .carbon-chart-wrapper dl,
502
+ .carbon-chart-wrapper dt,
503
+ .carbon-chart-wrapper em,
504
+ .carbon-chart-wrapper embed,
505
+ .carbon-chart-wrapper fieldset,
506
+ .carbon-chart-wrapper figcaption,
507
+ .carbon-chart-wrapper figure,
508
+ .carbon-chart-wrapper footer,
509
+ .carbon-chart-wrapper form,
510
+ .carbon-chart-wrapper h1,
511
+ .carbon-chart-wrapper h2,
512
+ .carbon-chart-wrapper h3,
513
+ .carbon-chart-wrapper h4,
514
+ .carbon-chart-wrapper h5,
515
+ .carbon-chart-wrapper h6,
516
+ .carbon-chart-wrapper header,
517
+ .carbon-chart-wrapper hgroup,
518
+ .carbon-chart-wrapper html,
519
+ .carbon-chart-wrapper i,
520
+ .carbon-chart-wrapper iframe,
521
+ .carbon-chart-wrapper img,
522
+ .carbon-chart-wrapper ins,
523
+ .carbon-chart-wrapper kbd,
524
+ .carbon-chart-wrapper label,
525
+ .carbon-chart-wrapper legend,
526
+ .carbon-chart-wrapper li,
527
+ .carbon-chart-wrapper mark,
528
+ .carbon-chart-wrapper menu,
529
+ .carbon-chart-wrapper nav,
530
+ .carbon-chart-wrapper object,
531
+ .carbon-chart-wrapper ol,
532
+ .carbon-chart-wrapper output,
533
+ .carbon-chart-wrapper p,
534
+ .carbon-chart-wrapper pre,
535
+ .carbon-chart-wrapper q,
536
+ .carbon-chart-wrapper ruby,
537
+ .carbon-chart-wrapper s,
538
+ .carbon-chart-wrapper samp,
539
+ .carbon-chart-wrapper section,
540
+ .carbon-chart-wrapper small,
541
+ .carbon-chart-wrapper span,
542
+ .carbon-chart-wrapper strike,
543
+ .carbon-chart-wrapper strong,
544
+ .carbon-chart-wrapper sub,
545
+ .carbon-chart-wrapper summary,
546
+ .carbon-chart-wrapper sup,
547
+ .carbon-chart-wrapper table,
548
+ .carbon-chart-wrapper tbody,
549
+ .carbon-chart-wrapper td,
550
+ .carbon-chart-wrapper tfoot,
551
+ .carbon-chart-wrapper th,
552
+ .carbon-chart-wrapper thead,
553
+ .carbon-chart-wrapper time,
554
+ .carbon-chart-wrapper tr,
555
+ .carbon-chart-wrapper tt,
556
+ .carbon-chart-wrapper u,
557
+ .carbon-chart-wrapper ul,
558
+ .carbon-chart-wrapper var,
559
+ .carbon-chart-wrapper video {
560
+ border: 0;
561
+ font: inherit;
562
+ font-size: 100%;
563
+ margin: 0;
564
+ padding: 0;
565
+ vertical-align: baseline;
566
+ }
565
567
  }
566
568
  .carbon-chart-wrapper body,
567
569
  .cds--actionable-notification body,
@@ -1,7 +1,18 @@
1
1
  import React from 'react';
2
2
 
3
+ import { ScaleTypes } from '@carbon/charts-react';
3
4
  import { StoryFn, Meta } from '@storybook/react/types-6-0';
4
- import { Card } from 'react-magma-dom';
5
+ import {
6
+ Badge,
7
+ BadgeColor,
8
+ ButtonSize,
9
+ ButtonType,
10
+ ButtonVariant,
11
+ Card,
12
+ IconButton,
13
+ Tooltip,
14
+ } from 'react-magma-dom';
15
+ import { InfoIcon } from 'react-magma-icons';
5
16
 
6
17
  import { CarbonChart, CarbonChartProps, CarbonChartType } from '../CarbonChart';
7
18
 
@@ -150,3 +161,77 @@ export const TableOnly = {
150
161
  },
151
162
  },
152
163
  };
164
+
165
+ // ---------------------------------------------------------------------------
166
+ // Custom content slots
167
+ // ---------------------------------------------------------------------------
168
+
169
+ const chartInfoLabel =
170
+ 'Scores are averaged across all attempts in the selected term.';
171
+
172
+ const ChartInfoTooltip = () => (
173
+ <Tooltip content={chartInfoLabel}>
174
+ <IconButton
175
+ aria-label={chartInfoLabel}
176
+ icon={<InfoIcon />}
177
+ size={ButtonSize.small}
178
+ type={ButtonType.button}
179
+ variant={ButtonVariant.link}
180
+ />
181
+ </Tooltip>
182
+ );
183
+
184
+ const slotContent = {
185
+ tooltip: <ChartInfoTooltip />,
186
+ badge: <Badge color={BadgeColor.success}>Live</Badge>,
187
+ none: undefined,
188
+ };
189
+
190
+ interface TitleSlotsArgs extends Omit<CarbonChartProps, 'options'> {
191
+ content: keyof typeof slotContent;
192
+ slotPosition: 'titleSuffix' | 'titlePrefix';
193
+ title: string;
194
+ }
195
+
196
+ export const TitleSlots = {
197
+ render: ({ content, slotPosition, title, ...args }: TitleSlotsArgs) => (
198
+ <Card isInverse={args.isInverse} style={{ padding: '12px' }}>
199
+ <CarbonChart
200
+ {...args}
201
+ options={{
202
+ title,
203
+ axes: {
204
+ left: { mapsTo: 'value' },
205
+ bottom: { mapsTo: 'group', scaleType: ScaleTypes.LABELS },
206
+ },
207
+ height: '400px',
208
+ }}
209
+ chartToolbar={{
210
+ titlePrefix:
211
+ slotPosition === 'titlePrefix' ? slotContent[content] : undefined,
212
+ titleSuffix:
213
+ slotPosition === 'titleSuffix' ? slotContent[content] : undefined,
214
+ }}
215
+ />
216
+ </Card>
217
+ ),
218
+ argTypes: {
219
+ content: {
220
+ control: { type: 'radio' },
221
+ options: ['tooltip', 'badge', 'none'],
222
+ },
223
+ slotPosition: {
224
+ control: { type: 'radio' },
225
+ options: ['titleSuffix', 'titlePrefix'],
226
+ },
227
+ title: { control: { type: 'text' } },
228
+ },
229
+ args: {
230
+ content: 'tooltip',
231
+ isInverse: false,
232
+ slotPosition: 'titleSuffix',
233
+ title: 'Chapter Performance',
234
+ type: CarbonChartType.bar,
235
+ dataSet: barDataSet,
236
+ },
237
+ };