@malloydata/render 0.0.24-dev230224214106 → 0.0.24-dev230228224434
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data_styles.d.ts +27 -27
- package/dist/drill.d.ts +1 -1
- package/dist/drill.js +12 -12
- package/dist/html/bar_chart.d.ts +4 -4
- package/dist/html/bar_chart.js +5 -5
- package/dist/html/boolean.d.ts +2 -2
- package/dist/html/bytes.d.ts +2 -2
- package/dist/html/bytes.js +1 -1
- package/dist/html/cartesian_chart.d.ts +4 -4
- package/dist/html/cartesian_chart.js +30 -30
- package/dist/html/chart.d.ts +5 -5
- package/dist/html/chart.js +10 -10
- package/dist/html/container.d.ts +3 -3
- package/dist/html/currency.d.ts +2 -2
- package/dist/html/currency.js +4 -4
- package/dist/html/dashboard.d.ts +3 -3
- package/dist/html/dashboard.js +32 -31
- package/dist/html/date.d.ts +2 -2
- package/dist/html/date.js +2 -2
- package/dist/html/html_view.d.ts +3 -3
- package/dist/html/html_view.js +40 -40
- package/dist/html/image.d.ts +2 -2
- package/dist/html/image.js +2 -2
- package/dist/html/index.d.ts +1 -1
- package/dist/html/json.d.ts +2 -2
- package/dist/html/json.js +2 -2
- package/dist/html/line_chart.d.ts +4 -4
- package/dist/html/line_chart.js +6 -6
- package/dist/html/link.d.ts +2 -2
- package/dist/html/link.js +4 -4
- package/dist/html/list.d.ts +3 -3
- package/dist/html/list.js +7 -7
- package/dist/html/list_detail.d.ts +2 -2
- package/dist/html/number.d.ts +2 -2
- package/dist/html/percent.d.ts +2 -2
- package/dist/html/percent.js +1 -1
- package/dist/html/point_map.d.ts +4 -4
- package/dist/html/point_map.js +69 -69
- package/dist/html/scatter_chart.d.ts +4 -4
- package/dist/html/scatter_chart.js +6 -6
- package/dist/html/segment_map.d.ts +4 -4
- package/dist/html/segment_map.js +61 -61
- package/dist/html/shape_map.d.ts +4 -4
- package/dist/html/shape_map.js +73 -73
- package/dist/html/state_codes.js +108 -108
- package/dist/html/table.d.ts +3 -3
- package/dist/html/table.js +16 -16
- package/dist/html/text.d.ts +2 -2
- package/dist/html/text.js +1 -1
- package/dist/html/unsupported.d.ts +2 -2
- package/dist/html/unsupported.js +4 -4
- package/dist/html/utils.d.ts +4 -4
- package/dist/html/utils.js +51 -51
- package/dist/html/vega_spec.d.ts +6 -6
- package/dist/html/vega_spec.js +287 -287
- package/dist/index.d.ts +2 -2
- package/dist/renderer.d.ts +3 -3
- package/package.json +2 -2
package/dist/html/vega_spec.js
CHANGED
|
@@ -30,69 +30,69 @@ const chart_1 = require("./chart");
|
|
|
30
30
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
31
31
|
const utils_1 = require("./utils");
|
|
32
32
|
exports.DEFAULT_SPEC = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
|
|
34
|
+
config: {
|
|
35
|
+
params: [
|
|
36
36
|
{
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
name: 'defaultFont',
|
|
38
|
+
value: "var(--malloy-font-family, 'Roboto')",
|
|
39
39
|
},
|
|
40
|
-
{
|
|
41
|
-
{
|
|
40
|
+
{ name: 'titleColor', value: 'var(--malloy-title-color, #505050)' },
|
|
41
|
+
{ name: 'labelColor', value: 'var(--malloy-label-color, #505050)' },
|
|
42
42
|
],
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
background: undefined,
|
|
44
|
+
color: { expr: 'titleColor' },
|
|
45
|
+
header: {
|
|
46
|
+
labelFont: { expr: 'defaultFont' },
|
|
47
|
+
titleFont: { expr: 'defaultFont' },
|
|
48
|
+
titleFontWeight: 500,
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
text: {
|
|
51
|
+
font: { expr: 'defaultFont' },
|
|
52
|
+
color: { expr: 'labelColor' },
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
mark: {
|
|
55
|
+
font: { expr: 'defaultFont' },
|
|
56
|
+
color: { expr: 'labelColor' },
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
title: {
|
|
59
|
+
font: { expr: 'defaultFont' },
|
|
60
|
+
subtitleFont: { expr: 'defaultFont' },
|
|
61
|
+
fontWeight: 500,
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
axis: {
|
|
64
|
+
labelColor: { expr: 'labelColor' },
|
|
65
|
+
labelFont: { expr: 'defaultFont' },
|
|
66
|
+
titleFont: { expr: 'defaultFont' },
|
|
67
|
+
titleFontWeight: 500,
|
|
68
|
+
titleColor: { expr: 'titleColor' },
|
|
69
|
+
titleFontSize: 12,
|
|
70
70
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
71
|
+
legend: {
|
|
72
|
+
titleFontWeight: 500,
|
|
73
|
+
titleColor: { expr: 'titleColor' },
|
|
74
|
+
titleFontSize: 12,
|
|
75
|
+
labelColor: { expr: 'labelColor' },
|
|
76
|
+
labelFont: { expr: 'defaultFont' },
|
|
77
|
+
titleFont: { expr: 'defaultFont' },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
80
|
};
|
|
81
81
|
const sizeSmall = {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
height: 80,
|
|
83
|
+
width: 150,
|
|
84
84
|
};
|
|
85
85
|
const sizeSmallWidth = {
|
|
86
|
-
|
|
86
|
+
width: 150,
|
|
87
87
|
};
|
|
88
88
|
const sizeSmallHeightStep = {
|
|
89
|
-
|
|
89
|
+
height: { step: 13 },
|
|
90
90
|
};
|
|
91
91
|
const sizeSmallStep = { ...sizeSmallWidth, ...sizeSmallHeightStep };
|
|
92
92
|
const sizeMediumStep = { ...sizeSmallWidth };
|
|
93
93
|
const sizeMedium = {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
height: 150,
|
|
95
|
+
width: 200,
|
|
96
96
|
};
|
|
97
97
|
const sizeLarge = {
|
|
98
98
|
// height: 350,
|
|
@@ -101,324 +101,324 @@ const sizeLarge = {
|
|
|
101
101
|
// bar with text in the bars.
|
|
102
102
|
const bar_SM = {
|
|
103
103
|
...exports.DEFAULT_SPEC,
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
encoding: {
|
|
105
|
+
y: { field: '#{1}', type: 'nominal', axis: null, sort: null },
|
|
106
106
|
},
|
|
107
|
-
|
|
107
|
+
layer: [
|
|
108
108
|
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
mark: { type: 'bar', color: '#aec7e8' },
|
|
110
|
+
encoding: {
|
|
111
|
+
x: {
|
|
112
|
+
field: '#{2}',
|
|
113
|
+
type: 'quantitative',
|
|
114
|
+
sort: null,
|
|
115
115
|
},
|
|
116
|
-
|
|
117
|
-
}
|
|
116
|
+
color: { value: '#4285F4' },
|
|
117
|
+
},
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
]
|
|
120
|
+
mark: { type: 'text', align: 'left', x: 5 },
|
|
121
|
+
encoding: {
|
|
122
|
+
text: { field: '#{1}' },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
126
|
};
|
|
127
127
|
const bar_SM_large = {
|
|
128
128
|
...exports.DEFAULT_SPEC,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
129
|
+
mark: 'bar',
|
|
130
|
+
data: [],
|
|
131
|
+
encoding: {
|
|
132
|
+
x: { field: '#{1}', type: 'nominal', sort: null },
|
|
133
|
+
y: { field: '#{2}', type: 'quantitative', sort: null },
|
|
134
|
+
color: { value: '#4285F4' },
|
|
135
|
+
},
|
|
136
136
|
};
|
|
137
137
|
const bar_SMM_large = {
|
|
138
138
|
...bar_SM_large,
|
|
139
|
-
|
|
139
|
+
encoding: {
|
|
140
140
|
...bar_SM_large.encoding,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
}
|
|
141
|
+
color: {
|
|
142
|
+
field: '#{3}',
|
|
143
|
+
type: 'quantitative',
|
|
144
|
+
scale: (0, utils_1.getColorScale)('quantitative', true, true),
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
147
|
};
|
|
148
148
|
const bar_SMS_large = {
|
|
149
149
|
...bar_SM_large,
|
|
150
|
-
|
|
150
|
+
encoding: {
|
|
151
151
|
...bar_SM_large.encoding,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
}
|
|
152
|
+
color: {
|
|
153
|
+
field: '#{3}',
|
|
154
|
+
scale: (0, utils_1.getColorScale)('nominal', true, true),
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
157
|
};
|
|
158
158
|
const bar_SMS = {
|
|
159
159
|
...bar_SM,
|
|
160
|
-
|
|
160
|
+
layer: [
|
|
161
161
|
{
|
|
162
162
|
...bar_SM.layer[0],
|
|
163
|
-
|
|
163
|
+
encoding: {
|
|
164
164
|
...bar_SM.layer[0].encoding,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
}
|
|
165
|
+
color: {
|
|
166
|
+
field: '#{3}',
|
|
167
|
+
scale: (0, utils_1.getColorScale)('nominal', true, true),
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
170
|
},
|
|
171
|
-
bar_SM.layer[1]
|
|
172
|
-
]
|
|
171
|
+
bar_SM.layer[1],
|
|
172
|
+
],
|
|
173
173
|
};
|
|
174
174
|
const bar_SMM = {
|
|
175
175
|
...bar_SM,
|
|
176
|
-
|
|
176
|
+
layer: [
|
|
177
177
|
{
|
|
178
178
|
...bar_SM.layer[0],
|
|
179
|
-
|
|
179
|
+
encoding: {
|
|
180
180
|
...bar_SM.layer[0].encoding,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
}
|
|
181
|
+
color: {
|
|
182
|
+
field: '#{3}',
|
|
183
|
+
type: 'quantitative',
|
|
184
|
+
scale: (0, utils_1.getColorScale)('quantitative', true, true),
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
187
|
},
|
|
188
|
-
bar_SM.layer[1]
|
|
189
|
-
]
|
|
188
|
+
bar_SM.layer[1],
|
|
189
|
+
],
|
|
190
190
|
};
|
|
191
191
|
// simple column chart
|
|
192
192
|
const bar_NM = {
|
|
193
193
|
...exports.DEFAULT_SPEC,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
194
|
+
mark: 'bar',
|
|
195
|
+
data: [],
|
|
196
|
+
encoding: {
|
|
197
|
+
x: { field: '#{1}', type: 'nominal', sort: null },
|
|
198
|
+
y: { field: '#{2}', type: 'quantitative', sort: null },
|
|
199
|
+
color: { value: '#4285F4' },
|
|
200
|
+
},
|
|
201
201
|
};
|
|
202
202
|
const bar_NMS = {
|
|
203
203
|
...bar_NM,
|
|
204
|
-
|
|
204
|
+
encoding: {
|
|
205
205
|
...bar_NM.encoding,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
}
|
|
206
|
+
color: {
|
|
207
|
+
field: '#{3}',
|
|
208
|
+
type: 'nominal',
|
|
209
|
+
scale: (0, utils_1.getColorScale)('nominal', true),
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
212
|
};
|
|
213
213
|
const bar_NMM = {
|
|
214
214
|
...bar_NM,
|
|
215
|
-
|
|
215
|
+
encoding: {
|
|
216
216
|
...bar_NM.encoding,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
}
|
|
217
|
+
color: {
|
|
218
|
+
field: '#{3}',
|
|
219
|
+
type: 'quantitative',
|
|
220
|
+
scale: (0, utils_1.getColorScale)('quantitative', true),
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
223
|
};
|
|
224
224
|
exports.vegaSpecs = {
|
|
225
225
|
bar_SM,
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
bar_SM_small: { ...bar_SM, ...sizeSmallStep },
|
|
227
|
+
bar_SM_medium: { ...bar_SM, ...sizeMediumStep },
|
|
228
228
|
bar_SM_large,
|
|
229
229
|
bar_SMS,
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
bar_SMS_small: { ...bar_SMS, ...sizeSmallStep },
|
|
231
|
+
bar_SMS_medium: { ...bar_SMS, ...sizeMediumStep },
|
|
232
232
|
bar_SMS_large,
|
|
233
233
|
bar_SMM,
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
bar_SMM_small: { ...bar_SMM, ...sizeSmallStep },
|
|
235
|
+
bar_SMM_medium: { ...bar_SMM, ...sizeMediumStep },
|
|
236
236
|
bar_SMM_large,
|
|
237
237
|
bar_NM,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
bar_NM_small: { ...bar_NM, ...sizeSmall },
|
|
239
|
+
bar_NM_medium: { ...bar_NM, ...sizeMedium },
|
|
240
|
+
bar_NM_large: { ...bar_NM },
|
|
241
241
|
bar_NMS,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
bar_NMS_small: { ...bar_NMS, ...sizeSmall },
|
|
243
|
+
bar_NMS_medium: { ...bar_NMS, ...sizeMedium },
|
|
244
|
+
bar_NMS_large: { ...bar_NMS, ...sizeLarge },
|
|
245
245
|
bar_NMM,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
bar_NMM_small: { ...bar_NMM, ...sizeSmall },
|
|
247
|
+
bar_NMM_medium: { ...bar_NMM, ...sizeMedium },
|
|
248
|
+
bar_NMM_large: { ...bar_NMM, ...sizeLarge },
|
|
249
|
+
bar_SSMMM: {
|
|
250
250
|
...exports.DEFAULT_SPEC,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
251
|
+
repeat: ['#{3}', '#{4}', '#{5}'],
|
|
252
|
+
spec: {
|
|
253
|
+
description: 'A simple bar chart with embedded data.',
|
|
254
|
+
encoding: {
|
|
255
|
+
y: { field: '#{1}', type: 'nominal', axis: null, sort: null },
|
|
256
256
|
},
|
|
257
|
-
|
|
257
|
+
layer: [
|
|
258
258
|
{
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
mark: {
|
|
260
|
+
type: 'bar',
|
|
261
261
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
262
|
+
encoding: {
|
|
263
|
+
x: {
|
|
264
|
+
field: { repeat: 'repeat' },
|
|
265
|
+
type: 'quantitative',
|
|
266
|
+
sort: null,
|
|
267
267
|
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
}
|
|
268
|
+
color: {
|
|
269
|
+
field: '#{2}',
|
|
270
|
+
scale: (0, utils_1.getColorScale)('nominal', true, true),
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
}
|
|
275
|
+
mark: { type: 'text', align: 'left', x: 5 },
|
|
276
|
+
encoding: {
|
|
277
|
+
text: { field: '#{1}' },
|
|
278
|
+
detail: { aggregate: 'count' },
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
283
|
},
|
|
284
|
-
|
|
284
|
+
bubble_NNM: {
|
|
285
285
|
...exports.DEFAULT_SPEC,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
286
|
+
data: [],
|
|
287
|
+
mark: 'circle',
|
|
288
|
+
width: 400,
|
|
289
|
+
encoding: {
|
|
290
|
+
y: {
|
|
291
|
+
field: '#{1}',
|
|
292
|
+
type: 'ordinal',
|
|
293
|
+
sort: null,
|
|
294
294
|
},
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
x: {
|
|
296
|
+
field: '#{2}',
|
|
297
|
+
type: 'ordinal',
|
|
298
|
+
sort: null,
|
|
299
299
|
},
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
size: {
|
|
301
|
+
field: '#{3}',
|
|
302
|
+
type: 'quantitative',
|
|
303
303
|
},
|
|
304
|
-
|
|
305
|
-
}
|
|
304
|
+
color: { value: '#4285F4' },
|
|
305
|
+
},
|
|
306
306
|
},
|
|
307
|
-
|
|
307
|
+
heat_NNM: {
|
|
308
308
|
...exports.DEFAULT_SPEC,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
data: [],
|
|
310
|
+
mark: 'bar',
|
|
311
|
+
width: 400,
|
|
312
|
+
encoding: {
|
|
313
|
+
y: {
|
|
314
|
+
field: '#{1}',
|
|
315
|
+
type: 'ordinal',
|
|
316
|
+
sort: null,
|
|
317
317
|
},
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
x: {
|
|
319
|
+
field: '#{2}',
|
|
320
|
+
type: 'ordinal',
|
|
321
|
+
sort: null,
|
|
322
322
|
},
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
}
|
|
323
|
+
color: {
|
|
324
|
+
field: '#{3}',
|
|
325
|
+
type: 'quantitative',
|
|
326
|
+
scale: (0, utils_1.getColorScale)('quantitative', false),
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
329
|
},
|
|
330
|
-
|
|
330
|
+
heat_SNM: {
|
|
331
331
|
...exports.DEFAULT_SPEC,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
332
|
+
data: [],
|
|
333
|
+
mark: 'bar',
|
|
334
|
+
width: 400,
|
|
335
|
+
encoding: {
|
|
336
|
+
y: {
|
|
337
|
+
field: '#{1}',
|
|
338
|
+
type: 'nominal',
|
|
339
|
+
sort: null,
|
|
340
340
|
},
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
x: {
|
|
342
|
+
field: '#{2}',
|
|
343
|
+
type: 'ordinal',
|
|
344
|
+
sort: null,
|
|
345
345
|
},
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
}
|
|
346
|
+
color: {
|
|
347
|
+
field: '#{3}',
|
|
348
|
+
type: 'quantitative',
|
|
349
|
+
scale: (0, utils_1.getColorScale)('quantitative', false),
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
352
|
},
|
|
353
|
-
|
|
353
|
+
stacked_line_STM: {
|
|
354
354
|
...exports.DEFAULT_SPEC,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
355
|
+
height: 50,
|
|
356
|
+
data: [],
|
|
357
|
+
mark: 'area',
|
|
358
|
+
encoding: {
|
|
359
|
+
x: {
|
|
360
|
+
field: '#{2}',
|
|
361
|
+
type: 'temporal',
|
|
362
|
+
axis: { grid: false },
|
|
363
|
+
sort: null,
|
|
364
364
|
},
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
y: {
|
|
366
|
+
field: '#{3}',
|
|
367
|
+
type: 'quantitative',
|
|
368
|
+
axis: { grid: false },
|
|
369
|
+
title: null,
|
|
370
|
+
sort: null,
|
|
371
371
|
},
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
color: {
|
|
373
|
+
field: '#{1}',
|
|
374
|
+
type: 'nominal',
|
|
375
|
+
legend: null,
|
|
376
|
+
scale: (0, utils_1.getColorScale)('nominal', false),
|
|
377
377
|
},
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
}
|
|
378
|
+
row: {
|
|
379
|
+
field: '#{1}',
|
|
380
|
+
type: 'nominal',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
383
|
},
|
|
384
|
-
|
|
384
|
+
grid_line_SSTM: {
|
|
385
385
|
...exports.DEFAULT_SPEC,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
386
|
+
height: 50,
|
|
387
|
+
data: [],
|
|
388
|
+
mark: 'area',
|
|
389
|
+
encoding: {
|
|
390
|
+
x: {
|
|
391
|
+
field: '#{3}',
|
|
392
|
+
type: 'temporal',
|
|
393
|
+
axis: { grid: false },
|
|
394
|
+
sort: null,
|
|
395
395
|
},
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
396
|
+
y: {
|
|
397
|
+
field: '#{4}',
|
|
398
|
+
type: 'quantitative',
|
|
399
|
+
axis: { grid: false },
|
|
400
|
+
title: null,
|
|
401
|
+
sort: null,
|
|
402
402
|
},
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
color: {
|
|
404
|
+
field: '#{1}',
|
|
405
|
+
type: 'nominal',
|
|
406
|
+
legend: null,
|
|
407
|
+
scale: (0, utils_1.getColorScale)('nominal', false),
|
|
408
408
|
},
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
row: {
|
|
410
|
+
field: '#{1}',
|
|
411
|
+
type: 'nominal',
|
|
412
412
|
},
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
413
|
+
column: {
|
|
414
|
+
field: '#{2}',
|
|
415
|
+
type: 'nominal',
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
419
|
};
|
|
420
420
|
function isDataContainer(a) {
|
|
421
|
-
return Array.isArray(a) || (a !== null && typeof a ===
|
|
421
|
+
return Array.isArray(a) || (a !== null && typeof a === 'object');
|
|
422
422
|
}
|
|
423
423
|
exports.isDataContainer = isDataContainer;
|
|
424
424
|
class HTMLVegaSpecRenderer extends chart_1.HTMLChartRenderer {
|
|
@@ -437,19 +437,19 @@ class HTMLVegaSpecRenderer extends chart_1.HTMLChartRenderer {
|
|
|
437
437
|
return data.value;
|
|
438
438
|
}
|
|
439
439
|
else {
|
|
440
|
-
throw new Error(
|
|
440
|
+
throw new Error('Invalid field type for vega chart.');
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
getDataType(field) {
|
|
444
444
|
if (field.isAtomicField()) {
|
|
445
445
|
if (field.isDate() || field.isTimestamp() || field.isString()) {
|
|
446
|
-
return
|
|
446
|
+
return 'nominal';
|
|
447
447
|
}
|
|
448
448
|
else if (field.isNumber()) {
|
|
449
|
-
return
|
|
449
|
+
return 'quantitative';
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
throw new Error(
|
|
452
|
+
throw new Error('Invalid field type for vega chart.');
|
|
453
453
|
}
|
|
454
454
|
translateField(explore, fieldString) {
|
|
455
455
|
const m = fieldString.match(/#\{(\d+)\}/);
|
|
@@ -466,15 +466,15 @@ class HTMLVegaSpecRenderer extends chart_1.HTMLChartRenderer {
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
else if (node && typeof node ===
|
|
469
|
+
else if (node && typeof node === 'object') {
|
|
470
470
|
for (const [key, value] of Object.entries(node)) {
|
|
471
|
-
if (key ===
|
|
471
|
+
if (key === 'field' && typeof value === 'string') {
|
|
472
472
|
node[key] = this.translateField(explore, value);
|
|
473
473
|
}
|
|
474
|
-
else if (key ===
|
|
474
|
+
else if (key === 'repeat' && Array.isArray(value)) {
|
|
475
475
|
for (const k of value.keys()) {
|
|
476
476
|
const fieldName = value[k];
|
|
477
|
-
if (typeof fieldName ===
|
|
477
|
+
if (typeof fieldName === 'string') {
|
|
478
478
|
value[k] = this.translateField(explore, fieldName);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
@@ -497,12 +497,12 @@ class HTMLVegaSpecRenderer extends chart_1.HTMLChartRenderer {
|
|
|
497
497
|
// }
|
|
498
498
|
getVegaLiteSpec(data) {
|
|
499
499
|
if (data.isNull() || !data.isArray()) {
|
|
500
|
-
throw new Error(
|
|
500
|
+
throw new Error('Expected struct value not to be null.');
|
|
501
501
|
}
|
|
502
502
|
const newSpec = (0, cloneDeep_1.default)(this.spec);
|
|
503
503
|
this.translateFields(newSpec, data.field);
|
|
504
504
|
const rdata = {
|
|
505
|
-
|
|
505
|
+
values: this.mapData(data),
|
|
506
506
|
};
|
|
507
507
|
newSpec.data = rdata;
|
|
508
508
|
return newSpec;
|