Widgets

There are several pre-build Widgets within Isthmus that can be used for manipulating data viewed within the map. Please review the roadmap for future additions and open an issue for other suggestions.

In the base example, widgets are rendered in the RightBar.js file however using Airship, they can be placed in any container.

General Concepts

  • Make sure to use the correct import syntax

  • There are far more props in the widgets, so make sure to follow the documentation closely

Category Widget

import Category from '.././widgets/Category'

<Category
    title='Railroad Company'
    description='Total damage for each railroad company in USD'
    categoryLayer={this.props.layers.railaccidents.source}
    column='railroad'
    operation={carto.operation.SUM}
    operationColumn='total_damage'
/>

The Category component adds in a Category widget from Airship and creates a Dataview and Filter on the layer you are applying the widget to. See the Airship docs for more details. It takes the following props:

Histogram Widget

import Histogram from '.././widgets/Histogram'

<Histogram
      title='Hour'
      description='Hour at the time of the accident'
      layer={this.props.layers.railaccidents.source}
      column='hour'
      bins={12}
/>

The Histogram component adds in a Histogram widget from Airship and creates a Dataview and Filter on the layer you are applying the widget to. See the Airship docs for more details. It takes the following props:

Range Slider

import Range from '.././widgets/Range'

<Range
        before=''
        after='°F'
        title='Temperature'
        description='Temperature at the time of the accident'
        layer={this.props.layers.railaccidents.source}
        column='temp'
        step={1}
/>

The Range component adds in a Range widget from Airship and creates a Filter on the layer you are applying the widget to. See the Airship docs for more details. It takes the following props:

Formula

import Formula from '.././widgets/Formula'

<Formula
    title='Total Damage'
    description='Average total damage in USD for accidents in view'
    round={true}
    currency={true}
    locale='en-US'
    currencyType='USD'
    layer={this.props.layers.railaccidents.source}
    column='total_damage'
    operation={carto.operation.AVG}
/>

The Formula component adds in a text display and creates a Filter (along with a bounding box filter) on the layer you are applying the widget to. It takes the following props:

import TextSearch from '.././widgets/TextSearch'

<TextSearch
    title='Accident Description'
    description='Search text in the accident description field'
    id='search'
    layer={this.props.layers.railaccidents.source}
    placeholder='Search...'
    column='narrative'
/>

The TextSearch component adds in a text search input field and creates a Filte on the layer you are applying the widget to. It takes the following props:

Infowindow

Lacking configuration - coming soon

Export

import Export from '.././widgets/Export'

<Export
  layer={this.props.layers.railaccidents.source}
  format='shp'
  filename='rail_data'
  name='Export Data'
/>

Export creates a button to export your data with the current set of applied filters. It takes the following props:

Last updated