Search…
vis-state

Table of Contents

visStateUpdaters

Updaters for visState reducer. Can be used in your root reducer to directly modify kepler.gl's state. Read more about Using updaters
Examples
1
import keplerGlReducer, {visStateUpdaters} from 'kepler.gl/reducers';
2
// Root Reducer
3
const reducers = combineReducers({
4
keplerGl: keplerGlReducer,
5
app: appReducer
6
});
7
8
const composedReducer = (state, action) => {
9
switch (action.type) {
10
case 'CLICK_BUTTON':
11
return {
12
...state,
13
keplerGl: {
14
...state.keplerGl,
15
foo: {
16
...state.keplerGl.foo,
17
visState: visStateUpdaters.enlargeFilterUpdater(
18
state.keplerGl.foo.visState,
19
{idx: 0}
20
)
21
}
22
}
23
};
24
}
25
return reducers(state, action);
26
};
27
28
export default composedReducer;
Copied!

addFilterUpdater

Add a new filter
Parameters
  • state Object visState
  • action Object action
    • action.dataId string dataset id this new filter is associated with
Returns Object nextState

addLayerUpdater

Add a new layer
Parameters
Returns Object nextState

applyCPUFilterUpdater

When select dataset for export, apply cpu filter to selected dataset
Parameters
Returns Object nextState

enlargeFilterUpdater

Show larger time filter at bottom for time playback (apply to time filter only)
Parameters
Returns Object nextState

INITIAL_VIS_STATE

Default initial visState
Type: Object

Properties

interactionConfigChangeUpdater

Update interactionConfig
Parameters
  • state Object visState
  • action Object action
    • action.config Object new config as key value map: {tooltip: {enabled: true}}
Returns Object nextState

layerClickUpdater

Trigger layer click event with clicked object
Parameters
  • state Object visState
  • action Object action
    • action.info Object Object clicked, returned by deck.gl
Returns Object nextState

layerHoverUpdater

Trigger layer hover event with hovered object
Parameters
  • state Object visState
  • action Object action
    • action.info Object Object hovered, returned by deck.gl
Returns Object nextState

layerTypeChangeUpdater

Update layer type. Previews layer config will be copied if applicable.
Parameters
Returns Object nextState

layerVisConfigChangeUpdater

Update layer visConfig
Parameters
  • state Object visState
  • action Object action
    • action.oldLayer Object layer to be updated
    • action.newVisConfig Object new visConfig as a key value map: e.g. {opacity: 0.8}
Returns Object nextState

layerVisualChannelChangeUpdater

Update layer visual channel
Parameters
  • state Object visState
  • action Object action
    • action.oldLayer Object layer to be updated
    • action.newConfig Object new visual channel config
    • action.channel string channel to be updated
Returns Object nextState

loadFilesErrUpdater

Trigger loading file error
Parameters
Returns Object nextState

loadFilesUpdater

Trigger file loading dispatch addDataToMap if succeed, or loadFilesErr if failed
Parameters
Returns Object nextState

mapClickUpdater

Trigger map click event, unselect clicked object
Parameters
Returns Object nextState

receiveMapConfigUpdater

Propagate visState reducer with a new configuration. Current config will be override.
Parameters
  • state Object visState
  • action Object action
    • action.payload Object map config to be propagated
      • action.payload.config Object map config to be propagated
      • action.payload.option Object {keepExistingConfig: true | false}
    • action.payload.config (optional, default {})
    • action.payload.options (optional, default {})
Returns Object nextState

removeDatasetUpdater

Remove a dataset and all layers, filters, tooltip configs that based on it
Parameters
Returns Object nextState

removeFilterUpdater

Remove a filter
Parameters
Returns Object nextState

removeLayerUpdater

remove layer
Parameters
Returns Object nextState

reorderLayerUpdater

Reorder layer
Parameters
Returns Object nextState

resetMapConfigUpdater

reset visState to initial State
Parameters
Returns Object nextState

setFilterPlotUpdater

Set the property of a filter plot
Parameters
  • state Object visState
  • action Object action
    • action.idx Number
    • action.newProp Object key value mapping of new prop {yAxis: 'histogram'}
Returns Object nextState

setFilterUpdater

Update filter property
Parameters
  • state Object visState
  • action Object action
    • action.idx Number idx of filter to be updated
    • action.prop string prop of filter, e,g, dataId, name, value
    • action.value any new value
  • datasetId string used when updating a prop (dataId, name) that can be linked to multiple datasets
Returns Object nextState

setMapInfoUpdater

User input to update the info of the map
Parameters
Returns Object nextState

showDatasetTableUpdater

Display dataset table in a modal
Parameters
Returns Object nextState

toggleFilterAnimationUpdater

Start and end filter animation
Parameters
Returns Object nextState

toggleLayerForMapUpdater

Toggle visibility of a layer in a split map
Parameters
Returns Object nextState

toggleSplitMapUpdater

Toggle visibility of a layer for a split map
Parameters
Returns Object nextState

updateAnimationTimeUpdater

Reset animation config current time to a specified value
Parameters
  • state Object visState
  • action Object action
    • action.value Number the value current time will be set to
Returns Object nextState

updateFilterAnimationSpeedUpdater

Change filter animation speed
Parameters
  • state Object visState
  • action Object action
    • action.idx Number idx of filter
    • action.speed Number speed to change it to. speed is a multiplier
Returns Object nextState

updateLayerAnimationSpeedUpdater

Update animation speed with the vertical speed slider
Parameters
  • state Object visState
  • action Object action
    • action.speed Number the updated speed of the animation
Returns Object nextState

updateLayerBlendingUpdater

update layer blending mode
Parameters
  • state Object visState
  • action Object action
    • action.mode string one of additive, normal and subtractive
Returns Object nextState

updateVisDataUpdater

Add new dataset to visState, with option to load a map config along with the datasets
Parameters
  • state Object visState
  • action Object action
    • action.datasets (Array<Object> | Object) *required datasets can be a dataset or an array of datasets
      Each dataset object needs to have info and data property.
      • action.datasets.info Object -info of a dataset
        • action.datasets.info.id string id of this dataset. If config is defined, id should matches the dataId in config.
        • action.datasets.info.label string A display name of this dataset
      • action.datasets.data Object *required The data object, in a tabular format with 2 properties fields and rows
        • action.datasets.data.fields Array<Object> *required Array of fields,
          • action.datasets.data.fields.name string *required Name of the field,
        • action.datasets.data.rows Array<Array> *required Array of rows, in a tabular format with fields and rows
    • action.options Object option object {centerMap: true, keepExistingConfig: false}
    • action.config Object map config
Returns Object nextState
Last modified 2yr ago