Skip to content

Commit

Permalink
support save custom colorScale
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Apr 9, 2024
1 parent 7ffb197 commit 39ba96d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {appInjector} from './container';
export {default as KeplerGl, default, injectComponents, ContainerFactory, ERROR_MSG} from './container';

// factories
export {default as KeplerGlFactory, DEFAULT_KEPLER_GL_PROPS, getVisibleDatasets, makeGetActionCreators, mapFieldsSelector, plotContainerSelector} from './kepler-gl';
export {default as KeplerGlFactory, DEFAULT_KEPLER_GL_PROPS, getVisibleDatasets, makeGetActionCreators, mapFieldsSelector, plotContainerSelector, sidePanelSelector} from './kepler-gl';
export {default as SidePanelFactory} from './side-panel';
export {default as PanelTitleFactory} from './side-panel/panel-title';
export {default as MapContainerFactory, Attribution} from './map-container';
Expand Down
9 changes: 6 additions & 3 deletions src/layers/src/base-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export type LayerBaseConfig = {
dataId: string;
label: string;
color: RGBColor;
colorScale?: VisualChannelScale;
colorField?: VisualChannelField;
colorDomain?: VisualChannelDomain;

columns: LayerColumns;
isVisible: boolean;
Expand Down Expand Up @@ -459,9 +462,9 @@ class Layer {

// TODO: refactor this into separate visual Channel config
// color by field, domain is set by filters, field, scale type
colorField: null,
colorDomain: [0, 1],
colorScale: SCALE_TYPES.quantile,
colorField: props.colorField || null,
colorDomain: props.colorDomain || [0, 1],
colorScale: props.colorScale || SCALE_TYPES.quantile,

// color by size, domain is set by filters, field, scale type
sizeDomain: [0, 1],
Expand Down
2 changes: 1 addition & 1 deletion src/layers/src/layer-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function getGeojsonLayerMetaFromArrow({
chunkOffset: geoColumn.data[0].length * chunkIndex
}
: {}),
triangulate: true,
triangulate: false,
calculateMeanCenters: true
};
// create binary data from arrow data for GeoJsonLayer
Expand Down
3 changes: 3 additions & 0 deletions src/schemas/src/vis-state-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ export const layerPropsV1 = {
dataId: null,
label: null,
color: null,
colorScale: null,
colorField: null,
colorDomain: null,
highlightColor: null,
columns: new ColumnSchemaV1({
version: VERSIONS.v1,
Expand Down

0 comments on commit 39ba96d

Please sign in to comment.