@react-magma/charts 13.2.1-next.0 → 13.3.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.
@@ -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> {
@@ -140,6 +157,16 @@ export interface CarbonChartProps extends React.HTMLAttributes<HTMLDivElement> {
140
157
  * toolbar is automatically disabled.
141
158
  */
142
159
  chartToolbar?: ChartToolbarConfig;
160
+ /**
161
+ * Custom content rendered below the toolbar row and above the chart itself,
162
+ * for example a filter. Requires `chartToolbar`; ignored without it.
163
+ *
164
+ * Providing this lays the toolbar out in normal flow instead of overlaying
165
+ * the single row Carbon reserves for its title, so the rendered height
166
+ * becomes toolbar + content + chart rather than the chart box alone. Set
167
+ * `options.height` so the chart still has a definite height of its own.
168
+ */
169
+ additionalContent?: React.ReactNode;
143
170
  }
144
171
 
145
172
  const ChartContentWrapper = styled.div`
@@ -148,6 +175,7 @@ const ChartContentWrapper = styled.div`
148
175
  `;
149
176
 
150
177
  const FullscreenRoot = styled.div<{
178
+ isFlowLayout?: boolean;
151
179
  isInverse?: boolean;
152
180
  theme: ThemeInterface;
153
181
  }>`
@@ -160,9 +188,34 @@ const FullscreenRoot = styled.div<{
160
188
  props.isInverse
161
189
  ? props.theme.colors.primary700
162
190
  : props.theme.colors.neutral100};
191
+
192
+ ${props =>
193
+ props.isFlowLayout
194
+ ? `
195
+ box-sizing: border-box;
196
+ display: flex;
197
+ flex-direction: column;
198
+ padding: 2em;
199
+
200
+ .carbon-chart-wrapper,
201
+ .carbon-chart-content {
202
+ display: flex;
203
+ flex: 1 1 auto;
204
+ flex-direction: column;
205
+ min-height: 0;
206
+ }
207
+
208
+ .cds--chart-holder {
209
+ flex: 1 1 auto;
210
+ height: auto !important;
211
+ min-height: 0;
212
+ }
213
+ `
214
+ : `
163
215
  .cds--chart-holder {
164
216
  height: 100vh !important;
165
217
  }
218
+ `}
166
219
  }
167
220
  `;
168
221
 
@@ -200,6 +253,14 @@ const CarbonChartWrapper = styled.div<{
200
253
  }
201
254
  }
202
255
 
256
+ .cds--chart-holder.filled,
257
+ .cds--chart-holder.filled .cds--cc--chart-wrapper {
258
+ background-color: ${props =>
259
+ props.isInverse
260
+ ? props.theme.colors.primary600
261
+ : props.theme.colors.neutral100};
262
+ }
263
+
203
264
  .cds--data-table thead tr th {
204
265
  background: ${props =>
205
266
  props.isInverse ? props.theme.colors.primary700 : ''} !important;
@@ -683,6 +744,7 @@ interface ExtendedChartOptions extends ChartOptions {
683
744
  }
684
745
 
685
746
  const ToolbarWrapper = styled.div<{
747
+ isFlowLayout?: boolean;
686
748
  isFullscreen?: boolean;
687
749
  isInverse?: boolean;
688
750
  theme: ThemeInterface;
@@ -690,12 +752,20 @@ const ToolbarWrapper = styled.div<{
690
752
  align-items: center;
691
753
  display: flex;
692
754
  justify-content: space-between;
693
- left: ${props => (props.isFullscreen ? '2em' : '0')};
694
- position: absolute;
695
- right: ${props => (props.isFullscreen ? '2em' : '0')};
696
- top: ${props => (props.isFullscreen ? '2em' : '0')};
697
755
  z-index: 2;
698
756
 
757
+ ${props =>
758
+ props.isFlowLayout
759
+ ? `
760
+ position: relative;
761
+ `
762
+ : `
763
+ left: ${props.isFullscreen ? '2em' : '0'};
764
+ position: absolute;
765
+ right: ${props.isFullscreen ? '2em' : '0'};
766
+ top: ${props.isFullscreen ? '2em' : '0'};
767
+ `}
768
+
699
769
  button {
700
770
  color: ${props =>
701
771
  props.isInverse
@@ -729,6 +799,22 @@ const ChartTitle = styled.h2<{
729
799
  : props.theme.colors.neutral700} !important;
730
800
  `;
