Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions examples/official-site/content/components/map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
icon: map
since: 0.8.0
category: display-data
summary: Plot locations and geographic shapes on an interactive map.
top:
- name: attribution
type: HTML
description: Text to display at the bottom right of the map. Defaults to "© OpenStreetMap".
- class
- name: height
type: INTEGER
description: Height of the map, in pixels. Default to 350px
- id
- name: latitude
type: REAL
description: Latitude of the center of the map. If omitted, the map will be centered on its markers.
- name: longitude
type: REAL
description: Longitude of the center of the map.
- name: max_zoom
type: INTEGER
description: How far the map can be zoomed in. Defaults to 18. Added in v0.15.2.
- name: tile_source
type: URL
description: Custom map tile images to use, as a URL. Defaults to "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png".
Added in v0.15.2.
- name: title
type: TEXT
description: A text header displayed above the map.
- name: zoom
type: REAL
description: Zoom Level to apply to the map. Defaults to 5.
row:
- name: color
type: COLOR
description: Background color of the marker on the map. Requires "icon" to be set.
- name: description
type: TEXT
description: Plain text description of the marker, to be displayed in a tooltip when the marker is clicked.
- name: description_md
type: TEXT
description: Description of the marker, in markdown, rendered in a tooltip when the marker is clicked.
- name: geojson
type: JSON
description: A GeoJSON geometry (line, polygon, ...) to display on the map. Can be styled using geojson
properties using the name of leaflet path options. Introduced in 0.15.1. Accepts raw strings in addition
to JSON objects since 0.15.2.
- name: icon
type: ICON
description: Name of the icon to use for the marker
- name: latitude
type: REAL
required: true
description: Latitude of the marker. Required only if geojson is not set.
- name: link
type: TEXT
description: A link to associate to the marker's title. If set, the marker tooltip's title will be clickable
and will open the link.
- name: longitude
type: REAL
required: true
description: Longitude of the marker. Required only if geojson is not set.
- name: size
type: INTEGER
description: Size of the marker icon. Requires "icon" to be set. Introduced in 0.15.2.
- name: title
type: TEXT
description: Title of the marker, displayed on hover and in the tooltip when the marker is clicked.
---

## Visualize SQL data on a map.

The map component displays a custom interactive map with markers on it.

In its simplest form, the component displays points on a map from a table of latitudes and longitudes.
But it can also be used by cartographers in combination with PostgreSQL's PostGIS or SQLite's spatialite,
to create custom visualizations of geospatial data.
Use the `geojson` property to generate rich maps from a GIS database.

### Example Use Cases

1. **Store Locator**: Build an interactive map to find the nearest store information using SQL-stored geospatial data.
2. **Delivery Route Optimization**: Visualize the results of delivery route optimization algorithms.
3. **Sales Heatmap**: Identify high-performing regions by mapping sales data stored in SQL.
4. **Real-Time Tracking**: Create dynamic dashboards that track vehicles, assets, or users live using PostGIS or MS SQL Server geospatial time series data. Use the [shell](?component=shell) component to auto-refresh the map.
5. **Demographic Insights**: Map customer demographics or trends geographically to uncover opportunities for growth or better decision-making.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
rows:
- component: map
- title: New Delhi
latitude: 28.6139
longitude: 77.209
---

### Adding a marker to a map

