Visualization

The Visualization Widget category consist of the following widgets:


Graph

The following tables offer usage details about the properties available to Graph widgets. Several examples follow the tables.

Properties

AttributeDescriptionTypeRequiredChanged By
defaultEdgeIconDefault image URL or Blueprint icon for edges.stringNoDirect Edit
defaultNodeIconDefault image URL or Blueprint icon for nodes.stringNoDirect Edit
directedEdgesEnabledDetermines whether edges will have an arrow at the end pointing to the target node.booleanNoDirect Edit
edgeArrowSizeSize of the arrow in a directed edge in pixels.booleanNoDirect Edit
edgeIconOffsetEdge’s icon offset from the center of the edge. The direction of the offset depends on whether or not the edge labels are horizontalnumberNoDirect Edit
edgeIconSizeWidth and height of the edge icon in pixels.numberNoDirect Edit
edgeLabelHorizontalDetermines whether edge labels stay horizontal instead of being parallel to the edge.booleanNoDirect Edit
edgeLabelOffsetEdge’s label offset from the center of the edge. The direction of the offset depends on whether or not the edge labels are horizontalnumberNoDirect Edit
edgeLengthThe edge length value supplied to Flow and Force Directed layouts.numberNoDirect Edit
edgesValues for the edges displayed in the graph.IEdgesNoDirect Edit
hideLabelsScaleThe zoom level at which the labels are hidden. Use this to hide labels that are too small to read.numberNoDirect Edit
nodeColorScaleRangeAn array of two or more colors used to create a linear gradient to color the nodes. Example: with node.colorScaleValues = [0, 5, 10] and a color range array of [“red”, “blue”] the resulting colors will be: red, purple, blue. Colors can be specified either as hex (e.g. “#FF0000”) or as CSS color names (e.g. “red”). If unspecified or fewer than 2 colors, the default color range used is composed of Blueprint colors @green4, @gold4, and @red4 ([“#15B371”, “#F2B824”, “#F55656”])string[]NoDirect Edit
nodeLabelPositionThe position of a label relative to the node circle.stringNoDirect Edit
layoutType of layout the graph will use to arrange the nodes. “Force Directed”: The graph is laid out using a method that spreads out the nodes.“Flow Up/Down/Left/Right”: The nodes are arranged so that the edges generally point in a given direction. “Manual” Allows the user to drag the nodes to new positions and persists the locations upon save. Dragged node positions in other layouts won’t be saved.stringNoDirect Edit
nodeDiameterThe diameter of the node circle in pixels.numberNoDirect Edit
nodeLabelOffsetThe label’s offset from the center of the node. The direction of the offset is determined by Label PositionnumberNoDirect Edit
nodeMarginThe minimum distance between nodes, used by Flow and Force Directed layouts.numberNoDirect Edit
nodeIconSizeThe width and height of the node icon.numberNoDirect Edit
nodesValues for the nodes displayed in the graph.INodesYesDirect Edit
nodeSelectorDiameterThe diameter of the circle indicating that the node is selected.numberNoDirect Edit
selectedNodeIdsUnique identifiers for the current user selected nodes.string[]NoUser Interaction
zoomScaleRangeSets the allowed range of zoom of the graph.numberNoDirect Edit

IEdges

AttributeDescriptionTypeRequiredChanged By
cssClassesThe CSS class names for edges used to apply CSS styles.string[]NoDirect Edit
iconsImage URLs or Blueprint icons for the edges.string[]NoDirect Edit
labelsLabels associated with the edges.string[]NoDirect Edit
sourceNodeIdsIDs of the source nodes needed to create the edges.number[]YesDirect Edit
targetNodeIdsIDs of the target nodes needed to create the edges.number[]YesDirect Edit

INodes

AttributeDescriptionTypeRequiredChanged By
colorScaleValuesThe numeric value used to color a node, interpolated using colors in Color Scale Rangenumber[]NoDirect Edit
cssClassesThe CSS class names for nodes used to apply CSS styles.string[]NoDirect Edit
iconsImage URLs or Blueprint icons for the nodes.string[]NoDirect Edit
idsUnique identifiers for the nodes.string[]YesDirect Edit
labelsLabels associated with the nodes.string[]NoDirect Edit
xPositionsIn Manual layout, this specifies the X positions of the nodes. Nodes with missing values will be arranged in a grid.number[]YesUser Interaction
yPositionsIn Manual layout, this specifies the Y positions of the nodes. Nodes with missing values will be arranged in a grid.number[]YesUser Interaction

Examples

Dynamic Graph

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "camera": { "ratio": null, "x": null, "y": null }, "edges": { "sourceNodeIds": "{{graph.sourceNodeIds}}", "targetNodeIds": "{{graph.targetNodeIds}}" }, "nodes": { "iconUrls": "{{graph.iconUrls}}", "ids": "{{graph.ids}}", "labels": "{{graph.ids}}", "xPositions": "{{graph.xPositions}}", "yPositions": "{{graph.yPositions}}" }, "selectedNodeIds": [ "n18" ] }