731
801
 
802
+ const TitleGroup = styled.div<{ theme: ThemeInterface }>`
803
+ align-items: center;
804
+ display: flex;
805
+ gap: ${props => props.theme.spaceScale.spacing02};
806
+ min-width: 0;
807
+ `;
808
+
809
+ const TitleSlot = styled.div`
810
+ align-items: center;
811
+ display: flex;
812
+ `;
813
+
814
+ const ChartSlot = styled.div<{ theme: ThemeInterface }>`
815
+ margin: ${props => props.theme.spaceScale.spacing05} 0 0;
816
+ `;
817
+
732
818
  const ToolbarActions = styled.div<{ theme: ThemeInterface }>`
733
819
  align-items: center;
734
820
  display: flex;
@@ -794,189 +880,54 @@ function downloadCsv(dataSet: Array<Record<string, unknown>>, title: string) {
794
880
  URL.revokeObjectURL(url);
795
881
  }
796
882
 
797
- function inlineStyles(source: Element, target: Element) {
798
- const computed = window.getComputedStyle(source);
799
- if (target instanceof HTMLElement || target instanceof SVGElement) {
800
- target.setAttribute(
801
- 'style',
802
- Array.from(computed)
803
- .map(prop => `${prop}:${computed.getPropertyValue(prop)}`)
804
- .join(';')
805
- );
806
- }
807
- for (let i = 0; i < source.children.length; i++) {
808
- if (target.children[i]) {
809
- inlineStyles(source.children[i], target.children[i]);
810
- }
811
- }
812
- }
813
-
814
- interface LegendItem {
815
- label: string;
816
- color: string;
883
+ interface CarbonChartCore {
884
+ services?: {
885
+ domUtils?: { exportToPNG: () => void; exportToJPG: () => void };
886
+ };
817
887
  }
818
888
 
819
- function readLegendItems(wrapper: HTMLElement): LegendItem[] {
820
- const items: LegendItem[] = [];
821
- wrapper.querySelectorAll('.legend-item').forEach(item => {
822
- const checkbox = item.querySelector<HTMLElement>('.checkbox');
823
- const label = item.querySelector('p');
824
- if (checkbox && label) {
825
- items.push({
826
- color: checkbox.style.background || checkbox.style.backgroundColor,
827
- label: label.textContent || '',
828
- });
829
- }
830
- });
831
- return items;
889
+ interface CarbonChartComponent {
890
+ chart?: CarbonChartCore;
832
891
  }
833
892
 
834
- function drawLegend(
835
- ctx: CanvasRenderingContext2D,
836
- items: LegendItem[],
837
- startY: number,
838
- canvasWidth: number,
839
- scale: number
893
+ function exportCarbonChartImage(
894
+ chart: CarbonChartCore | null | undefined,
895
+ toolbarWrapper: Element | null | undefined,
896
+ format: 'png' | 'jpg'
840
897
  ) {
841
- const fontSize = 13 * scale;
842
- const swatchSize = 12 * scale;
843
- const gap = 8 * scale;
844
- const itemGap = 16 * scale;
845
- const paddingX = 16 * scale;
846
-
847
- ctx.font = `${fontSize}px sans-serif`;
848
- ctx.textBaseline = 'middle';
849
-
850
- let x = paddingX;
851
- let y = startY;
852
-
853
- for (const item of items) {
854
- const textWidth = ctx.measureText(item.label).width;
855
- const itemWidth = swatchSize + gap + textWidth + itemGap;
856
-
857
- if (x + itemWidth > canvasWidth - paddingX && x > paddingX) {
858
- x = paddingX;
859
- y += fontSize + gap;
860
- }
898
+ const domUtils = chart?.services?.domUtils;
861
899
 
862
- ctx.fillStyle = item.color;
863
- ctx.fillRect(x, y - swatchSize / 2, swatchSize, swatchSize);
900
+ if (!domUtils) return;
864
901
 
865
- ctx.fillStyle = '#161616';
866
- ctx.fillText(item.label, x + swatchSize + gap, y);
867
-
868
- x += itemWidth;
869
- }
870
-
871
- return y + fontSize + gap;
872
- }
873
-
874
- function downloadImage(
875
- wrapperRef: React.RefObject<HTMLDivElement | null>,
876
- title: string,
877
- format: 'png' | 'jpg'
878
- ) {
879
- const wrapper = wrapperRef.current;
880
- if (!wrapper) return;
881
- const svg = wrapper.querySelector('svg.layout-svg-wrapper');
882
- if (!svg) return;
883
-
884
- const svgRect = svg.getBoundingClientRect();
885
- const legendItems = readLegendItems(wrapper);
886
-
887
- const doWork = () => {
888
- const scale = 2;
889
-
890
- // Measure legend height
891
- const tempCanvas = document.createElement('canvas');
892
- const tempCtx = tempCanvas.getContext('2d');
893
- const fontSize = 13 * scale;
894
- const swatchSize = 12 * scale;
895
- const gap = 8 * scale;
896
- const itemGap = 16 * scale;
897
- const paddingX = 16 * scale;
898
- const canvasWidth = svgRect.width * scale;
899
-
900
- let legendHeight = 0;
901
- if (legendItems.length > 0 && tempCtx) {
902
- tempCtx.font = `${fontSize}px sans-serif`;
903
- let x = paddingX;
904
- let rows = 1;
905
- for (const item of legendItems) {
906
- const textWidth = tempCtx.measureText(item.label).width;
907
- const itemWidth = swatchSize + gap + textWidth + itemGap;
908
- if (x + itemWidth > canvasWidth - paddingX && x > paddingX) {
909
- x = paddingX;
910
- rows++;
911
- }
912
- x += itemWidth;
913
- }
914
- legendHeight = rows * (fontSize + gap) + gap * 2;
915
- }
902
+ const magmaWrapper = toolbarWrapper?.classList.contains('has-magma-toolbar')
903
+ ? toolbarWrapper
904
+ : null;
916
905
 
917
- const width = svgRect.width * scale;
918
- const height = svgRect.height * scale + legendHeight;
919
-
920
- const clone = svg.cloneNode(true) as SVGSVGElement;
921
- clone.setAttribute('width', String(svgRect.width));
922
- clone.setAttribute('height', String(svgRect.height));
923
- clone.setAttribute('viewBox', `0 0 ${svgRect.width} ${svgRect.height}`);
924
- clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
925
-
926
- inlineStyles(svg, clone);
927
-
928
- const serializer = new XMLSerializer();
929
- const svgString = serializer.serializeToString(clone);
930
- const svgBlob = new Blob([svgString], {
931
- type: 'image/svg+xml;charset=utf-8',
932
- });
933
- const url = URL.createObjectURL(svgBlob);
934
-
935
- const mimeType = format === 'jpg' ? 'image/jpeg' : 'image/png';
936
- const ext = format === 'jpg' ? 'jpg' : 'png';
937
-
938
- const img = new Image();
939
- img.onload = () => {
940
- const canvas = document.createElement('canvas');
941
- canvas.width = width;
942
- canvas.height = height;
943
- const ctx = canvas.getContext('2d');
944
- if (!ctx) return;
945
-
946
- ctx.fillStyle = '#ffffff';
947
- ctx.fillRect(0, 0, canvas.width, canvas.height);
948
- ctx.drawImage(img, 0, 0, svgRect.width * scale, svgRect.height * scale);
949
- URL.revokeObjectURL(url);
950
-
951
- if (legendItems.length > 0) {
952
- drawLegend(
953
- ctx,
954
- legendItems,
955
- svgRect.height * scale + gap,
956
- width,
957
- scale
958
- );
959
- }
906
+ magmaWrapper?.classList.remove('has-magma-toolbar');
960
907
 
961
- canvas.toBlob(blob => {
962
- if (!blob) return;
963
- const imgUrl = URL.createObjectURL(blob);
964
- const a = document.createElement('a');
965
- a.href = imgUrl;
966
- a.download = `${title || 'chart'}.${ext}`;
967
- a.click();
968
- URL.revokeObjectURL(imgUrl);
969
- }, mimeType);
970
- };
971
- img.onerror = () => URL.revokeObjectURL(url);
972
- img.src = url;
908
+ let restored = false;
909
+ const restore = () => {
910
+ if (restored) return;
911
+ restored = true;
912
+ magmaWrapper?.classList.add('has-magma-toolbar');
973
913
  };
974
914
 
975
- // Defer to idle time with a 2-second deadline so it always runs.
976
- if (typeof requestIdleCallback === 'function') {
977
- requestIdleCallback(doWork, { timeout: 2000 });
978
- } else {
979
- setTimeout(doWork, 0);
915
+ try {
916
+ if (format === 'jpg') {
917
+ domUtils.exportToJPG();
918
+ } else {
919
+ domUtils.exportToPNG();
920
+ }
921
+ } catch (error) {
922
+ console.warn('Carbon chart image export failed', error);
923
+ } finally {
924
+ // Re-add before the next paint so the title swap is never visible on
925
+ // screen; the timeout is only a fallback for when requestAnimationFrame is
926
+ // paused (e.g. the tab is in the background).
927
+ if (typeof requestAnimationFrame === 'function') {
928
+ requestAnimationFrame(restore);
929
+ }
930
+ setTimeout(restore, 1000);
980
931
  }
981
932
  }
982
933
 
@@ -1002,8 +953,10 @@ const ALL_CHARTS: Record<CarbonChartType, React.ComponentType<any>> = {
1002
953
  };
1003
954
 
1004
955
  interface InternalToolbarProps {
956
+ chartRef: React.MutableRefObject<CarbonChartComponent | null>;
1005
957
  config: ChartToolbarConfig;
1006
958
  dataSet: Array<Record<string, unknown>>;
959
+ isFlowLayout: boolean;
1007
960
  isInverse: boolean;
1008
961
  isTableOpen: boolean;
1009
962
  isFullscreen: boolean;
@@ -1015,8 +968,10 @@ interface InternalToolbarProps {
1015
968
  }
1016
969
 
1017
970
  function CarbonChartToolbar({
971
+ chartRef,
1018
972
  config,
1019
973
  dataSet,
974
+ isFlowLayout,
1020
975
  isInverse,
1021
976
  isTableOpen,
1022
977
  isFullscreen,
@@ -1031,17 +986,28 @@ function CarbonChartToolbar({
1031
986
  const showFullscreen = config.fullscreen !== false;
1032
987
  const resolvedTitle = title || t.defaultTitle;
1033
988
 
989
+ const exportImage = React.useCallback(
990
+ (format: 'png' | 'jpg') => {
991
+ exportCarbonChartImage(
992
+ chartRef.current?.chart,
993
+ wrapperRef.current?.querySelector('.carbon-chart-wrapper'),
994
+ format
995
+ );
996
+ },
997
+ [chartRef, wrapperRef]
998
+ );
999
+
1034
1000
  const handleDownloadCsv = React.useCallback(() => {
1035
1001
  downloadCsv(dataSet, title);
1036
1002
  }, [dataSet, title]);
1037
1003
 
1038
1004
  const handleDownloadPng = React.useCallback(() => {
1039
- downloadImage(wrapperRef, title, 'png');
1040
- }, [wrapperRef, title]);
1005
+ exportImage('png');
1006
+ }, [exportImage]);
1041
1007
 
1042
1008
  const handleDownloadJpg = React.useCallback(() => {
1043
- downloadImage(wrapperRef, title, 'jpg');
1044
- }, [wrapperRef, title]);
1009
+ exportImage('jpg');
1010
+ }, [exportImage]);
1045
1011
 
1046
1012
  const moreOptionsContent = (
1047
1013
  <>
@@ -1065,17 +1031,26 @@ function CarbonChartToolbar({
1065
1031
 
1066
1032
  return (
1067
1033
  <ToolbarWrapper
1034
+ isFlowLayout={isFlowLayout}
1068
1035
  isFullscreen={isFullscreen}
1069
1036
  isInverse={isInverse}
1070
1037
  theme={theme}
1071
1038
  >
1072
- <ChartTitle
1073
- as={`h${config.titleLevel ?? 2}` as keyof JSX.IntrinsicElements}
1074
- isInverse={isInverse}
1075
- theme={theme}
1076
- >
1077
- {resolvedTitle}
1078
- </ChartTitle>
1039
+ <TitleGroup theme={theme}>
1040
+ {config.titlePrefix ? (
1041
+ <TitleSlot>{config.titlePrefix}</TitleSlot>
1042
+ ) : null}
1043
+ <ChartTitle
1044
+ as={`h${config.titleLevel ?? 2}` as keyof JSX.IntrinsicElements}
1045
+ isInverse={isInverse}
1046
+ theme={theme}
1047
+ >
1048
+ {resolvedTitle}
1049
+ </ChartTitle>
1050
+ {config.titleSuffix ? (
1051
+ <TitleSlot>{config.titleSuffix}</TitleSlot>
1052
+ ) : null}
1053
+ </TitleGroup>
1079
1054
  <ToolbarActions theme={theme}>
1080
1055
  {showTable && (
1081
1056
  <ChartTableButton
@@ -1115,6 +1090,7 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1115
1090
  type,
1116
1091
  dataSet,
1117
1092
  options,
1093
+ additionalContent,
1118
1094
  ariaLabel,
1119
1095
  chartToolbar,
1120
1096
  ...rest
@@ -1123,6 +1099,7 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1123
1099
  const isInverse = useIsInverse(isInverseProp);
1124
1100
  const toolbarI18n = useChartToolbarI18n();
1125
1101
  const internalRef = React.useRef<HTMLDivElement | null>(null);
1102
+ const chartComponentRef = React.useRef<CarbonChartComponent | null>(null);
1126
1103
 
1127
1104
  const [isTableOpen, setIsTableOpen] = React.useState(false);
1128
1105
  const [isFullscreen, setIsFullscreen] = React.useState(false);
@@ -1149,6 +1126,8 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1149
1126
  ? chartToolbar.fullscreen !== false
1150
1127
  : false;
1151
1128
 
1129
+ const isFlowLayout = Boolean(chartToolbar && additionalContent);
1130
+
1152
1131
  const savedHeightRef = React.useRef<string>('');
1153
1132
 
1154
1133
  React.useEffect(() => {
@@ -1160,7 +1139,8 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1160
1139
 
1161
1140
  const chartHolder =
1162
1141
  internalRef.current?.querySelector<HTMLElement>('.cds--chart-holder');
1163
- if (chartHolder) {
1142
+
1143
+ if (chartHolder && !isFlowLayout) {
1164
1144
  if (isFs) {
1165
1145
  savedHeightRef.current = chartHolder.style.height;
1166
1146
  chartHolder.style.height = '100vh';
@@ -1175,11 +1155,11 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1175
1155
  // Restore height if the component unmounts while in fullscreen.
1176
1156
  const chartHolder =
1177
1157
  internalRef.current?.querySelector<HTMLElement>('.cds--chart-holder');
1178
- if (chartHolder && document.fullscreenElement) {
1158
+ if (chartHolder && document.fullscreenElement && !isFlowLayout) {
1179
1159
  chartHolder.style.height = savedHeightRef.current;
1180
1160
  }
1181
1161
  };
1182
- }, [fullscreenEnabled]);
1162
+ }, [fullscreenEnabled, isFlowLayout]);
1183
1163
 
1184
1164
  const openTableModal = React.useCallback(
1185
1165
  (event: React.MouseEvent<HTMLButtonElement>) => {
@@ -1405,7 +1385,15 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1405
1385
  type: 'none',
1406
1386
  },
1407
1387
  },
1408
- ...(chartToolbar ? { toolbar: { enabled: false } } : {}),
1388
+ ...(chartToolbar
1389
+ ? {
1390
+ toolbar: { enabled: false },
1391
+ title: chartTitle,
1392
+ ...(options.fileDownload
1393
+ ? {}
1394
+ : { fileDownload: { fileName: chartTitle } }),
1395
+ }
1396
+ : {}),
1409
1397
  };
1410
1398
 
1411
1399
  const ChartType = ALL_CHARTS[type];
@@ -1591,7 +1579,12 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1591
1579
  if (!ChartType) return null;
1592
1580
 
1593
1581
  return (
1594
- <FullscreenRoot ref={mergedRef} isInverse={isInverse} theme={theme}>
1582
+ <FullscreenRoot
1583
+ ref={mergedRef}
1584
+ isFlowLayout={isFlowLayout}
1585
+ isInverse={isInverse}
1586
+ theme={theme}
1587
+ >
1595
1588
  <VisuallyHidden>
1596
1589
  <Announce>{legendAnnouncement}</Announce>
1597
1590
  </VisuallyHidden>
@@ -1602,29 +1595,48 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
1602
1595
  data-testid={testId}
1603
1596
  isInverse={isInverse}
1604
1597
  theme={theme}
1605
- className={`carbon-chart-wrapper${chartToolbar ? ' has-magma-toolbar' : ''}`}
1598
+ className={`carbon-chart-wrapper${
1599
+ chartToolbar ? ' has-magma-toolbar' : ''
1600
+ }`}
1606
1601
  groupsLength={groupsLength < 6 ? groupsLength : 14}
1607
1602
  role="region"
1608
1603
  aria-label={ariaLabel || chartTitle}
1609
1604
  aria-roledescription="chart"
1610
1605
  {...rest}
1611
1606
  >
1612
- <ChartContentWrapper>
1607
+ <ChartContentWrapper className="carbon-chart-content">
1613
1608
  {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
- />
1609
+ /*
1610
+ * Slot content comes from the adopter, so it resolves
1611
+ * `isInverse` from context rather than from our prop. Without
1612
+ * this provider a Magma component in a title slot would stay
1613
+ * light on an inverse chart.
1614
+ */
1615
+ <InverseContext.Provider value={{ isInverse }}>
1616
+ <CarbonChartToolbar
1617
+ chartRef={chartComponentRef}
1618
+ config={chartToolbar}
1619
+ dataSet={dataSet as Array<Record<string, unknown>>}
1620
+ isFlowLayout={isFlowLayout}
1621
+ isInverse={isInverse}
1622
+ isTableOpen={isTableOpen}
1623
+ isFullscreen={isFullscreen}
1624
+ onOpenTable={openTableModal}
1625
+ onToggleFullscreen={toggleFullscreen}
1626
+ theme={theme}
1627
+ title={chartTitle}
1628
+ wrapperRef={internalRef}
1629
+ />
1630
+ {isFlowLayout && (
1631
+ <ChartSlot theme={theme}>{additionalContent}</ChartSlot>
1632
+ )}
1633
+ </InverseContext.Provider>
1626
1634
  )}
1627
- <ChartType data={dataSet} options={newOptions} />
1635
+ <ChartType
1636
+ ref={chartComponentRef}
1637
+ data={dataSet}
1638
+ options={newOptions}
1639
+ />
1628
1640
  </ChartContentWrapper>
1629
1641
  </CarbonChartWrapper>
1630
1642
  {chartToolbar && showTable && (