influxdata / influxdata/giraffe
GeoWidget: Tracks seem to be bound to field named 'table'
- Dominant language
- TypeScript
- Stars
- 189
- Forks
- 33
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
**Build**
Detected in PR 365 - Dubsky fork
```
commit 361b63bc55ac4989f17f03f33165d3070c7236b2
```
**Use Case**
I've extracted the data for tracks using the following query.
```javascript
import "experimental/geo"
from(bucket: "qa")
|> range(start: -2h)
|> filter(fn: (r) => r["_measurement"] == "voieGis" )
|> geo.toRows()
|> geo.asTracks(groupBy: ["ligne"], orderBy: ["_time"])
```
This returns records with the fields `[_time,_measurement,cl, ligne, nom, st, dur, mag, lat, lon]`. Note there is no field named "`table`". The results are stored in a `data` object passed as a property to a React component.
The track configuration is as follows.
```javascript
const config: Config = {
table: fromRows(data),
showAxes: false,
layers: [
{
type: 'geo',
lat: latitude,
lon: longitude,
zoom: 8,
allowPanAndZoom: true,
detectCoordinateFields: true,
layers: [
{
type: 'trackMap',
speed: 1000,
trackWidth: 4,
randomColors: true,
endStopMarkers: true,
endStopMarkerRadius: 4,
colors: undefined
},
],
tileServerConfiguration,
} as GeoLayerConfig,
],
}
```
**Expected Behavior**
I was expecting to find in the configuration a property that can be used to declare which field in the data object is to be used to organize the rendering of the tracks. In the current case I wanted to use 'ligne'. The tracks roughly follow railway lines.
**Actual Behavior**
Not finding a property to specify the structuring field I proceeded ahead. A single track was displayed moving through all data points.
To fix this I followed the storybook example and created a field named "table". The tracks were then rendered as expected.
```javascript
data.forEach(rec => {
rec.table = rec.ligne;
})
```
**Comment**
It would be nice if the required field can be declared in the configuration, instead of having to rely on a hard coded 'table' field.
**Screenshots**
_without the 'table' field_

_with the 'table' field_ :+1: :

Contributor guide
Assessment
This issue has not been assessed yet.