Static Graph

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 { "camera": { "ratio": null, "x": null, "y": null }, "defaultIconUrl": "resources/map-people.svg", "edges": { "ids": [ "e1", "e2", "e3", "e4", "e5" ], "labels": [ "e1", "e2", "e3", "e4", "e5" ], "sourceNodeIds": [ "n1", "n2", "n3", "n4", "n5" ], "targetNodeIds": [ "n2", "n3", "n4", "n5", "n1" ] }, "layout": { "type": "layered" }, "nodes": { "ids": [ "n1", "n2", "n3", "n4", "n5" ], "labels": [ "n1", "n2", "n3", "n4", "n5" ], "xPositions": [ 100, 30.9, -80.9, -80.9, 30.9 ], "yPositions": [ 0, 95.1, 58.78, -58.78, -95.1 ] }, "selectedNodeIds": [ "n1" ] }

Defaults

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "camera": { "ratio": null, "x": null, "y": null }, "edges": { "sourceNodeIds": [], "targetNodeIds": [] }, "nodes": { "ids": [], "xPositions": [], "yPositions": [] }, "selectedNodeIds": [] }

The following tables offer usage details about the properties available to Image Gallery widgets.

Properties

AttributeDescriptionTypeRequiredChanged By
imageUrlsThe images for this gallery.string[]YesDirect Edit
captionsThe captions for each image.string[]NoDirect Edit

Map

Slate’s Map widget is backed by Leaflet ↗.

The Map is composed of layers: a base layer (also called a tile layer; this is the background map imagery), and some number of overlay layers (also called feature layers; this is the data you are interested in). The Map widget supports both raster and vector tiles for feature layers.

See the Mapbox documentation ↗ for a helpful introduction to web map technology. Slate uses Mapbox as the source for its base map imagery.

Terminology

  • Map tile: the base layer of the Map widget, these tiles are simply images. They do not contain data. You can think of map tiles as the “background” of the map. Map tiles are configured in the Misc tab and apply to the entire Map widget, rather than just a single layer. Only one kind of map tile can be displayed at a time.
  • Feature: a point or shape drawn on top of a map, associated with some kind of data.
  • Vector: an alternative method of representing an image. A raster image describes the image pixel by pixel; essentially, as a grid of colored pixels. A vector image, by contrast, describes lines between points. This means that vector images can be displayed at different sizes cleanly.
  • Vector tile: contains shape data as vectors.
  • Tile server: dynamically serves shape data as tiles.
  • Map tile source: serves base tiles for a map. It is technically also a tile server.

Layer types

Slate has the following types of overlay layers:

Location

Location layers simply contain points (Leaflet markers ↗), identified by latitude/longitude pairs. You can configure the Map widget to display these points as circles or icons.

Heat map and heat grid

Heat map and heat grid layers also deal with point data, but rather than simply displaying the points on a map, they display an overlay with computations about the distribution of those points. Heat maps show the density of the points as a colored gradient, whereas heat grid groups points into buckets and displays the buckets as discrete color cells.

Shape

Instead of just individual points, shape and vector layers can also have data in the form of polygons — information stored as a series of points and the lines between them. Shape layers provide these polygons in GeoJSON ↗ format. GeoJSON files can be served directly from your Slate server.

GeoJSON features are stored as JSON and translated into SVG (image) files. These images are all loaded at once when the Map widget is first loaded.

Vector

Vector layers provide shape data in vector tiles. You must have an external tile server running to serve vector tiles. Vector tiles are loaded dynamically (only as they come into view on the map). Vector tiles also draw features directly on the canvas, rather than rendering them as images, so a vector layer can have many more features than a shape layer

Choropleth

Choropleth layers also deal with polygon data, but they add an additional value to each feature, and project these values onto a color scale. Each feature, then, is displayed on the map with a color corresponding to that value. This serves as a visualization of some specific statistic.

For example, you might have a map with states colored by population density, or zip codes colored by social vulnerability index.

Raven

Contact your Palantir representative if you need to use a Raven map in your Slate applications.

Base tiles

The Map widget comes with several options for the base tile layer. The options include a dark theme, a light theme, a satellite theme, a street map theme, and our default theme. There is also an All option, which lets you switch between themes on the map directly using the Layer Selector.

