Skip to content

Commit 782117a

Browse files
committed
feat(editor): Tan example highlights using sequential color (#1149)
1 parent 009c1f7 commit 782117a

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

editor/example/json-spec/spatial-layout.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ export const EX_SPEC_SPATIAL_TAN_COMP: GoslingSpec = {
246246
},
247247
{
248248
color: {
249-
value: 'darkslateblue'
249+
field: 'coord',
250+
type: 'quantitative',
251+
domain: [900000, 249200000],
252+
range: "spectral",
250253
},
251254
size: {
252255
value: 0.02,
@@ -287,7 +290,10 @@ export const EX_SPEC_SPATIAL_TAN_COMP: GoslingSpec = {
287290
},
288291
{
289292
color: {
290-
value: 'darkslateblue'
293+
field: 'coord',
294+
type: 'quantitative',
295+
domain: [900000, 249300000],
296+
range: "spectral",
291297
},
292298
size: {
293299
value: 0.02,
-12.9 KB
Loading

src/tracks/spatial-track/spatial-track.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ function handleColorField(color?: ChannelValue | Color | string, arrowIpc: Uint8
191191
} else if (color.type === 'quantitative') {
192192
const values = fetchValuesFromColumn(color.field, arrowIpc);
193193
console.log('values', values);
194-
const [minVal, maxVal] = findMinAndMaxOfColumn(values);
194+
const [minVal, maxVal] = color.domain ? [color.domain[0], color.domain[1]] : findMinAndMaxOfColumn(values);
195195
console.log(`minVal = ${minVal}, maxVal = ${maxVal}`);
196+
const colScale = color.range ?? 'viridis';
196197
const colorConfig = {
197198
//values: values,
198199
values: [...values],
199200
min: minVal,
200201
max: maxVal,
201-
colorScale: 'viridis'
202-
//colorScale: "greens",
202+
colorScale: colScale
203203
};
204204
return colorConfig;
205205
} else {

0 commit comments

Comments
 (0)