Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Add display format setting for table/tooltip #2826

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/actions/src/vis-state-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,8 @@ export type SetColumnDisplayFormatUpdaterAction = {
* @public
*/
export function setColumnDisplayFormat(
dataId: string,
formats: {
[key: string]: string;
}
dataId: SetColumnDisplayFormatUpdaterAction['dataId'],
formats: SetColumnDisplayFormatUpdaterAction['formats']
): Merge<
SetColumnDisplayFormatUpdaterAction,
{type: typeof ActionTypes.SET_COLUMN_DISPLAY_FORMAT}
Expand Down
2 changes: 1 addition & 1 deletion src/types/schemas.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export type SavedLayer = {
columns: {
[key: string]: string;
};
columnMode: string;
isVisible: boolean;
visConfig: Record<string, any>;
hidden: boolean;
textLabel: Merge<LayerTextLabel, {field: {name: string; type: string} | null}>;
columnMode: string;
};
visualChannels: SavedVisualChannels;
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/src/data-scale-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function getScaleLabels(
});
}

const customScaleLabelFormat = d => String(d);
const customScaleLabelFormat = n => (n ? formatNumber(n, 'real') : 'no value');
/**
* Get linear / quant scale color breaks
*/
Expand Down
3 changes: 2 additions & 1 deletion src/utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,10 @@ export function findById(id: string): <X extends {id: string}>(arr: X[]) => X |
* Returns array difference from
*/
export function arrayDifference<X extends {id: string}>(source: X[]): (compare: X[]) => X[] {
const initial: X[] = [];
return compare =>
source.reduce((acc, element) => {
const foundElement = findById(element.id)(compare);
return foundElement ? [...acc, foundElement] : acc;
}, [] as X[]);
}, initial);
}
Loading