UNPKG

@gooddata/react-components

Version:
34 lines 1.11 kB
"use strict"; exports.__esModule = true; var get = require("lodash/get"); function getLegendConfig(metadata, environment) { if (environment === 'dashboards') { return { enabled: true, position: 'right', responsive: true }; } var categories = get(metadata, 'content.buckets.categories', []); var collections = categories.map(function (category) { return get(category, 'category.collection'); }); var isStackOrSegment = function (collection) { return collection === 'stack' || collection === 'segment'; }; var isOnRight = collections.some(isStackOrSegment); var position = isOnRight ? 'right' : 'top'; return { enabled: true, position: position }; } exports.getLegendConfig = getLegendConfig; function getConfig(metadata, type, environment) { var legendConfig = getLegendConfig(metadata, environment); return { type: type, buckets: get(metadata, 'content.buckets'), legend: legendConfig }; } exports.getConfig = getConfig; //# sourceMappingURL=config.js.map