In the Misc tab of the Property Editor, choose from the Tile Layer dropdown:

base-tile-select

Data scale on the map

Shape layers (GeoJSON) support the lowest data scale. At about 1,000 features, map performance slows down noticeably. For data larger than that, you should use vector layers instead. You may also try simplifying the geometry in your GeoJSON to increase performance.

Location layers slow down at about 5,000-10,000 points.

Disabling interactivity

You can disable panning and zooming if you want to display a static map in your application. You can also remove the base layer if you simply want to show feature data (and not the base map tiles).

Examples

Location map layer

layer-location

Includes custom styles:

layer-location-custom-css

You can also style all markers/clusters in a layer using the layer name or .layer${layerIndex}. Only layer names that are valid CSS classes will be added:

layer-location-layer-styles

Choropleth map layer

layer-choropleth

Vector map layer

layer-vector

Heat map layer

layer-heatmap

Properties

AttributeDescriptionTypeRequiredChanged By
autoZoomSpecifies if the map will automatically zoom based on data in the map.booleanYesDirect Edit
boundsVisible area based on users zooming and panning. See IBounds below.IBoundsYesUser Interaction or Direct Edit
crsCoordinate reference system to use: EPSG3395 (Elliptical Mercator projection), EPSG3857 (Spherical Mercator projection) or EPSG4326 (Equirectangular projection).stringNoDirect Edit
fixedBoundsEnabledSpecifies if the bounds of the map can be changed by zooming and dragging.booleanNoDirect Edit
zoomControlEnabledSpecifies whether the map will have a clickable zoom control displayed in the top left corner.booleanNoDirect Edit
layerSelectorEnabledSpecifies whether the map will have the layer control menu displayed in the top right corner.booleanNoDirect Edit
layersSee ILayerModel.ILayerModel[]NoDirect Edit
maxBoundsMaximum visible area based available to users when zooming/panning.IBoundsNoDirect Edit
minMaxZoomLevelSets the allowed range of zoom of the map. Zoom levels range from 0, representing the entire earth, to 18, about the scale of individual houses.numberNoDirect Edit
zoomLevelThe current zoom level of the map.numberYesUser Interaction
selectionThe selection object, which contains the selection shapes and selected IDs.IMapSelectionYesUser Interaction
tileLayerEnabledSpecifies whether the tile layer (e.g. Street Map) is enabled.booleanYesDirect Edit
tileUrlsEnabledEnables the use of custom tile URLs for the tile layer. You must input the tile layer URLs and, optionally, their labels below. You must enable tile layers (above) for any custom tile layer to show. If you enable the tile layer selector, the tile URLs will be added to the selector.booleanYesDirect Edit
tileLayerThe base tile layer(s).stringYesDirect Edit
tileUrlLabelsA JSON array of names for each of your custom tile layer URLs. If you provide no labels, default names such as “Custom”, “Custom (1)”, etc. will be used.stringNoDirect Edit
tileUrlsA JSON array of custom tile layer URLs. Tile layer URLs should be in the standard form of “http:/{s}.example.com/blah/{z}/{x}/{y}.png”. Where {s} is an optional subdomain, {z} is the zoom level, and {x} and {y} are tile coordinates. This template URL will be used by the map to look up each tile image.stringNoDirect Edit
shapeSelectionEnabledEnables drag selection controls on the map. Hold down CMD or CTRL to use additive selection.Drag selection supports two modes: Area selection will create a persistent shape and will be available on the template as an array named selection.areas. Data selection further allows the user to directly select location markers, updating the value of selection.ids.booleanYesDirect Edit
selectionTypeThe mode of selection. Area selection will create a persistent shape and will be available on the template as an array named selection.areas. Data selection further allows the user to directly select location markers, updating the value of selection.ids.stringNoDirect Edit

IBaseLayerOptions

AttributeDescriptionTypeRequiredChanged By
nameThe name of the layer to be displayed in the layer selector. Location and shape layers will default to CSS selectors if no name is provided. Raven layers provide their own names, so using this field will override all of the layer names provided by this Raven layer.stringNoDirect Edit

IBounds

AttributeDescriptionTypeRequiredChanged By
northEastThe northeast point of a rectangle map area.ILatLngYesUser Interaction or Direct Edit
southWestThe southwest point of a rectangle map area.ILatLngYesUser Interaction or Direct Edit

IChoroplethLayerOptions

