@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
33 lines (24 loc) • 1.38 kB
text/typescript
// (C) 2019 GoodData Corporation
import cloneDeep = require("lodash/cloneDeep");
import set = require("lodash/set");
import { IntlShape } from "react-intl";
import * as BucketNames from "../../../constants/bucketNames";
import { IExtendedReferencePoint } from "../../interfaces/Visualization";
import { UICONFIG } from "../../constants/uiConfig";
import { BUCKETS } from "../../constants/bucket";
import { setBucketTitles } from "../bucketHelper";
import * as heatmapMeasuresIcon from "../../assets/heatmap/bucket-title-measures.svg";
import * as heatmapViewIcon from "../../assets/heatmap/bucket-title-view.svg";
import * as heatmapStackIcon from "../../assets/heatmap/bucket-title-stack.svg";
export function setHeatmapUiConfig(
referencePoint: IExtendedReferencePoint,
intl: IntlShape,
visualizationType: string,
): IExtendedReferencePoint {
const referencePointConfigured = cloneDeep(referencePoint);
set(referencePointConfigured, [UICONFIG], setBucketTitles(referencePoint, visualizationType, intl));
set(referencePointConfigured, [UICONFIG, BUCKETS, BucketNames.MEASURES, "icon"], heatmapMeasuresIcon);
set(referencePointConfigured, [UICONFIG, BUCKETS, BucketNames.VIEW, "icon"], heatmapViewIcon);
set(referencePointConfigured, [UICONFIG, BUCKETS, BucketNames.STACK, "icon"], heatmapStackIcon);
return referencePointConfigured;
}