Showing how to place a marker on a map. Useful for basic location displays like showing a single office location, event venue, or point of interest. The marker shows basic hover and click interactions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
rows:
- component: map
zoom: 5
max_zoom: 8
height: 600
latitude: -25
longitude: 28
tile_source: https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png
attribution: ''
- icon: peace
size: 20
link: https://en.wikipedia.org/wiki/Nelson_Mandela
geojson: '{"type":"Feature", "properties": { "title":"Mvezo, Birth Place of Nelson Mandela" }, "geometry":
{ "type":"Point", "coordinates": [28.49, -31.96] }}'
- component: text
contents_md: >-
Map data: [© OpenStreetMap contributors](https://www.openstreetmap.org/copyright), SRTM.
Map style: [© OpenTopoMap](https://opentopomap.org/) ([CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/)).
---

### Advanced map customization using GeoJSON and custom map tiles

This example demonstrates using topographic map tiles, custom marker styling,
and clickable markers that link to external content - perfect for educational or tourism applications.

The [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) feature here is a single point. Its coordinates are `[longitude, latitude]`; the top-level `latitude` and `longitude` set the map's initial center.

- You can generate GeoJSON data from PostGIS geometries using the [`ST_AsGeoJSON`](https://postgis.net/docs/ST_AsGeoJSON.html) function.
- In spatialite, you can use the [`AsGeoJSON`](https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.1.0.html#p3misc) function.
- In MySQL, you can use the [`ST_AsGeoJSON()`](https://dev.mysql.com/doc/refman/8.0/en/spatial-geojson-functions.html#function_st-asgeojson) function.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
rows:
- component: map
title: Paris
zoom: 13
latitude: 48.85
longitude: 2.34
tile_source: https://api.maptiler.com/maps/streets-v2/{z}/{x}/{y}.png?key=RwoF6Y3gcKx4OBMbvqOY
- title: Notre Dame
icon: building-castle
color: indigo
latitude: 48.853
longitude: 2.3498
description_md: A beautiful cathedral.
link: https://en.wikipedia.org/wiki/Notre-Dame_de_Paris
- title: Eiffel Tower
icon: tower
color: red
latitude: 48.8584
longitude: 2.2945
description_md: A tall tower. [Wikipedia](https://en.wikipedia.org/wiki/Eiffel_Tower)
- title: Tower to Cathedral
geojson:
type: LineString
coordinates:
- - 2.2945
- 48.8584
- - 2.3498
- 48.853
color: teal
description: A nice 45 minutes walk.
---

### Maps with links and rich descriptions

Demonstrates how to create an engaging map with custom icons, colors, rich descriptions with markdown support, and connecting points with lines.
Perfect for visualizing multi-dimensional relationships between points on a map, like routes between locations.

Note that the map tile source is set to a MapTiler map. The API key included in the URL in this demo will not work on your own website.
You should get your own API key at [MapTiler](https://www.maptiler.com/cloud/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
rows:
- component: map
tile_source: false
- title: MySQL
color: red
description: This literal red square is defined as a GeoJSON polygon. Each (x,y) coordinate is a JSON array.
geojson:
type: Polygon
coordinates:
- - - 0
- 0
- - 0
- 4
- - 4
- 4
- - 4
- 0
- - 0
- 0
- title: SQLite
color: blue
description: This 2D shape was generated by a SQL query.
geojson:
type: Polygon
coordinates:
- - - 5
- 0
- - 9
- 0
- - 7
- 4
- - 5
- 0
---

### Abstract geometric visualizations

Example showing how to create abstract geometric visualizations without a base map.
Useful for displaying spatial data that doesn't need geographic context, like floor plans, seating charts,
or abstract 2D data visualizations.
41 changes: 41 additions & 0 deletions examples/official-site/content/components/timeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
icon: git-commit
since: 0.13.0
category: display-data
summary: Arrange events along a vertical timeline.
top:
- class
- id
- name: simple
type: BOOLEAN
description: If set to true, the timeline will be displayed in a condensed format without icons.
row:
- class
- name: color
type: TEXT
description: Color of the icon. See preview.tabler.io/colors.html for a list of available colors.
- name: date
type: TEXT
required: true
description: Date of the event.
- name: description
type: TEXT
description: Textual description of the event.
- name: description_md
type: TEXT
description: Description of the event in Markdown.
- name: icon
type: TEXT
description: Name of the icon to display next to the event. See tabler-icons.io for a list of available
icons.
- id
- name: link
type: TEXT
description: Link to a page with more information about the event.
- name: title
type: TEXT
required: true
description: Name of the event.
---

A list of events with a vertical line connecting them.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
rows:
- component: timeline
simple: true
- title: New message from Elon Musk
date: '13:00'
- title: Jeff Bezos assigned task "work more" to you.
date: yesterday, 16:35
---

A basic timeline with just names and dates.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
rows:
- component: timeline
- title: v0.13.0 was just released !
link: https://github.com/sqlpage/SQLPage/releases/
date: '2023-10-16'
icon: brand-github
color: green
description_md: This version introduces the `timeline` component.
- title: They are talking about us...
description_md: '[This article](https://www.postgresql.org/about/news/announcing-sqlpage-build-dynamic-web-applications-in-sql-2672/)
on the official PostgreSQL website mentions SQLPage.'
date: '2023-07-12'
icon: database
color: blue
---

A full-fledged timeline with icons, colors, and rich text descriptions.
44 changes: 44 additions & 0 deletions examples/official-site/content/components/tracking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
icon: timeline-event-text
since: 0.18.0
category: display-data
summary: Show a sequence of activity or status changes as colored segments.
top:
- name: center
type: BOOLEAN
description: Whether to center the component.
- class
- name: description
type: TEXT
description: A short paragraph.
- name: description_md
type: TEXT
description: A short paragraph formatted using markdown.
- id
- name: information
type: TEXT
description: A short text displayed below the title.
- name: placement
type: TEXT
description: Position of the tooltip (e.g. top, bottom, right, left)
- name: title
type: TEXT
required: true
description: Title of the tracking component.
- name: width
type: INTEGER
description: Width of the component, between 1 and 12.
row:
- name: color
type: TEXT
description: Color of the tracked item (e.g. success, warning, danger)
- name: link
type: URL
description: A URL to open when the user clicks on the tracked item.
- name: title
type: TEXT
required: true
description: Description of the state.
---

Component for visualising activity logs or other monitoring-related data.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
rows:
- component: tracking
title: Servers status
- title: No data
- title: No data
- title: No data
- title: No data
- title: No data
- title: No data
- title: No data
- title: No data
---

A basic example of servers tracking component
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
rows:
- component: tracking
title: Servers status
information: 60% are running
description_md: Status of all **currently running servers**
placement: top
width: 4
- color: success
title: operational
- color: success
title: operational
- color: success
title: operational
- color: danger
title: Downtime
- title: No data
- color: success
title: operational
- color: warning
title: Big load
- color: success
title: operational
---

An example of servers tracking component
Loading
Loading