AttributeDescriptionTypeRequiredChanged By
colorScaleOptionsIf present, will use the specified custom color scale to color the elements in the choropleth.IColorScaleOptionsNoDirect Edit
idsThe data values that map back to the “ids” in the geoJson file. Also, the IDs returned by selection.ids based on user selection.string[]YesDirect Edit
layerSourceThe type of data that will be used to render features. The source can be either a GeoJSON file or a server that serves vector tiles.stringYesDirect Edit
shapeGeoJsonThe raw GeoJSON for the layer. Recommended value is a templatized function or query that returns a valid GeoJSON ↗ object. This value should only be set when “Shape Source” is set to “Raw”.anyNoDirect Edit
shapeSourceIndicates how the shape GeoJSON is retrieved. Use “Server Resource” to point to a static GeoJSON shapefileon the Slate server. Use “Raw” to specify the GeoJSON directly. Due to Slate application size limitations, large GeoJSONs should be retrieved as a “Server Resource” or from a query.anyNoDirect Edit
shapeUrlThe URL for the shape file. Example: “resources/map/us-states.geojson”. This value should only be set when “Shape Source” is set to “Server Resource”.stringNoDirect Edit
valuesThe values of the data points.number[]YesDirect Edit
vectorTileOptionsThe options for configuring a vector tile layer. Only available if layerSource is set to “Vector Tile”IVectorTileOptionsYesDirect Edit

IColorScaleOptions

