MCPcopy Create free account
hub / github.com/microsoft/SandDance / getFacetLayout

Function getFacetLayout

packages/sanddance-specs/src/facetLayout.ts:31–88  ·  view source on GitHub ↗
(facetStyle: FacetStyle, facetColumn: DiscreteColumn, facetVColumn: DiscreteColumn, axisTextColor: string)

Source from the content-addressed store, hash-verified

29}
30
31export function getFacetLayout(facetStyle: FacetStyle, facetColumn: DiscreteColumn, facetVColumn: DiscreteColumn, axisTextColor: string) {
32 let layoutPair: LayoutPair;
33 const groupby = facetColumn;
34 const plotPadding: PlotPadding = {
35 x: 0,
36 y: 0,
37 };
38 let facetPadding: FacetPadding;
39 switch (facetStyle) {
40 case 'cross': {
41 const props: CrossProps = {
42 axisTextColor,
43 colRowTitles: true,
44 groupbyX: groupby,
45 groupbyY: facetVColumn,
46 };
47 layoutPair = {
48 layoutType: 'Cross',
49 props,
50 };
51 facetPadding = {
52 bottom: facetPaddingBottom,
53 left: facetPaddingLeft,
54 top: 0,
55 };
56 plotPadding.y = facetPaddingTop;
57 plotPadding.x = facetPaddingRight;
58 break;
59 }
60 case 'wrap':
61 default: {
62 const props: WrapProps = {
63 axisTextColor,
64 cellTitles: true,
65 groupby,
66 };
67 layoutPair = {
68 layoutType: 'Wrap',
69 props,
70 };
71 facetPadding =
72 {
73 bottom: facetPaddingBottom,
74 left: facetPaddingLeft,
75 top: facetPaddingTop,
76 };
77 break;
78 }
79 }
80 const facetLayout: FacetLayout = {
81 facetPadding,
82 plotPadding,
83 };
84 return {
85 layoutPair,
86 facetLayout,
87 };
88}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected