Skip to content

Commit 869d2e7

Browse files
committed
move Insight types to new file
1 parent 6173f5c commit 869d2e7

File tree

4 files changed

+78
-68
lines changed

4 files changed

+78
-68
lines changed

packages/sanddance-specs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
export * from './build.js';
77
export * from './constants.js';
88
export * from './inference.js';
9+
export * from './insight.js';
910
export * from './interfaces.js';
1011
export * from './types.js';

packages/sanddance-specs/src/inference.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55

66
import { Column } from '@msrvida/chart-types';
7-
import { Insight, SpecColumns } from './types.js';
7+
import { SpecColumns } from './types.js';
8+
import { Insight } from './insight.js';
89

910
export { getColumnsFromData, getStats, inferAll } from '@msrvida/data-inference';
1011

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*!
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*/
5+
6+
import { Size, View } from '@msrvida/chart-types';
7+
import { Search } from '@msrvida/search-expression';
8+
import { Transforms } from 'vega-typings';
9+
import { BackgroundImage, Chart, ColorBin, FacetStyle, SignalValues, TotalStyle } from './types';
10+
11+
/**
12+
* Options to designate a SandDance visualization.
13+
*/
14+
export interface Insight {
15+
backgroundImage?: BackgroundImage;
16+
chart: Chart;
17+
size: Size;
18+
columns: InsightColumns;
19+
view?: View;
20+
filter?: Search;
21+
facetStyle?: FacetStyle;
22+
totalStyle?: TotalStyle;
23+
24+
/**
25+
* Type of color binning to use on color scale. Only applicable when the column in the color role is quantitative.
26+
*/
27+
colorBin?: ColorBin;
28+
29+
/**
30+
* Name of the color scheme. See https://vega.github.io/vega/docs/schemes/
31+
*/
32+
scheme?: string;
33+
34+
/**
35+
* Vega signal values for this insight.
36+
*/
37+
signalValues?: SignalValues;
38+
39+
/**
40+
* Optional flag to hide axes.
41+
*/
42+
hideAxes?: boolean;
43+
44+
/**
45+
* Optional flag to hide legend.
46+
*/
47+
hideLegend?: boolean;
48+
49+
/**
50+
* Optional flag to use CSS colors directly from data.
51+
*/
52+
directColor?: boolean;
53+
54+
/**
55+
* Optional array of Vega transforms to apply to the data.
56+
*/
57+
transform?: Transforms[];
58+
}
59+
60+
export type InsightColumnRoles = 'uid' | 'x' | 'y' | 'z' | 'group' | 'size' | 'color' | 'facet' | 'facetV' | 'sort';
61+
62+
export interface InsightColumns {
63+
uid?: string;
64+
x?: string;
65+
y?: string;
66+
z?: string;
67+
group?: string;
68+
size?: string;
69+
color?: string;
70+
sort?: string;
71+
facet?: string;
72+
facetV?: string;
73+
}

packages/sanddance-specs/src/types.ts

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* Licensed under the MIT License.
44
*/
55

6-
import { Column, Size, View } from '@msrvida/chart-types';
7-
import { Search } from '@msrvida/search-expression';
8-
import { Transforms } from 'vega-typings';
6+
import { Column, Size } from '@msrvida/chart-types';
7+
import { Insight, InsightColumnRoles } from './insight';
98

109
/**
1110
* Deprecated - use @msrvida/chart-types instead.
@@ -63,70 +62,6 @@ export interface BackgroundImage {
6362
extents?: Extents;
6463
}
6564

66-
/**
67-
* Options to designate a SandDance visualization.
68-
*/
69-
export interface Insight {
70-
backgroundImage?: BackgroundImage;
71-
chart: Chart;
72-
size: Size;
73-
columns: InsightColumns;
74-
view?: View;
75-
filter?: Search;
76-
facetStyle?: FacetStyle;
77-
totalStyle?: TotalStyle;
78-
79-
/**
80-
* Type of color binning to use on color scale. Only applicable when the column in the color role is quantitative.
81-
*/
82-
colorBin?: ColorBin;
83-
84-
/**
85-
* Name of the color scheme. See https://vega.github.io/vega/docs/schemes/
86-
*/
87-
scheme?: string;
88-
89-
/**
90-
* Vega signal values for this insight.
91-
*/
92-
signalValues?: SignalValues;
93-
94-
/**
95-
* Optional flag to hide axes.
96-
*/
97-
hideAxes?: boolean;
98-
99-
/**
100-
* Optional flag to hide legend.
101-
*/
102-
hideLegend?: boolean;
103-
104-
/**
105-
* Optional flag to use CSS colors directly from data.
106-
*/
107-
directColor?: boolean;
108-
109-
/**
110-
* Optional array of Vega transforms to apply to the data.
111-
*/
112-
transform?: Transforms[];
113-
}
114-
115-
export type InsightColumnRoles = 'uid' | 'x' | 'y' | 'z' | 'group' | 'size' | 'color' | 'facet' | 'facetV' | 'sort';
116-
117-
export interface InsightColumns {
118-
uid?: string;
119-
x?: string;
120-
y?: string;
121-
z?: string;
122-
group?: string;
123-
size?: string;
124-
color?: string;
125-
sort?: string;
126-
facet?: string;
127-
facetV?: string;
128-
}
129-
13065
export interface SpecRoleCapabilities {
13166
role: InsightColumnRoles;
13267
excludeCategoric?: boolean;

0 commit comments

Comments
 (0)