AttributeDescriptionTypeRequiredChanged By
colorScaleTypesColor scales represent the values of data using interpolated colors.stringYesDirect Edit
colorsAn array of two or more colors used to create a linear gradient to color the elements. For example, given elements with values [0, 25, 100] and a color array of [“red”, “yellow”, “green”], the resulting colors will be: red, orange, green. Colors can be specified both as hex (e.g. “#FF0000”) or CSS color names (e.g. “red”)stringYesDirect Edit
defaultColorThe default color to be used for elements whose value is null. Can be a hex color (e.g. “#FF0000”) or a CSS color name (e.g. “red”)stringYesDirect Edit
opacityThe range of opacity for the color scale. A value of 0 is completely transparent, and a value of 1 is completely opaque.stringYesDirect Edit
linearityAdjust the linearity of the color scale. A low “linearity” value will show more color differentiation in the lower end of the scale. A value of 1 is a perfectly linear scale.stringYesDirect Edit

IHeatgridLayerOptions

AttributeDescriptionTypeRequiredChanged By
latitudesThe latitude values of the data points.number[]YesDirect Edit
longitudesThe longitude values of the data points.number[]YesDirect Edit
valuesThe values of the data points.number[]YesDirect Edit
featureSpecify how to draw each grid cell.stringNoDirect Edit
colorScaleThe color scale used to draw the cells of the heat grid.numberNoDirect Edit
granularitySize of the heatgrid cells.numberNoDirect Edit
opacityRangeThe minimum and maximum opacity of the color scalenumber[]NoDirect Edit
colorScaleLinearityDetermines how linear the color scale is. 1.0 is perfectly linear, 0.5 is square root.number[]NoDirect Edit
radiusScaleDetermines the range of the radius of the circle features. Setting the min/max of the range to the same value means all circles will be the same size.number[]NoDirect Edit

IHeatmapLayerOptions

AttributeDescriptionTypeRequiredChanged By
latitudesThe latitude values of the data points.number[]YesDirect Edit
longitudesThe longitude values of the data points.number[]YesDirect Edit
radiusThe radius of each data point. When radius is scaled with map zoom, radius is measured in the scale of the map (default value: 2); otherwise radius is measured in pixels (default value: 20).numberNoDirect Edit
scaleRadiusEnabledSpecifies whether the radius of the data points should be scaled according to the zoom level of the map (default value: true).booleanNoDirect Edit
valuesThe values of the data points.number[]YesDirect Edit

ILatLng

AttributeDescriptionTypeRequiredChanged By
latitudeA latitude value of a point on the map.numberYesUser Interaction or Direct Edit
longitudeA longitude value of a point on the map.numberYesUser Interaction or Direct Edit

ILayerModel

AttributeDescriptionTypeRequiredChanged By
optionsThe options for a layer. See IChoroplethLayerOptions, IHeatmapLayerOptions, ILocationLayerOptions, IShapeLayerOptions and IRavenLayerOptions for detailsIChoroplethLayerOptions | IHeatmapLayerOptions | ILocationLayerOptions | IShapeLayerOptionsYesDirect Edit
typeThe type of the map layer: choropleth, location, heatmap, shape or raven.stringYesDirect Edit

ILocationLayerOptions

AttributeDescriptionTypeRequiredChanged By
clusteringWhen enabled, will cluster the points on the map.booleanYesDirect Edit
cssClassesThe CSS class names for markers used to overwrite default marker settings via CSS editor.string[]NoDirect Edit
idsThe IDs returned by selection.ids based on user selection.string[]YesDirect Edit
latitudesThe latitude values of the data points.number[]YesDirect Edit
longitudesThe longitude values of the data points.number[]YesDirect Edit
weightsThe weight of the data points, aggregated for the cluster label (default value: 1).number[]NoDirect Edit
markerTypeThe type of marker, “circle” or “icon”.stringNoDirect Edit
markerRadiusThe radius of the circle markernumberNoDirect Edit

IMapSelection

AttributeDescriptionTypeRequiredChanged By
areasThis array contains the selection shapes that the user creates when drag selection is enabled. The supported shapes are ‘rectangle’ which has latitude/longitude bounds, and ‘circle’ which has a latitude/longitude center and radius (in meters)Array<IRectangleShape | ICircleShape>NoUser Interaction
idsThis array contains the IDs of location markers that are selected on the map.string[]YesUser Interaction

IRectangleShape

AttributeDescriptionTypeRequiredChanged By
boundsThe latitude/longitude bounds of the shape.IBoundsYesUser Interaction
typeThe string ‘rectangle’stringYesUser Interaction

ICircleShape

AttributeDescriptionTypeRequiredChanged By
boundsThe latitude/longitude bounds of the shape. The bounds is defined as the smallest rectangle that entirely contains the circle.IBoundsYesUser Interaction
centerThe latitude/longitude center of the circle.ILatLngYesUser Interaction
radiusThe radius (in meters) of the circle.numberYesUser Interaction
typeThe string ‘circle’stringYesUser Interaction

IRavenLayerFilterOptions

AttributeDescriptionTypeRequiredChanged By
propertyNameThe name of a property to filter on. Example: “City”stringYesDirect Edit
propertyValueThe value of a property to filter on. Example: “Medford”stringYesDirect Edit

IRavenLayerOptions

AttributeDescriptionTypeRequiredChanged By
filterIf present, will filter the Raven features based on metadata in RavenIRavenLayerFilterOptionsNoDirect Edit
serverUriThe URI to the Raven server. This domain must also be explicitly allowed in the content security policy for scripts and images in slate.yml.stringYesDirect Edit

IShapeLayerOptions

AttributeDescriptionTypeRequiredChanged By
cssClassesThe CSS class names for geojson shapes and markers used to overwrite default settings via CSS editor.string[]NoDirect Edit
idsThe data values that map back to the “ids” in the geoJson file. These are mainly used to assign CSS classes to individual geoJson IDs.string[]YesDirect Edit
markerTypeThe type of marker, “circle” or “icon”.stringNoDirect Edit
markerRadiusThe radius of the circle markernumberNoDirect Edit
shapeGeoJsonThe raw GeoJSON for the layer. Recommended value is a templatized function or query that returns a valid GeoJSON ↗ object. This value should only be set when “Shape Source” is set to “Raw”.anyNoDirect Edit
shapeSourceIndicates how the shape GeoJSON is retrieved. Use “Server Resource” to point to a static GeoJSON shapefileon the Slate server. Use “Raw” to specify the GeoJSON directly. Due to Slate application size limitations, large GeoJSONs should be retrieved as a “Server Resource” or from a query.anyNoDirect Edit
shapeUrlThe URL for the shape file. Example: “resources/map/us-states.geojson”. This value should only be set when “Shape Source” is set to “Server Resource”.stringNoDirect Edit

IVectorTileLayerOptions

AttributeDescriptionTypeRequiredChanged By
baseStyleOptions for styling the vector tile features.IVectorTileStyleOptionsNoDirect Edit
clickStyleOptions for styling the vector tile features when selected.IVectorTileStyleOptionsNoDirect Edit
hoverStyleOptions for styling the vector tile features when hovered.IVectorTileStyleOptionsNoDirect Edit
vectorTileOptionsOptions for configuring the vector tile serverIVectorTileOptionsYesDirect Edit

IVectorTileOptions

AttributeDescriptionTypeRequiredChanged By
featureIdKeyThe name of property on the features to be used as the id. Must be unique. Defaults to the string “id”.stringNoDirect Edit
layerNameString name of the layer returned by the server. Vector Tile Servers can serve many layers per tile, so this is used to pick which of those layers to render.stringYesDirect Edit
vectorTileUrlThe URL for the vector tile server that serves the tiles to be displayed. Tile should be retrieved by their x, y, and zoom (z) coordinates, so urls should contain {x}, {y}, and {z} as part of their structure.stringYesDirect Edit
featureIdWhitelistList of strings or regular expressions for filtering tile features. If this is a non-empty array, features whose featureIdKey does not match any of the strings or regular expressions will not be shown.string[]NoDirect Edit

IVectorTileStyleOptions

AttributeDescriptionTypeRequiredChanged By
colorCSS string representing the color to style the feature. Works on all feature types. Also used for outline color in the “outline” object.stringNoDirect Edit
outlineJSON object representing the styles for the outline of a polygon feature. Accepts “color” and “size” attributesobjectNoDirect Edit
radiusSize of the radius for point features.numberNoDirect Edit
sizeLine thickness of a line feature. Also used for outline thickness in the “outline” object.numberNoDirect Edit

Table

The following tables offer usage details about the properties available to Table widgets. Several examples follow the tables.

Properties

AttributeDescriptionTypeRequiredChanged By
bodyTooltipThe text displayed in the table body tooltips. If bodyTooltip is omitted or null then no tooltip will be displayed. Supports HTML.stringNoDirect Edit
columnDataData to display in the table. This is commonly just the query associated with the table. See examples below.{columnId: any[]} (Note: the columnId is a string)YesDirect Edit
columnOptionsOptions that will be applied to specific columns. See IColumnOption below.{columnId: IColumnOption} (Note: the columnId is a string)YesDirect Edit
columnOrderIndicates the order and subset of columns to be displayed. This should be an array of “columnId”s from columnData. If left as a blank array, the order may be non-deterministic.string[]YesDirect Edit
gridOptionsSee IGridOptions below.IGridOptionsYesDirect Edit
selectedRowKeysThe selectedIdentityColumnId value for all user selected rows(s).any[]YesUser Interaction
selectionIdentityColumnIdThe columnId from columnData used to determine the unique identity, or key, of a row. For a given row, the value in the “selectionIdentityColumnId” column provides the unique key. When a row is selected, the unique key is placed in “selectedRowKeys”.stringNoDirect Edit
serverEnabledEnables server-side paging and sorting. This is set to false by default. If left as false, table sorting and paging is performed client-side, resulting in fewer calls to the server and faster performance. However, because this requires all data to be loaded upfront, tables with client-side sorting require more memory. If set to true, the query must use the paging and/or sorting options to modify the returned query results. For example, if pageSize is 10, at most 10 rows can be returned.booleanYesDirect Edit
tooltipPositionSpecifies the position where tooltips will be rendered.Blueprint.PositionNoDirect Edit
tooltipsEnabledSpecifies whether tooltips are enabled or not.booleanYesDirect Edit
headerTooltipThe text displayed in the column header tooltips. If headerTooltip is omitted or null then no tooltip will be displayed. Supports HTML.stringNoDirect Edit
transposeIndicates if the table’s rows and columns should be transposed.booleanNoDirect Edit
clickEventsA list of names of click events exposed by this table widget.booleanYesDirect Edit

IColumnOption

AttributeDescriptionTypeRequiredChanged By
horizontalAlignmentHorizontal alignment for the row: left, center, or right.stringNoDirect Edit
nameThe display name for the column.stringNoDirect Edit
widthOverride for the column width.numberNoDirect Edit

IGridOptions

AttributeDescriptionTypeRequiredChanged By
enableSelectionIndicates if the user can select rows on the table.booleanNoDirect Edit
enableSortingIndicates if the user can sort the data in the table. (Values for sortOptions should also be set.)booleanNoDirect Edit
pagingOptionsSee ITablePagingOptions below.ITablePagingOptionsNoDirect Edit
selectionOptionsSee ISelectionOptions below (enableSelection must also be set to true).ISelectionOptionsNoDirect Edit
sortOptionsSee ISortOptions below (enableSorting must also be set to true).ISortOptionsNoUser Interaction

ISelectionOptions

AttributeDescriptionTypeRequiredChanged By
checkboxIndicates if a checkbox column should be displayed as a visual cue for row selection.booleanNoDirect Edit
multiSelectIndicates if multiple rows can be selected.booleanNoDirect Edit
selectionRequiredSpecifies whether you can deselect all values. When enabled, this flag prevents the user from deselecting the final selected value in the widget. If the widget starts off with no values selected, prevents deselecting only after the user makes an initial selection.booleanNoDirect Edit

ISortOptions

AttributeDescriptionTypeRequiredChanged By
columnIdThe data field by which the table is currently sorted.stringYesUser Interaction
isAscendingThe direction of the current sort.booleanYesUser Interaction

ITableHover

AttributeDescriptionTypeRequiredChanged By
columnIndexThe column number of the hovered cell. Enumeration begins at 0.numberYesUser Interaction
displayValueThe display value of the hovered cell.stringYesUser Interaction
isHeaderSpecifies whether the current cell is a header or not.stringYesUser Interaction

ITablePagingOptions

AttributeDescriptionTypeRequiredChanged By
currentOffsetCurrent visible page (indexed from 0).numberYesUser Interaction
pageSizeResults displayed per page.numberYesDirect Edit
totalServerItemsTotal number of results available (used to calculate number of pages necessary).numberNoDirect Edit

Examples

Dynamic Table

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 { "columnData": "{{query1}}", "columnOptions": { "id": { "name": "ID", "width": 50 }, "name": { "name": "Full Name" }, "address": { "name": "Home Address" }, "phone_number": { "name": "Phone Number" }, "score": { "name": "Score", "horizontalAlignment": "right" } }, "columnOrder": [ "id", "name", "address", "phone_number", "score" ], "gridOptions": { "enableSelection": true, "enableSorting": true, "pagingOptions": { "currentOffset": 0, "pageSize": 10, "totalServerItems": 100 }, "selectionOptions": { "checkbox": false, "multiSelect": true }, "sortOptions": { "columnId": "score", "isAscending": false } }, "selectedRowKeys": [], "selectionIdentityColumnId": "id", "serverEnabled": true, "tooltipsEnabled": false }

Static Table

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "columnData": { "staticOptions": [ "option1", "option2", "option3" ] }, "columnOptions": {}, "columnOrder": [], "gridOptions": { "enableSelection": true, "selectionOptions": { "checkbox": true, "multiSelect": false } }, "selectedRowKeys": [], "selectionIdentityColumnId": "staticOptions", "serverEnabled": false, "tooltipsEnabled": false }

Defaults

Copied!
1 2 3 4 5 6 7 8 9 { "columnOptions": {}, "columnOrder": [], "gridOptions": {}, "selectedRowKeys": [], "selectionIdentityColumnId": "Metric", "serverEnabled": false, "tooltipsEnabled": false }

Tutorial: Add a table widget

Say that you want to add a Table widget to display flight data. Select the Widget button in the upper left corner, then choose Visualization > Table to add a Table widget to your Slate application.

Rename the Table widget to something easier to identify. Select the name of the widget in the property editor and change it to w_flightTable.

Configure the table to use a q_allFlights query by entering "{{q_allFlights}}" in the Data field. You should see the table populate with data.

table-populated

Note that "{{q_allFlights}}" is not pure JSON syntax. The brackets are Handlebars syntax, where each expression is represented as {{expression}}. See Handlebars to learn more about its use in Slate.)

