Skip to content

Commit 628f028

Browse files
authored
Fix background image for Power BI Desktop (#709)
* chore: Add getBackgroundImageColumnBounds function to backgroundImageEditor.tsx * compare to quantitativeColumns.length * 4
1 parent ea67ca0 commit 628f028

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/sanddance-explorer/src/dialogs/backgroundImageEditor.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { FluentUITypes } from '@msrvida/fluentui-react-cdn-typings';
1212
import { ColumnMapBaseProps } from '../controls/columnMap';
1313
import { IDropdownOption } from '@msrvida/fluentui-react-cdn-typings/types';
1414
import { BackgroundImageColumnBound, DataExtent, ImageHolder } from '../interfaces';
15+
import { getBackgroundImageColumnBounds } from '../columns';
1516

1617
export interface Props extends ColumnMapBaseProps {
1718
themePalette: Partial<FluentUITypes.IPalette>;
@@ -47,7 +48,13 @@ function _BackgroundImageEditor(_props: Props) {
4748
}
4849
const xCol = quantitativeColumns.filter(c => c.name === insightColumns.x)[0];
4950
const yCol = quantitativeColumns.filter(c => c.name === insightColumns.y)[0];
50-
const newState: Partial<State> = { hidden: false, xCol, yCol, backgroundImageColumnBounds: SandDance.VegaMorphCharts.util.clone(explorer.imageHolder.backgroundImageColumnBounds) };
51+
let backgroundImageColumnBounds: BackgroundImageColumnBound[];
52+
if (explorer.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) {
53+
backgroundImageColumnBounds = getBackgroundImageColumnBounds(explorer.state.dataContent.columns);
54+
} else {
55+
backgroundImageColumnBounds = SandDance.VegaMorphCharts.util.clone(explorer.imageHolder.backgroundImageColumnBounds);
56+
}
57+
const newState: Partial<State> = { hidden: false, xCol, yCol, backgroundImageColumnBounds };
5158
if (!xCol || !yCol) {
5259
//TODO error
5360
}

0 commit comments

Comments
 (0)