@formant/ava
Version:
A framework for automated visual analytics.
21 lines (20 loc) • 953 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.viewSpecStrategy = void 0;
var tslib_1 = require("tslib");
var viewSpecStrategy = function (marks, insight) {
// majority insight pattern visualizes as 'pie', should not use y nice (G2 handle it as rescale y, the pie chart will be less than 100%)
var isMajorityPattern = insight.patterns.map(function (pattern) { return pattern.type; }).includes('majority');
var viewConfig = isMajorityPattern
? { scale: { y: { nice: false } } }
: {
scale: { y: { nice: true } },
};
return tslib_1.__assign({ type: 'view', theme: 'dark', axis: {
x: { labelAutoHide: true, labelAutoRotate: false, title: false },
y: { title: false },
}, interaction: {
tooltip: { groupName: false },
}, legend: false, children: marks }, viewConfig);
};
exports.viewSpecStrategy = viewSpecStrategy;