Your table now has the correct data, but the formatting could be improved. Select Add all columns to view formatting options for each column in the underlying data.

Since the flight_id column is not a human-readable column, hide that column for now. However, we will keep it in the table to refer to later when configuring the ability to select one or more rows.

For the rest of the columns, choose a display name as Title and add a format string to clean up the timestamps using formatting strings from MomentJS ↗.

table-column-formatting

We now have a table that cleanly displays all of the data:

table-formatted-columns

Next, set how a user can interact with the table through selection and sorting.

Switch to the Misc tab in the property editor, and check Allow Selection and Enable Sorting. A user can now select columns directly to see the table sorted in different ways and can click a specific row to select it.

Finally, decide what to use as the unique identifier for a given row in your table. In this case, use the name of the flight. In the dropdown labeled Key column ID, select flight_id.

table-misc-tab

If the Server Paging/Sorting option is unchecked, the table will only sort and page the data that already loaded, which in our example so far is only the first 10 rows of the table. In Slate, you can reliably load 5-10k rows into browser memory, but this will be constrained by the resources available to the browser tab for your user.

In most situations, it is best practice to configure server-side paging and sorting. Since we have about 75k flights in the last-mile-flights table and around 4 million flights in the flights table in the Foundry Reference Project, there is no way to bring all the results into the front-end at once.

