diff --git a/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx b/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx index 094386f7878c92..83480263bdfe2f 100644 --- a/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx +++ b/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx @@ -144,6 +144,8 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} legendProps={{ ...legendProps, canSelectMultipleLegends: true, selectedLegends: activeLegends}} componentRef={chartRef} + // Bubble event to prevent right click to open menu on the callout + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); case 'bar': @@ -154,6 +156,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } else { @@ -163,6 +166,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } @@ -171,6 +175,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } @@ -183,6 +188,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToScatterChartProps({ data, layout }, true, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } @@ -191,6 +197,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToScatterChartProps({ data, layout }, false, colorMap, isDarkTheme)} legendProps={{ ...legendProps, canSelectMultipleLegends: true, selectedLegends: activeLegends}} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } @@ -199,6 +206,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); case 'heatmap': @@ -207,6 +215,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToHeatmapProps(plotlySchema)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); case 'sankey': @@ -214,6 +223,7 @@ export const DeclarativeChart: React.FunctionComponent = ); case 'indicator': @@ -223,6 +233,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); } @@ -233,6 +244,7 @@ export const DeclarativeChart: React.FunctionComponent = {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)} legendProps={legendProps} componentRef={chartRef} + calloutProps={{layerProps: {eventBubblingEnabled: true}}} /> ); default: diff --git a/packages/charts/react-charting/src/components/SankeyChart/SankeyChart.base.tsx b/packages/charts/react-charting/src/components/SankeyChart/SankeyChart.base.tsx index 721d9ea33f5436..163ce0796fb1e3 100644 --- a/packages/charts/react-charting/src/components/SankeyChart/SankeyChart.base.tsx +++ b/packages/charts/react-charting/src/components/SankeyChart/SankeyChart.base.tsx @@ -834,6 +834,7 @@ export class SankeyChartBase extends React.Component; + + /** + * props for the callout in the chart + */ + calloutProps?: Partial; } /** diff --git a/packages/react-examples/src/react-charting/DeclarativeChart/DeclarativeChart.Basic.Example.tsx b/packages/react-examples/src/react-charting/DeclarativeChart/DeclarativeChart.Basic.Example.tsx index 49634880f442e4..c3aa8e7c7a99fa 100644 --- a/packages/react-examples/src/react-charting/DeclarativeChart/DeclarativeChart.Basic.Example.tsx +++ b/packages/react-examples/src/react-charting/DeclarativeChart/DeclarativeChart.Basic.Example.tsx @@ -67,6 +67,12 @@ export class DeclarativeChartBasicExample extends React.Component<{}, IDeclarati this._lastKnownValidLegends = selectedLegends; } + componentDidMount() { + document.addEventListener('contextmenu', (e) => { + e.preventDefault(); + }); + }; + public render(): JSX.Element { return
{this._createDeclarativeChart()}
; }