Configure paging and sorting

Check the box for Enable Paging and Server Paging/Sorting. Choose a number for Page Size to set the number of rows to display to the user at a single time.

With these options enabled, your table will now keep track of the current page; we can use this information in our query to bring back just the relevant rows to display.

Open the query editor and return to q_allFlights. We will now update the LIMIT statement to reflect the page size configured in the table and add an OFFSET statement to ask Postgres to give us the correct page of results.

Use the same Handlebars syntax that we used to include data from our query into the Table widget to reference the Table widget state from inside our query:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 SELECT flight_id, carrier_code, tail_num, origin, dest, dep_ts_utc, arr_ts_utc, distance, actual_elapsed_time FROM "foundry_sync"."{{v_flightTable}}" LIMIT {{w_flightTable.gridOptions.pagingOptions.pageSize}} OFFSET {{w_flightTable.gridOptions.pagingOptions.currentOffset}}

Now, your table displays 20 rows at a time and you can select the next buttons or jump to a specific page. Now, let the table widget know the total number of rows so it can correctly display the "total entries".

To do this, create a new query called q_flightCount and count the number of rows:

Copied!
1 2 3 SELECT COUNT(flight_id) as num_flights FROM "foundry_sync"."{{v_flightTable}}"

Select Update to save the query and return to the table widget Misc tab. In the Server Total input, use Handlebars to reference the count in our query:

{{q_flightCount.num_flights.[0]}}

Now, our table knows that we are showing a particular set of rows out of the total entries (either 4.2M for the flights dataset or 73,946 for last-mile-flights).

This takes care of the paging and will let us iterate through large datasets without weighing down user browsers or timing out our queries. We still must turn on the server-side sorting so that our query responds to the user's interaction with the table.

Return to q_allFlights and add an ORDER BY clause to our query. Just as you referred to the pagingOptions.pageSize and pagingOptions.currentOffset, refer to the .sortOptions.columnId and .sortOptions.isAscending to create the right SQL statement:

Copied!
1 2 3 4 5 6 ORDER BY {{w_flightTable.gridOptions.sortOptions.columnId}} {{#if w_flightTable.gridOptions.sortOptions.isAscending}} ASC {{else}} DESC {{/if}}

You should see a newly available conditional Handlebars block statement. This statement allows you to inject logic into text interpolation. In this case, we can choose either ASC or DESC based on the user's selection in the table.

Though Handlebars are easy to use to inject simple logic into your Slate application, we generally recommend using functions to add more compelx logic to large applications.

Now, your full query should look like this:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 SELECT flight_id, carrier_code, tail_num, origin, dest, dep_ts_utc, arr_ts_utc, distance, actual_elapsed_time FROM "foundry_sync"."{{v_flightTable}}" ORDER BY {{w_flightTable.gridOptions.sortOptions.columnId}} {{#if w_flightTable.gridOptions.sortOptions.isAscending}} ASC {{else}} DESC {{/if}} LIMIT {{w_flightTable.gridOptions.pagingOptions.pageSize}} OFFSET {{w_flightTable.gridOptions.pagingOptions.currentOffset}}

Give the table a title that explains the information it displays at a glance.

Select the Widget button, select a plain Text widget from the options.

Fill in the Text widget with the title of the table: All Flights or Last Mile Flights as appropriate.

Move the Text widget to sit at the top left corner of the table, using the gridlines to ensure everything is aligned.

Now, properly line up the table beneath the title and subtitle. Select both the table and its title by holding the Cmd key and selecting (or drag-selecting) both widgets, then move both widgets so they are properly aligned under the application title.

Your application should now look like the following, with the finished Table widget. Notice that you can now select a row and sort the table.

sorted-table


Toast

The following tables offer usage details about the properties available to Toast widgets. Several examples follow the tables.

Properties

AttributeDescriptionTypeRequiredChanged By
actionTextThe text to display in action buttonstringYesDirect Edit
hasActionSpecifies whether the toast has an action button.booleanYesDirect Edit
intentVisual intent color of the toast.stringYesDirect Edit
messageThe message of the toast.stringYesDirect Edit
timeoutMilliseconds to wait before toast is automatically dismissed. Providing a value <= 0 will disable the timeout.numberYesDirect Edit

Actions

Action NameDescription
closeTriggering this action causes toast to close.
openTriggering this action causes toast to open.

Events

Event NameDescription
didCloseThis event is fired when toast has fully closed.
didOpenThis event is fired when toast has fully opened.
clickThis event is fired when toast action button is clicked.

Examples

Toast

Copied!
1 2 3 4 5 6 7 { "actionText": "Toast Example", "hasAction": false, "intent": -1, "message": "Toast Message", "timeout": 600 }

Defaults

Copied!
1 2 3 4 5 6 7 { "actionText": "Action!", "hasAction": false, "intent": -1, "message": "Message", "timeout": 3000 }

Tree

The following tables offer usage details about the properties available to Tree widgets.

Properties

AttributeDescriptionTypeRequiredChanged By
contentsContains the hierarchy of the data in JSON, using the structure from Blueprint’s ITreeNode component.jsonYesDirect Edit
selectedThe IDs of the nodes that are selectedjsonYesDirect Edit
selectionTypeDetermines the type of selection - ‘none,’ ‘single’ or ‘multiple.’stringYesDirect Edit

Defaults

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "contents": [ { "childNodes": [ {id: 3, label: "bar 1"}, {id: 4, label: "bar 2"} ], "iconName": "folder-close", "id": 1, "label": "bars", }, { "id": 2, "label": "foo" } ], "searchText": "", "selectedNodes": [], "selectionType": SelectionType.SINGLE }